Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'rse/plugins/org.eclipse.rse.ui/UI/org/eclipse')
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/DefaultUIInteractionProvider.java179
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.java56
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.properties44
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java205
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEImageMap.java49
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSESystemTypeAdapterFactory.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEUIInitJob.java47
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemProfileForm.java263
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.java49
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.properties36
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResourceListener.java819
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.java1051
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.properties1093
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemSortableSelection.java133
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemTabFolderLayout.java62
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingBrowseWithAction.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingCompareWithAction.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingExpandToAction.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingGoToAction.java85
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingNewAction.java50
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingOpenWithAction.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingPulldownMenuAction.java107
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServerBaseAction.java140
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServersAction.java102
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingReplaceWithAction.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingViewAction.java49
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingWorkWithAction.java50
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionCopyString.java69
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionDeleteString.java70
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringDown.java69
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringUp.java69
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionPasteString.java68
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearAllPasswordsAction.java116
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearPasswordAction.java86
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAction.java87
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAllAction.java72
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonDeleteAction.java408
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonRenameAction.java244
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonSelectAllAction.java74
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java116
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAllSubSystemsAction.java155
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCopyConnectionAction.java251
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAction.java71
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAllSubSystemsAction.java107
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExpandAction.java90
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExportConnectionAction.java134
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java137
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java129
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterAction.java367
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterPoolAction.java328
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterStringAction.java496
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterAction.java154
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterPoolReferenceAction.java142
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterAction.java375
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterPoolAction.java367
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterStringAction.java490
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterAction.java157
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterPoolReferenceAction.java142
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterNewFilterPoolAction.java176
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterPoolReferenceSelectAction.java85
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterRemoveFilterPoolReferenceAction.java94
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterSelectFilterPoolsAction.java270
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsAction.java204
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java82
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemImportConnectionAction.java149
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveConnectionAction.java260
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveDownConnectionAction.java110
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveUpConnectionAction.java111
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemNewProfileAction.java114
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenExplorerPerspectiveAction.java187
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenRSEPerspectiveAction.java43
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java73
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceRestoreStateAction.java74
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceShowFilterPoolsAction.java76
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameCopyAction.java222
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameSelectAction.java59
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStartAction.java59
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStopAction.java59
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemResolveFilterStringAction.java75
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRunAction.java96
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSeparatorAction.java60
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInMonitorAction.java105
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInTableAction.java104
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowPreferencesPageAction.java215
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemStringPromptAction.java99
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManager.java404
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManagerForTesting.java183
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTeamReloadAction.java77
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTestFilterStringAction.java96
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToAllAction.java53
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToBaseAction.java100
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java176
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkWithProfilesAction.java56
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/CopyRunnable.java38
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemControlEnableState.java156
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyDialog.java156
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyProfileDialog.java281
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableProvider.java160
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableRow.java180
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java296
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java173
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableRow.java205
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java696
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableProvider.java216
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableRow.java214
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemResolveFilterStringDialog.java113
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemTestFilterStringDialog.java217
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java347
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterPoolManagerUIProvider.java27
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterWorkWithFilterPoolsTreeViewer.java193
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java199
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java373
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java72
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterPoolWizardDialog.java85
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWizardDialog.java77
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java662
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemUnNamedFilterDialog.java215
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.java30
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.properties30
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferencePage.java246
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java253
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java128
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java190
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java202
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java402
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectorServicesPropertyPage.java90
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolPropertyPage.java126
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolReferencePropertyPage.java115
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPropertyPage.java137
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemLoggingPreferencePage.java36
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemPreferenceInitializer.java42
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewProfilePropertyPage.java115
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java146
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ContextObjectWithViewer.java77
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java78
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ISystemMementoConstants.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SafeTreeViewer.java161
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SubSystemConfigurationAdapterFactory.java60
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxCellEditor.java225
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxPropertyDescriptor.java90
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java874
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDecoratingLabelProvider.java59
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDeferredTableTreeContentManager.java82
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDropActionDelegate.java280
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemEmptyListAPIProviderImpl.java87
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritablePropertyData.java174
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextCellEditor.java517
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextPropertyDescriptor.java114
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveHelpers.java188
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveLayout.java94
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPropertySheetForm.java225
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResolveFilterStringAPIProviderImpl.java41
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java646
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java194
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java631
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeView.java2057
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeViewProvider.java473
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java147
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewFilter.java105
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java1993
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java186
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java128
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java6625
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForConnections.java100
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterPools.java120
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java191
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java253
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForSubSystems.java99
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAdapterFactory.java169
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewCompositeActionGroup.java105
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java734
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDragAdapter.java436
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java414
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDummyObject.java45
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java593
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolAdapter.java299
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolReferenceAdapter.java416
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java1049
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterStringAdapter.java297
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewForm.java542
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewLabelAndContentProvider.java498
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMenuListener.java170
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMessageAdapter.java210
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewNewConnectionPromptAdapter.java39
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java2053
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartFrameSource.java56
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartGotoActionGroup.java107
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java227
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java143
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties117
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java245
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewScratchpadAdapter.java284
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewSubSystemAdapter.java818
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/BrowseAction.java55
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearAction.java53
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearSelectedAction.java60
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewPage.java587
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewWorkbook.java281
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorUI.java78
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorViewPart.java1133
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/TabFolderLayout.java62
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/BrowseAction.java54
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearAction.java68
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearSelectedAction.java105
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadView.java1976
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewPart.java418
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewProvider.java269
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchClearHistoryAction.java53
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchCopyToClipboardAction.java57
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchHistoryAction.java64
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveAllMatchesAction.java54
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java54
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableView.java387
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableViewProvider.java46
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchUI.java73
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewContentProvider.java184
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewLabelProvider.java94
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewPart.java1278
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemResourceAdaptableProfile.java36
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamView.java269
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryAdapter.java328
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryNode.java155
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewContentProvider.java245
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewInputProvider.java149
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewLabelProvider.java215
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeActiveProfileAction.java92
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java92
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPart.java1585
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewProfileAdapter.java401
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetAdapter.java258
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetNode.java146
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewRefreshAllAction.java80
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewResourceAdapterFactory.java70
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationAdapter.java306
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java213
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/SSLForm.java118
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/ServerConnectionSecurityForm.java95
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRSEAdapter.java34
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRemoteSelectionAddListener.java67
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java39
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java296
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java43
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java333
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java38
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java235
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java35
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java80
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java41
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java28
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java37
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java33
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemViewSupplier.java38
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java88
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java113
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java198
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseUnlessQuoted.java96
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerRemoveQuotes.java194
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java670
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEAdapter.java44
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java308
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java723
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemActionViewerFilter.java199
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java304
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBasePlugin.java810
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java1543
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemMenuManager.java397
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java564
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java1527
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayHidableSystemMessageAction.java65
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java64
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java111
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java33
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java57
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemViewMenuListener.java28
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java25
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/LazyDownloadJob.java44
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java818
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseCopyAction.java442
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDialogAction.java358
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java29
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java484
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseWizardAction.java266
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyToClipboardAction.java337
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java232
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java360
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java180
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java104
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java525
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java248
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ICredentialsValidator.java44
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java100
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java62
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java42
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemChangePasswordDialog.java273
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java360
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java515
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java1849
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java311
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameSingleDialog.java754
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java115
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java469
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java331
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentProvider.java163
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleCopyDialog.java276
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleSelectDialog.java489
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java183
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemChangeFilterPaneEditPaneSupplier.java35
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemFilterStringEditPaneListener.java44
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java1440
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInputs.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInterface.java43
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogOutputs.java42
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java730
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java173
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java40
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java253
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java233
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java496
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java89
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java86
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java493
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java26
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java123
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java366
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInputs.java32
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInterface.java36
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogOutputs.java33
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java30
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizard.java676
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardConfigurator.java240
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java114
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java258
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java556
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java94
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java33
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java123
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java914
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java642
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java153
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java93
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java86
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java50
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java46
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java126
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java802
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java186
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java49
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java120
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java41
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java120
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemDeferredTreeContentManager.java132
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java572
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java283
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java200
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java46
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java219
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java28
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java48
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ServicesPropertyPage.java143
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java401
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java534
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java133
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java325
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java497
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java342
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemIntegerFieldEditor.java100
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemKeyValueFieldEditor.java641
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java371
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCore.java88
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java411
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java111
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java559
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidator.java52
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java49
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java40
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java74
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java74
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java100
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFactory.java41
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFileName.java143
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterName.java102
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java99
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java157
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFolderName.java145
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerInput.java163
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java115
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java96
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java162
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java113
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java127
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPortInput.java79
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorProfileName.java92
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java39
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java67
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java110
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java206
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java122
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUniqueString.java363
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java51
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java46
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java2354
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ContextObject.java69
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IContextObject.java52
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java24
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java165
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java36
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java128
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java147
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java42
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemResourceSelectionInputProvider.java80
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java43
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProvider.java101
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java39
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTableViewColumnManager.java26
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java238
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java34
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java482
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java29
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IViewLinker.java39
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java1234
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java239
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAdapterHelpers.java112
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java35
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java2089
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java378
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/EnvironmentVariablesForm.java610
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/GridUtil.java68
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IInheritableEntryFieldStateChangeListener.java31
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java61
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java47
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java29
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java96
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java53
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java265
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java216
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java44
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java390
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteBaseServerLauncherForm.java112
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteServerLauncherForm.java661
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java441
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java452
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java718
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java1188
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java400
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServiceElement.java109
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServicesForm.java177
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/FactoryServiceElement.java166
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertyElement.java115
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java224
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RSEModelServiceElement.java149
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RootServiceElement.java107
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java92
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceElement.java103
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceServiceElement.java103
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableContentProvider.java68
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableLabelProvider.java91
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java306
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemNewConnectionWizardPage.java153
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java429
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java471
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java105
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java53
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDialogPageMessageLine.java115
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java305
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java104
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java215
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSEDynamicNewConnectionWizard.java32
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSENewConnectionWizardDescriptor.java40
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/ISystemNewConnectionWizardPage.java44
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEAbstractNewConnectionWizard.java89
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java557
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java172
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java434
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardDescriptor.java89
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardRegistry.java153
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java389
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeDataManager.java177
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeElement.java111
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardCategory.java26
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardDescriptor.java69
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardRegistryElement.java57
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardRegistry.java134
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardSelectionTreeDataManager.java75
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardCategory.java49
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardDescriptor.java116
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardRegistryElement.java101
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeContentProvider.java70
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeElement.java162
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeLabelProvider.java46
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreePatternFilter.java123
490 files changed, 0 insertions, 123647 deletions
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/DefaultUIInteractionProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/DefaultUIInteractionProvider.java
deleted file mode 100644
index e715cde09..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/DefaultUIInteractionProvider.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [190231] initial API and implementation
- * Martin Oberhuber (Wind River) - brought in methods from SubSystem (c) IBM
- * Martin Oberhuber (Wind River) - [236355] [api] Add an IRSEInteractionProvider#eventExec() method
- *******************************************************************************/
-package org.eclipse.rse.internal.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.rse.core.IRSEInteractionProvider;
-import org.eclipse.rse.core.IRSERunnableWithProgress;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A Default Interaction Provider that runs in the Eclipse / SWT UI. Meant to
- * provide the same functionality as it was there before UI / Non-UI Splitting.
- * <p>
- * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
- * part of a work in progress. There is no guarantee that this API will work or
- * that it will remain the same. Please do not use this API without consulting
- * with the <a href="http://www.eclipse.org/dsdp/tm/">Target Management</a>
- * team.
- * </p>
- *
- * @since org.eclipse.rse.ui 3.0
- */
-public class DefaultUIInteractionProvider implements IRSEInteractionProvider {
-
- private Shell shell = null;
-
- private class NullRunnableContext implements IRunnableContext {
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- IProgressMonitor monitor = new NullProgressMonitor();
- runnable.run(monitor);
- }
- }
-
- /**
- * Get the progress monitor dialog for this operation. We try to use one for
- * all phases of a single operation, such as connecting and resolving.
- *
- * @deprecated this is scheduled to be removed since we want to avoid UI
- * components in SubSystem.
- */
- protected IRunnableContext getRunnableContext(/* Shell rshell */) {
- if (Display.getCurrent() == null) {
- return new NullRunnableContext();
- }
- // for wizards and dialogs use the specified context that was placed in
- // the registry
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc != null) {
- SystemBasePlugin.logInfo("Got runnable context from system registry"); //$NON-NLS-1$
- return irc;
- } else {
- // for other cases, use statusbar
- IWorkbenchWindow win = SystemBasePlugin.getActiveWorkbenchWindow();
- if (win != null) {
- Shell winShell = getActiveWorkbenchShell();
- if (winShell != null && !winShell.isDisposed() && winShell.isVisible()) {
- SystemBasePlugin.logInfo("Using active workbench window as runnable context"); //$NON-NLS-1$
- shell = winShell;
- return win;
- // dwd } else {
- // dwd win = null;
- }
- }
- // dwd if (shell == null || shell.isDisposed() ||
- // !shell.isVisible()) {
- // dwd SystemBasePlugin.logInfo("Using progress monitor dialog with
- // given shell as parent");
- // dwd shell = rshell;
- // dwd }
- // dwd IRunnableContext dlg = new ProgressMonitorDialog(rshell);
- IRunnableContext dlg = new ProgressMonitorDialog(shell);
- return dlg;
- }
- }
-
- /**
- * Helper/convenience method. Return shell of active window.
- */
- public static Shell getActiveWorkbenchShell() {
- Shell result = null;
- if (PlatformUI.isWorkbenchRunning()) {
- try {
- IWorkbenchWindow window = getActiveWorkbenchWindow();
- if (window != null) {
- result = window.getShell();
- }
- } catch (Exception e) {
- return null;
- }
- } else // workbench has not been loaded yet!
- {
- return null;
- }
- return result;
- }
-
- /**
- * Helper/convenience method. Return active window
- */
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return RSEUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
- public void runInDefaultContext(boolean fork, boolean cancellable, IRSERunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
- // TODO Auto-generated method stub
- }
-
- private Display getDefaultDisplay() {
- Display d = Display.getCurrent();
- if (d == null) {
- d = SystemBasePlugin.getActiveWorkbenchShell().getDisplay();
- if (d == null) {
- d = Display.getDefault();
- }
- }
- return d;
- }
-
- public void asyncExec(final Runnable runnable) {
- getDefaultDisplay().asyncExec(runnable);
- }
-
- public void eventExec(final Runnable runnable) {
- if (Display.getCurrent() != null) {
- runnable.run();
- } else {
- asyncExec(runnable);
- }
- }
-
- public void flushRunnableQueue() {
- Display d = Display.getCurrent();
- if (d == null) {
- getDefaultDisplay().syncExec(new Runnable() {
- public void run() {
- flushRunnableQueue();
- }
- });
- } else {
- while (d.readAndDispatch()) {
- // flush the event queue
- }
- }
- }
-
- public IProgressMonitor getDefaultProgressMonitor() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void showMessage(SystemMessage msg) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.java
deleted file mode 100644
index 790b829c0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [220309] [nls] Some GenericMessages and SubSystemResources should move from UI to Core
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class GenericMessages extends NLS
-{
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.ui.GenericMessages";//$NON-NLS-1$
-
- public static String ResourceNavigator_goto;
-
-
- public static String TransferOperation_message;
-
-
-
- public static String TypesFiltering_title;
- public static String TypesFiltering_message;
- public static String TypesFiltering_otherExtensions;
- public static String TypesFiltering_typeDelimiter;
-
-
- public static String FileExtension_extensionEmptyMessage;
- public static String FileExtension_fileNameInvalidMessage;
-
- public static String RSEQuery_task;
-
- public static String Error;
- public static String Question;
- public static String Warning;
- public static String Information;
-
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, GenericMessages.class);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.properties
deleted file mode 100644
index 905cc019d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/GenericMessages.properties
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Initial Contributors:
-# The following IBM employees contributed to the Remote System Explorer
-# component that contains this file: David McKnight, Kushal Munir,
-# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
-# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
-#
-# Contributors:
-# David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
-# David McKnight (IBM) - [220309] [nls] Some GenericMessages and SubSystemResources should move from UI to Core
-# David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
-###############################################################################
-
-# NLS_MESSAGEFORMAT_VAR
-# NLS_ENCODING=UTF-8
-
-ResourceNavigator_goto = Goto
-
-# ==============================================================================
-# Editors
-# ==============================================================================
-
-TypesFiltering_title = Select Types
-TypesFiltering_message = Reduce selection to only files of &type(s):
-TypesFiltering_otherExtensions = &Other Extensions:
-TypesFiltering_typeDelimiter = ,
-
-FileExtension_extensionEmptyMessage = The file extension cannot be empty
-FileExtension_fileNameInvalidMessage = The file name cannot include the wild card character (*) in the current location
-
-TransferOperation_message = Transfer Operation
-
-RSEQuery_task = RSE Query
-
-Error=Error
-Question=Question
-Warning=Warning
-Information=Information
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java
deleted file mode 100644
index 5aa5c8148..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2007 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Dykstal (IBM) - initial API and implementation
- ********************************************************************************/
-package org.eclipse.rse.internal.ui;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-/**
- * The PreferencesMapper provides an implementation of IPreferenceStore over a "lower level"
- * Preferences store. This is a relatively straightforward delegation.
- *
- * This class is internal and may not be used or subclassed by users of RSE. This should be used
- * only within RSE as a means of exploiting field editors on preferences that are stored
- * in {@link Preferences}.
- *
- * @see Preferences
- * @see IPreferenceStore
- */
-public class PreferencesMapper implements IPreferenceStore {
-
- private Preferences preferences = null;
- private boolean listening = true;
- private Map listeners = new HashMap();
-
- private class MyPropertyChangeListener implements org.eclipse.core.runtime.Preferences.IPropertyChangeListener {
-
- private IPropertyChangeListener containedListener = null;
-
- public MyPropertyChangeListener(IPropertyChangeListener containedListener) {
- this.containedListener = containedListener;
- }
-
- public void propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
- if (listening) {
- String property = event.getProperty();
- Object oldValue = event.getOldValue();
- Object newValue = event.getNewValue();
- PropertyChangeEvent newEvent = new PropertyChangeEvent(this, property, oldValue, newValue);
- containedListener.propertyChange(newEvent);
- }
- }
-
- }
-
- public PreferencesMapper(Preferences preferences) {
- this.preferences = preferences;
- }
-
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- if (!listeners.containsKey(listener)) {
- MyPropertyChangeListener l = new MyPropertyChangeListener(listener);
- listeners.put(listener, l);
- preferences.addPropertyChangeListener(l);
- }
- }
-
- public boolean contains(String name) {
- return preferences.contains(name);
- }
-
- public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- for (Iterator z = listeners.keySet().iterator(); z.hasNext();) {
- IPropertyChangeListener listener = (IPropertyChangeListener) z.next();
- PropertyChangeEvent e = new PropertyChangeEvent(this, name, oldValue, newValue);
- listener.propertyChange(e);
- }
- }
-
- public boolean getBoolean(String name) {
- return preferences.getBoolean(name);
- }
-
- public boolean getDefaultBoolean(String name) {
- return preferences.getDefaultBoolean(name);
- }
-
- public double getDefaultDouble(String name) {
- return preferences.getDefaultDouble(name);
- }
-
- public float getDefaultFloat(String name) {
- return preferences.getDefaultFloat(name);
- }
-
- public int getDefaultInt(String name) {
- return preferences.getDefaultInt(name);
- }
-
- public long getDefaultLong(String name) {
- return preferences.getDefaultLong(name);
- }
-
- public String getDefaultString(String name) {
- return preferences.getDefaultString(name);
- }
-
- public double getDouble(String name) {
- return preferences.getDouble(name);
- }
-
- public float getFloat(String name) {
- return preferences.getFloat(name);
- }
-
- public int getInt(String name) {
- return preferences.getInt(name);
- }
-
- public long getLong(String name) {
- return preferences.getLong(name);
- }
-
- public String getString(String name) {
- return null;
- }
-
- public boolean isDefault(String name) {
- return preferences.isDefault(name);
- }
-
- public boolean needsSaving() {
- return preferences.needsSaving();
- }
-
- public void putValue(String name, String value) {
- listening = false;
- preferences.setValue(name, value);
- listening = true;
- }
-
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- Object candidate = listeners.get(listener);
- if (candidate instanceof MyPropertyChangeListener) {
- MyPropertyChangeListener l = (MyPropertyChangeListener) candidate;
- preferences.removePropertyChangeListener(l);
- }
- listeners.remove(listener);
- }
-
- public void setDefault(String name, double value) {
- preferences.setDefault(name, value);
- }
-
- public void setDefault(String name, float value) {
- preferences.setDefault(name, value);
- }
-
- public void setDefault(String name, int value) {
- preferences.setDefault(name, value);
- }
-
- public void setDefault(String name, long value) {
- preferences.setDefault(name, value);
- }
-
- public void setDefault(String name, String defaultObject) {
- preferences.setDefault(name, defaultObject);
- }
-
- public void setDefault(String name, boolean value) {
- preferences.setDefault(name, value);
- }
-
- public void setToDefault(String name) {
- preferences.setToDefault(name);
- }
-
- public void setValue(String name, double value) {
- preferences.setValue(name, value);
- }
-
- public void setValue(String name, float value) {
- preferences.setValue(name, value);
- }
-
- public void setValue(String name, int value) {
- preferences.setValue(name, value);
- }
-
- public void setValue(String name, long value) {
- preferences.setValue(name, value);
- }
-
- public void setValue(String name, String value) {
- preferences.setValue(name, value);
- }
-
- public void setValue(String name, boolean value) {
- preferences.setValue(name, value);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEImageMap.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEImageMap.java
deleted file mode 100644
index fbf6d7f3f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEImageMap.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [236505] Remote systems dialog not working
- ********************************************************************************/
-package org.eclipse.rse.internal.ui;
-
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-
-public class RSEImageMap {
-
- private static Map _imageTable = new Hashtable(100);
-
- public static Image get(Object key) {
- if (_imageTable != null){
- return (Image)_imageTable.get(key);
- }
- return null;
- }
-
- public static void put(Object key, Image image) {
- if (_imageTable == null){
- _imageTable = new Hashtable(100);
- }
-
- _imageTable.put(key, image);
- }
-
- public static final void shutdown() {
- if (_imageTable != null) {
- for (Iterator i = _imageTable.values().iterator(); i.hasNext();) {
- ((Image) i.next()).dispose();
- }
- _imageTable = null;
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSESystemTypeAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSESystemTypeAdapterFactory.java
deleted file mode 100644
index 8fe72b89e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSESystemTypeAdapterFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- ********************************************************************************/
-package org.eclipse.rse.internal.ui;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-
-public class RSESystemTypeAdapterFactory implements IAdapterFactory {
-
- private RSESystemTypeAdapter adapter = new RSESystemTypeAdapter();
-
- public Class[] getAdapterList()
- {
- return new Class[] {RSESystemTypeAdapter.class};
- }
-
- /**
- * Called by our plugin's startup method to register our adaptable object types
- * with the platform. We prefer to do it here to isolate/encapsulate all factory
- * logic in this one place.
- */
- public void registerWithManager(IAdapterManager manager)
- {
- manager.registerAdapters(this, IRSESystemType.class);
- }
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof IRSESystemType) {
- return adapter;
- }
- else {
- return null;
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEUIInitJob.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEUIInitJob.java
deleted file mode 100644
index a3d4e1d62..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/RSEUIInitJob.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Dykstal (IBM) - [197167] initial contribution.
- *********************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemResourceManager;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-public class RSEUIInitJob extends Job {
-
- public RSEUIInitJob() {
- super("RSE_UI_INIT"); //$NON-NLS-1$
- }
-
- public IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- RSECorePlugin.waitForInitCompletion();
- } catch (InterruptedException e) {
- String message = "UI Initialization interrupted"; //$NON-NLS-1$
- status = new Status(IStatus.INFO, RSEUIPlugin.PLUGIN_ID, message);
- SystemBasePlugin.logInfo(message);
- }
- // listen for project change events if a project is being used
- IProject remoteSystemsProject = SystemResourceManager.getRemoteSystemsProject(false);
- if (remoteSystemsProject.exists()) {
- SystemResourceListener listener = SystemResourceListener.getListener(remoteSystemsProject);
- SystemResourceManager.startResourceEventListening(listener);
- }
- return status;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemProfileForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemProfileForm.java
deleted file mode 100644
index d968b8368..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemProfileForm.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFactory;
-import org.eclipse.rse.ui.validators.ValidatorProfileName;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * A reusable form for prompting for profile information,
- * in new or update mode.
- * <p>
- * May be used to populate a dialog or a wizard page.
- */
-
-public class SystemProfileForm
- implements Listener
-{
-
- // GUI widgets
- protected Label profileLabel;
- protected Control verbiage;
- //protected Combo profileCombo;
- protected Text profileName;
- protected ISystemMessageLine msgLine;
- // validators
- protected ISystemValidator nameValidator;
- protected Object caller;
- protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
-
- // max lengths
- protected static final int profileNameLength = ValidatorProfileName.MAX_PROFILENAME_LENGTH;
- // state
- protected ISystemProfile profile;
- private boolean showVerbiage = true;
- private SystemMessage errorMessage = null;
-
- /**
- * Constructor.
- * @param msgLine A GUI widget capable of writing error messages to.
- * @param caller The wizardpage or dialog hosting this form.
- * @param profile The existing profile being updated, or null for New action.
- * @param showVerbiage Specify true to show first-time-user verbiage.
- */
- public SystemProfileForm(ISystemMessageLine msgLine, Object caller, ISystemProfile profile, boolean showVerbiage)
- {
- this.msgLine = msgLine;
- this.caller = caller;
- this.profile = profile;
- this.showVerbiage = showVerbiage;
- callerInstanceOfWizardPage = (caller instanceof WizardPage);
- callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
- nameValidator = ValidatorFactory.getProfileNameValidator(profile.getName());
- }
-
- /**
- * Often the message line is null at the time of instantiation, so we have to call this after
- * it is created.
- */
- public void setMessageLine(ISystemMessageLine msgLine)
- {
- this.msgLine = msgLine;
- }
-
- /**
- * Call this to specify a validator for the profile name. It will be called per keystroke.
- * If not specified, a default is used.
- */
- public void setNameValidators(ISystemValidator v)
- {
- nameValidator = v;
- }
- /**
- * Call to initialize the profile name in create mode. Must be called after createContents
- */
- public void setProfileName(String name)
- {
- if ((name != null) && (profileName != null))
- profileName.setText(name);
- }
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- * @param parent The parent composite
- */
- public Control createContents(Composite parent)
- {
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // VERBIAGE LABEL
- if (showVerbiage)
- {
- verbiage = SystemWidgetHelpers.createVerbiage(
- composite_prompts, SystemResources.RESID_PROFILE_PROFILENAME_VERBIAGE, nbrColumns, false, 200);
- SystemWidgetHelpers.createLabel(composite_prompts, "", nbrColumns); // dummy line for spacing //$NON-NLS-1$
- }
-
- // NAME PROMPT
- String temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_PROFILE_PROFILENAME_LABEL);
- profileLabel = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- profileName = SystemWidgetHelpers.createTextField(
- composite_prompts,this,
- SystemResources.RESID_PROFILE_PROFILENAME_TIP);
- profileName.setTextLimit(profileNameLength);
-
- if (profile != null)
- profileName.setText(profile.getName());
-
- profileName.setFocus();
-
-
- // add keystroke listeners...
- profileName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateNameInput();
- }
- }
- );
- return composite_prompts;
- }
-
- /**
- * Return control to recieve initial focus
- */
- public Control getInitialFocusControl()
- {
- return profileName;
- }
-
- /**
- * Default implementation to satisfy Listener interface. Does nothing.
- */
- public void handleEvent(Event evt) {}
-
- /**
- * Verifies all input.
- * @return true if there are no errors in the user input
- */
- public boolean verify()
- {
- SystemMessage errMsg = null;
- Control controlInError = null;
- if (msgLine != null)
- {
- msgLine.clearErrorMessage();
- }
- errMsg = validateNameInput();
- if (errMsg != null)
- {
- controlInError = profileName;
- controlInError.setFocus();
- showErrorMessage(errMsg);
- }
- return (errMsg == null);
- }
-
- // --------------------------------- //
- // METHODS FOR EXTRACTING USER DATA ...
- // --------------------------------- //
- /**
- * Return user-entered profile Name.
- * Call this after finish ends successfully.
- */
- public String getProfileName()
- {
- return profileName.getText().trim();
- }
- /**
- * Display error message or clear error message
- */
- private void showErrorMessage(SystemMessage msg)
- {
- if (msgLine != null)
- if (msg != null)
- msgLine.setErrorMessage(msg);
- else
- msgLine.clearErrorMessage();
- else
- System.out.println("MSGLINE NULL. TRYING TO WRITE MSG " + msg); //$NON-NLS-1$
- }
-
- // ---------------------------------------------
- // METHODS FOR VERIFYING INPUT PER KEYSTROKE ...
- // ---------------------------------------------
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setNameValidators(ISystemValidator)
- */
- protected SystemMessage validateNameInput()
- {
- errorMessage= null;
- errorMessage= nameValidator.validate(profileName.getText().trim());
- showErrorMessage(errorMessage);
- setPageComplete();
- return errorMessage;
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = false;
- if (errorMessage == null)
- pageComplete = (getProfileName().length() > 0);
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- boolean complete = isPageComplete();
- if (callerInstanceOfWizardPage)
- {
- ((WizardPage)caller).setPageComplete(complete);
- }
- else if (callerInstanceOfSystemPromptDialog)
- {
- ((SystemPromptDialog)caller).setPageComplete(complete);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.java
deleted file mode 100644
index 7f24142dd..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class SystemPropertyResources extends NLS
-{
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.ui.SystemPropertyResources";//$NON-NLS-1$
-
-// ------------------------------
- // PROPERTY SHEET VALUES
- // ------------------------------
- // PROPERTY SHEET VALUES: GENERIC
-
- public static String RESID_PROPERTY_NAME_LABEL;
- public static String RESID_PROPERTY_NAME_TOOLTIP;
-
- public static String RESID_PROPERTY_TYPE_LABEL;
- public static String RESID_PROPERTY_TYPE_TOOLTIP;
-
- public static String RESID_PROPERTY_FILTERTYPE_VALUE;
-
- public static String RESID_TERM_NOTAPPLICABLE;
- public static String RESID_TERM_NOTAVAILABLE;
-
- public static String RESID_PORT_DYNAMICSELECT;
- public static String RESID_PROPERTY_INHERITED;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, SystemPropertyResources.class);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.properties
deleted file mode 100644
index 71fc1b2bf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemPropertyResources.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Initial Contributors:
-# The following IBM employees contributed to the Remote System Explorer
-# component that contains this file: David McKnight, Kushal Munir,
-# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
-# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
-#
-# Contributors:
-# Martin Oberhuber (Wind River) - [195399] Improve String display for default port 0
-# David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
-###############################################################################
-
-##############################################################
-# PROPERTY VALUES...
-##############################################################
-
-# NLS_MESSAGEFORMAT_VAR
-# NLS_ENCODING=UTF-8
-
-RESID_PROPERTY_NAME_LABEL=Name
-RESID_PROPERTY_NAME_TOOLTIP=Name of resources
-RESID_PROPERTY_TYPE_LABEL=Type
-RESID_PROPERTY_TYPE_TOOLTIP=Type of resource
-
-RESID_TERM_NOTAPPLICABLE=Not applicable
-RESID_TERM_NOTAVAILABLE=Not available
-RESID_PORT_DYNAMICSELECT={0} (Default or first available)
-RESID_PROPERTY_INHERITED=(Inherited)
-
-RESID_PROPERTY_FILTERTYPE_VALUE=Remote system filter
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResourceListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResourceListener.java
deleted file mode 100644
index 7f8c69717..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResourceListener.java
+++ /dev/null
@@ -1,819 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David Dykstal (IBM) - [191130] log exception instead of printing, do not log if project is not available
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.rse.core.ISystemResourceListener;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemResourceManager;
-import org.eclipse.rse.core.events.ISystemModelChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.core.RemoteSystemsProject;
-import org.eclipse.rse.internal.core.model.SystemModelChangeEvent;
-import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers;
-import org.eclipse.rse.internal.ui.view.SystemPerspectiveLayout;
-import org.eclipse.rse.internal.ui.view.SystemView;
-import org.eclipse.rse.internal.ui.view.SystemViewPart;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPart;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * This class manages listening for resource changes within our project.
- * Normally, we do not care about such changes. However, after a team synchronize,
- * we do.
- */
-public class SystemResourceListener implements ISystemResourceListener, Runnable
-{
- private boolean debug = true;
- private boolean fullDebug = debug && true;
- private static SystemResourceListener inst = null;
- private IProject remoteSystemsProject = null;
- private boolean ignoreEvents = true;
- private boolean ensureEventsOnMode = false;
- private boolean sawSyncEvent = false;
- private boolean changesPending = false;
- private int addRmvListenerCount;
- private Vector listeners;
- private IWorkbenchPage primaryRSEPerspective = null;
- private IViewPart[] primaryRSEViews = null;
-
- private int runAction = 0;
- private static final int CLOSE_PERSPECTIVES = 1;
- private static final int CLOSE_EDITORS = 2;
- private static final int CLOSE_VIEWS = 3;
- private static final int RSE_RESTART = 4;
- private static final int OPEN_VIEWS = 5;
- private static final int FIRE_EVENT = 99;
-
- SystemResourceListener(IProject remoteSystemsProject)
- {
- this.remoteSystemsProject = remoteSystemsProject;
- }
-
- /**
- * Return singleton
- */
- public static SystemResourceListener getListener(IProject remoteSystemsProject)
- {
- if (inst == null)
- inst = new SystemResourceListener(remoteSystemsProject);
- return inst;
- }
-
- /**
- * Register a listener for resource change events on objects in our remote system project.
- * No attempt is made to filter the events, they are simply passed on and the listener can
- * decide if the event applies to them or not.
- * <p>
- * However, the event will only be fired if a change is made to that resource outside of the
- * normal activities of the Remote Systems Framework, and only for resources within the
- * Remote Systems Connection project.
- */
- public void addResourceChangeListener(IResourceChangeListener l)
- {
- if (listeners == null)
- {
- listeners = new Vector();
- listeners.add(l);
- }
- else if (!listeners.contains(l))
- listeners.add(l);
- }
- /**
- * Remove a listener for resource change events on object in our remote system project.
- */
- public void removeResourceChangeListener(IResourceChangeListener l)
- {
- if ((listeners!=null) && listeners.contains(l))
- listeners.remove(l);
- }
-
- /**
- * Turn off event listening. Please call this before do anything that modifies resources and
- * turn it on again after.
- */
- public void turnOffResourceEventListening()
- {
- // Always turn off, even though may already be off, if nested block
-
- ignoreEvents = true;
-
- //remoteSystemsProject.getWorkspace().removeResourceChangeListener(listener);
-
- --addRmvListenerCount;
-
- // May have nested blocks of turnOff/ turnOn calls,
- // so don't want to issue this warning.
-
- //if (addRmvListenerCount != 0)
-
- // Safeguard: Dont expect many levels of nesting. Diagnose.
-
- // 1 nested level for now??
-
- if (addRmvListenerCount < -1)
- SystemBasePlugin.logWarning("LISTENER TURNED OFF OUT-OF-SEQUENCE ERROR: " + addRmvListenerCount); //$NON-NLS-1$
- }
-
- /**
- * Turn off event listening. Please call this after modifying resources.
- */
- public void turnOnResourceEventListening()
- {
-
- // May have nested blocks of turnOff/ turnOn calls.
- // Normally, expect (addRmvListenerCount) to equal 1 before it is turned Off,
- // then equal 0 when off. But may go below zero if nested off/on's occur.
-
- ++addRmvListenerCount;
-
- if (addRmvListenerCount > 0)
- {
-
- ignoreEvents = false;
- sawSyncEvent = false;
- //remoteSystemsProject.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.POST_AUTO_BUILD);
-
- if (addRmvListenerCount != 1)
- SystemBasePlugin.logWarning("LISTENER TURNED ON OUT-OF-SEQUENCE ERROR: " + addRmvListenerCount); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Ensure event listening is on. Called at start of team synch action to be safe.
- */
- public void ensureOnResourceEventListening()
- {
- SystemBasePlugin.logInfo("INSIDE ENSUREONRESOURCEEVENTLISTENING"); //$NON-NLS-1$
- if (ignoreEvents)
- {
- SystemBasePlugin.logWarning("RESOURCE LISTENER WAS TURNED OFF. IT WAS FORCED ON"); //$NON-NLS-1$
- turnOnResourceEventListening();
- }
- ensureEventsOnMode = true; // we can add debug statements conditioned by this so we don't stop until team synch action is run
- }
-
- /**
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event)
- {
- Object source = event.getSource();
- if (ignoreEvents || !(event.getSource() instanceof IWorkspace))
- {
- return;
- }
-
- if (fullDebug)
- {
- int type = event.getType();
- String sType = getTypeString(type);
- SystemBasePlugin.logInfo("RESOURCE CHANGED EVENT: eventType=" + sType + ", eventSource=" + event.getSource()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (ensureEventsOnMode)
- {
- ensureEventsOnMode = true; // set breakpoint here
- }
-
- IResource resource = event.getResource();
- IResourceDelta delta = event.getDelta();
- if ((resource == null) && (delta != null))
- resource = delta.getResource();
-
- // ATTEMPT TO FILTER OUT UNWANTED EVENTS...
- if (resource != null)
- {
- if (resource.getProject() != null)
- {
- if (!resource.getProject().getName().equals(remoteSystemsProject.getName()))
- {
- if (fullDebug)
- SystemBasePlugin.logInfo("EVENT FILTERED OUT BY PROJECT NAME"); //$NON-NLS-1$
- return;
- }
- }
- else if (resource.getType() == IResource.PROJECT)
- {
- if (!resource.getName().equals(remoteSystemsProject.getName()))
- {
- if (fullDebug)
- SystemBasePlugin.logInfo("EVENT FILTERED OUT BY PROJECT NAME"); //$NON-NLS-1$
- return;
- }
- try
- {
- if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID)))
- {
- if (fullDebug)
- SystemBasePlugin.logInfo("EVENT FILTERED OUT BY PROJECT NATURE"); //$NON-NLS-1$
- return;
- }
- }
- catch (Exception exc)
- {
- }
- }
- //else
- // RSEUIPlugin.logWarning("IN RESOURCeListener, RESOURCE AND PROJECT ARE NULL, UNABLE TO FILTER THE EVENT");
- }
- else
- {
- //if (resource == null)
- // RSEUIPlugin.logWarning("IN RESOURCeListener, RESOURCE IS NULL, UNABLE TO FILTER THE EVENT");
- }
-
- if (delta != null)
- {
- if (preScanForIgnore(delta))
- {
- if (fullDebug)
- SystemBasePlugin.logInfo("EVENT FILTERED OUT IN PRESCAN"); //$NON-NLS-1$
- return;
- }
- }
-
- if (fullDebug)
- {
- SystemBasePlugin.logInfo("*** RESOURCE CHANGE EVENT ALLOWED IN ***"); //$NON-NLS-1$
- //(new Exception("Stack Trace")).fillInStackTrace().printStackTrace();
- }
-
- /*
- Exception exc = new Exception("Stack Trace");
- exc.fillInStackTrace();
- exc.printStackTrace();
- */
-
- if (debug)
- {
- int type = event.getType();
- String sType = getTypeString(type);
- if (!fullDebug)
- SystemBasePlugin.logInfo("RESOURCE CHANGED EVENT: eventType=" + sType + ", eventSource=" + source); //$NON-NLS-1$ //$NON-NLS-2$
- //RSEUIPlugin.logInfo("RESOURCE DELTA:"); //$NON-NLS-1$
- }
- boolean ignored = false;
- if (delta != null)
- {
- //previousResource = null;
- //ignored = !processDelta("", delta); //$NON-NLS-1$
-
- // OK, LET'S DO IT!
- if (sawSyncEvent)
- {
- sawSyncEvent = false;
- // code to reload moved to reloadRSE() method. Must be called explicitly now!
- }
- changesPending = true;
- }
- if (!ignored)
- {
- fireResourceChangeEvent(event);
- }
- }
-
- /**
- * Fire resource change events to interested listeners.
- * This is simply a propogation of the eclipse resource event, once we know it applies to us.
- */
- protected void fireResourceChangeEvent(IResourceChangeEvent event)
- {
- if (listeners == null)
- return;
- // inform all listeners...
- for (int idx = 0; idx < listeners.size(); idx++)
- {
- IResourceChangeListener l = (IResourceChangeListener) listeners.elementAt(idx);
- l.resourceChanged(event);
- }
- }
-
- /**
- * Prescan for unrelated events.
- * @return true if event filtered out
- */
- protected boolean preScanForIgnore(IResourceDelta delta)
- {
- if (delta == null)
- return true; // not sure when we'd get this
- IResourceDelta[] subdeltas = delta.getAffectedChildren();
- if (subdeltas.length > 0)
- {
- IResource resource = subdeltas[0].getResource();
- int resType = 0;
- if (resource != null)
- resType = resource.getType();
- int flags = subdeltas[0].getFlags();
- if (debug)
- {
- if (debug)
- SystemBasePlugin.logInfo("...In preScanForIgnore. Kind = "+getKindString(delta.getKind())); //$NON-NLS-1$
- if (resource == null)
- SystemBasePlugin.logInfo("......resource is null"); //$NON-NLS-1$
- else
- SystemBasePlugin.logInfo("......resource is: "+resource.getName() + ", type is: " + getResourceTypeString(resType)); //$NON-NLS-1$ //$NON-NLS-2$
- if (flags == IResourceDelta.SYNC)
- SystemBasePlugin.logInfo("......flags == SYNC"); //$NON-NLS-1$
- else
- SystemBasePlugin.logInfo("......flags == "+flags); //$NON-NLS-1$
- }
-
- if (flags == IResourceDelta.SYNC) // apparently we no longer get this in 2.0!
- {
- sawSyncEvent = true;
- return true;
- }
- if ((resource !=null) && (resType == IResource.ROOT))
- return true; // someone created a new project?
- if ((resource != null) && (resType == IResource.PROJECT))
- {
- if (!resource.getName().equals(remoteSystemsProject.getName()))
- return true;
- // [191130] the event can be ignored if the project cannot be accessed
- if (!resource.isAccessible()) return true;
- try
- {
- if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID)))
- return true;
- }
- catch (CoreException exc)
- {
- RSECorePlugin.getDefault().getLogger().logError("Exception trying to test the natures of the project that fired a resource change event", exc); //$NON-NLS-1$
- }
- }
- }
- return false;
- }
-
- private String getResourceTypeString(int type)
- {
- switch (type)
- {
- case IResource.ROOT : return "root"; //$NON-NLS-1$
- case IResource.PROJECT : return "project"; //$NON-NLS-1$
- case IResource.FOLDER : return "folder"; //$NON-NLS-1$
- case IResource.FILE : return "file"; //$NON-NLS-1$
- }
- return "unknown: "+Integer.toString(type); //$NON-NLS-1$
- }
-
- /**
- * Process all deltas.
- * Currently not used.
- * WILL FLESH OUT IN A FUTURE RELEASE AND TRY TO AVOID THE ATOM BOMB APPROACH WE TAKE NOW
- */
- protected boolean processDelta(String indent, IResourceDelta delta)
- {
- int kind = delta.getKind();
- int flags = delta.getFlags();
- if ((kind == IResourceDelta.CHANGED) && (flags == IResourceDelta.SYNC))
- return false;
- boolean processKids = true;
- IResource resource = delta.getResource();
- String kindString = null;
- String pre = null;
- if (debug)
- {
- kindString = getKindString(kind);
- pre = kindString + ": " + indent; //$NON-NLS-1$
- SystemBasePlugin.logInfo(pre + delta + ": flags: " + getKindString(flags)); //$NON-NLS-1$
- }
- if (resource == null)
- return true;
- int resourceType = resource.getType();
- switch (kind)
- {
- case IResourceDelta.ADDED :
- break;
- case IResourceDelta.CHANGED :
- if (debug)
- SystemBasePlugin.logInfo(pre + "resource type: " + resourceType); //$NON-NLS-1$
- if (resourceType == IResource.PROJECT)
- {
- try
- {
- if (!(((IProject) resource).hasNature(RemoteSystemsProject.ID)))
- {
- if (debug)
- SystemBasePlugin.logInfo("EVENT DELTA FILTERED OUT BY PROJECT NATURE"); //$NON-NLS-1$
- return false;
- }
- }
- catch (Exception exc)
- {
- }
- }
- break;
- case IResourceDelta.CONTENT :
- case IResourceDelta.REPLACED :
- break;
- case IResourceDelta.REMOVED :
- break;
- default :
- if (debug)
- SystemBasePlugin.logInfo(kindString + " DELTA IGNORED"); //$NON-NLS-1$
- }
- boolean stop = false;
- if (processKids)
- {
- IResourceDelta[] subdeltas = delta.getAffectedChildren();
- for (int i = 0; !stop && (i < subdeltas.length); i++)
- stop = !processDelta(indent + " ", subdeltas[i]); //$NON-NLS-1$
- }
- return !stop;
- }
-
- public static String getKindString(int kind)
- {
- String kindString = "Unknown: " + Integer.toString(kind); //$NON-NLS-1$
- switch (kind)
- {
- case IResourceDelta.ADDED :
- kindString = "ADDED"; //$NON-NLS-1$
- break;
- case IResourceDelta.ADDED_PHANTOM :
- kindString = "ADDED_PHANTOM"; //$NON-NLS-1$
- break;
- case IResourceDelta.ALL_WITH_PHANTOMS :
- kindString = "ALL_WITH_PHANTOMS"; //$NON-NLS-1$
- break;
- case IResourceDelta.CHANGED :
- kindString = "CHANGED"; //$NON-NLS-1$
- break;
- case IResourceDelta.CONTENT :
- kindString = "CONTENT"; //$NON-NLS-1$
- break;
- case IResourceDelta.DESCRIPTION :
- kindString = "DESCRIPTION"; //$NON-NLS-1$
- break;
- case IResourceDelta.MARKERS :
- kindString = "ADDED"; //$NON-NLS-1$
- break;
- case IResourceDelta.MOVED_FROM :
- kindString = "MOVED_FROM"; //$NON-NLS-1$
- break;
- case IResourceDelta.MOVED_TO :
- kindString = "MOVED_TO"; //$NON-NLS-1$
- break;
- case IResourceDelta.NO_CHANGE :
- kindString = "NO_CHANGE"; //$NON-NLS-1$
- break;
- case IResourceDelta.OPEN :
- kindString = "OPEN"; //$NON-NLS-1$
- break;
- case IResourceDelta.REMOVED :
- kindString = "REMOVED"; //$NON-NLS-1$
- break;
- case IResourceDelta.REMOVED_PHANTOM :
- kindString = "REMOVED_PHANTOM"; //$NON-NLS-1$
- break;
- case IResourceDelta.REPLACED :
- kindString = "REPLACED"; //$NON-NLS-1$
- break;
- case IResourceDelta.SYNC :
- kindString = "SYNC"; //$NON-NLS-1$
- break;
- case IResourceDelta.TYPE :
- kindString = "TYPE"; //$NON-NLS-1$
- break;
- }
- return kindString;
- }
-
- public static String getTypeString(int type)
- {
- String typeString = "Unknown: " + Integer.toString(type); //$NON-NLS-1$
- switch (type)
- {
- case IResourceChangeEvent.POST_CHANGE :
- typeString = "POST_CHANGE"; //$NON-NLS-1$
- break;
- case IResourceChangeEvent.POST_BUILD:
- typeString = "POST_BUILD"; //$NON-NLS-1$
- break;
- case IResourceChangeEvent.PRE_DELETE :
- typeString = "PRE_DELETE"; //$NON-NLS-1$
- break;
- case IResourceChangeEvent.PRE_CLOSE :
- typeString = "PRE_CLOSE"; //$NON-NLS-1$
- break;
- case IResourceChangeEvent.PRE_BUILD :
- typeString = "PRE_BUILD"; //$NON-NLS-1$
- break;
- }
- return typeString;
- }
-
- /**
- * Close all non-primary system view perspectives
- */
- private void closeRSEPerspectives()
- {
- primaryRSEPerspective = null;
- primaryRSEViews = null;
- IWorkbenchPage[] rsePages = getRSEPerspectives();
- IWorkbench wb = PlatformUI.getWorkbench();
- if (wb == null)
- SystemBasePlugin.logInfo("PlatformUI.getWorkbench() returned null!!"); //$NON-NLS-1$
- else
- {
- IWorkbenchWindow wbw = wb.getActiveWorkbenchWindow();
- if (wbw == null)
- SystemBasePlugin.logInfo("Active workbench window is null"); //$NON-NLS-1$
- if ((primaryRSEPerspective != null) && (wbw != null) && (wbw.getActivePage() != primaryRSEPerspective))
- wbw.setActivePage(primaryRSEPerspective);
- }
- // close non-primary rse perspectives...
- if ((rsePages != null) && (rsePages.length > 0))
- {
- for (int idx = 0; idx < rsePages.length; idx++)
- {
- IWorkbenchPage rsePage = rsePages[idx];
- rsePage.close();
- }
- }
- // for primary rse perspective...
- if (primaryRSEPerspective != null)
- {
- Vector v = new Vector();
- IViewReference[] views = primaryRSEPerspective.getViewReferences();
- // scan for, and record, all non SystemView views
- if (views != null)
- {
- for (int idx = 0; idx < views.length; idx++)
- if (!(views[idx].getView(false) instanceof SystemViewPart) &&
- !(views[idx].getView(false) instanceof SystemTeamViewPart))
- v.addElement(views[idx].getView(false));
- }
- primaryRSEViews = new IViewPart[v.size()];
- for (int idx = 0; idx < v.size(); idx++)
- primaryRSEViews[idx] = (IViewPart) v.elementAt(idx);
- // ok, now we have those secondary views... what to do with them??
- }
- }
-
- /**
- * Return primary RSE View
- */
- private SystemView getRSEView()
- {
- return SystemPerspectiveHelpers.findRSEView();
- /*
- SystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IWorkbench wb = PlatformUI.getWorkbench();
- IWorkbenchWindow[] wbWindows = wb.getWorkbenchWindows();
- for (int idx = 0; idx < wbWindows.length; idx++)
- {
- IWorkbenchPage[] pages = wbWindows[idx].getPages();
- if (pages != null)
- for (int jdx = 0; jdx < pages.length; jdx++)
- if ((pages[jdx].getPerspective().getId().equals(SystemPerspectiveLayout.ID)))
- {
- SystemView sv = getSystemView(pages[jdx]);
- if ((sv != null) && (sv.getInput() == sr))
- return sv;
- }
- }
- return null;
- */
- }
-
- /**
- * Find all Remote System Explorer perspectives
- * @return an array of all non-primary RSE perspectives, plus primaryRSEPerpsective set for the primary one.
- */
- private IWorkbenchPage[] getRSEPerspectives()
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IWorkbench wb = PlatformUI.getWorkbench();
- IWorkbenchWindow[] wbWindows = wb.getWorkbenchWindows();
- Vector v = new Vector();
- for (int idx = 0; idx < wbWindows.length; idx++)
- {
- IWorkbenchPage[] pages = wbWindows[idx].getPages();
- if (pages != null)
- for (int jdx = 0; jdx < pages.length; jdx++)
- if ((pages[jdx].getPerspective().getId().equals(SystemPerspectiveLayout.ID)))
- {
- SystemView sv = getSystemView(pages[jdx]);
- if ((sv != null) && !(sv.getInput() == sr)) // not the primary perspective
- v.addElement(pages[jdx]);
- else if (sv != null)
- primaryRSEPerspective = pages[jdx];
- }
- }
- IWorkbenchPage[] ourPages = new IWorkbenchPage[v.size()];
- for (int idx = 0; idx < ourPages.length; idx++)
- ourPages[idx] = (IWorkbenchPage) v.elementAt(idx);
- return ourPages;
- }
-
- /**
- * Get RSE view for a given perspective page
- */
- private SystemView getSystemView(IWorkbenchPage page)
- {
- IViewReference[] views = page.getViewReferences();
- if (views != null)
- for (int idx = 0; idx < views.length; idx++)
- if (views[idx].getView(false) instanceof SystemViewPart)
- return ((SystemViewPart) views[idx].getView(false)).getSystemView();
- return null;
- }
-
- /**
- * IRunnable run method
- */
- public void run()
- {
- if (runAction == CLOSE_PERSPECTIVES)
- {
- closeRSEPerspectives();
- }
- else if (runAction == CLOSE_EDITORS)
- {
- closeEditors();
- }
- else if (runAction == CLOSE_VIEWS)
- {
- closeViews();
- }
- else if (runAction == RSE_RESTART)
- {
- RSEUIPlugin.getDefault().restart();
- }
- else if (runAction == OPEN_VIEWS)
- {
- openViews();
- }
- else if (runAction == FIRE_EVENT)
- {
- RSECorePlugin.getTheSystemRegistry().fireEvent(
- new SystemModelChangeEvent(ISystemModelChangeEvents.SYSTEM_RESOURCE_ALL_RELOADED, ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_ALL, "dummy")); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Close active editors in RSE views. You may prompt the user to save or discard pending changes, but
- * you cannot cancel the operation... the editor must be closed one way or the other.
- */
- protected void closeEditors()
- {
- // todo
- }
-
- /**
- * Close active view in RSE perspective. You may either close the view or set its input to null, whichever is
- * appropriate. This is called prior to refreshing from disk. If you close the view, sets its array entry to null.
- */
- protected void closeViews()
- {
- // close views in primary RSE perspective
- if (primaryRSEViews != null)
- {
- for (int idx = 0; idx < primaryRSEViews.length; idx++)
- {
- }
- }
- }
- /**
- * Open views in RSE perspective. You may either close the view or set its input to null, whichever is
- * appropriate. This is called prior to refreshing from disk.
- */
- protected void openViews()
- {
- // re-open views in primary RSE perspective
- if (primaryRSEViews != null)
- {
- for (int idx = 0; idx < primaryRSEViews.length; idx++)
- {
- if (primaryRSEViews[idx] != null)
- {
- }
- }
- }
-
- }
-
- /**
- * Return true if changes are pending and hence a reloadRSE is in order
- */
- public static boolean changesPending()
- {
- SystemResourceListener us = null;
- if (inst == null)
- us = getListener(SystemResourceManager.getRemoteSystemsProject(false));
- else
- us = inst;
-
- return us.changesPending;
- }
-
- /**
- * Re-load the whole RSE from the workspace. This is to be called after a team synchronization.
- */
- public static void reloadRSE()
- {
- SystemResourceListener us = null;
- if (inst == null)
- us = getListener(SystemResourceManager.getRemoteSystemsProject(false));
- else
- us = inst;
-
- Display d = Display.getCurrent();
- if (d == null)
- d = Display.getDefault();
- if (d == null)
- {
- SystemBasePlugin.logInfo("Hmm, can't get the display"); //$NON-NLS-1$
- SystemView sv = us.getRSEView();
- if (sv != null)
- d = sv.getShell().getDisplay();
- else
- SystemBasePlugin.logInfo("Hmm, really can't get the display"); //$NON-NLS-1$
- }
-
- // here is the idea:
- // 0. Close all open editors. Currently a no-op
- // 1. Close all non-primary RSE perspectives
- // -- For the primary (last one found with SystemRegistry as the input) RSE perspective, leave it open
- // 2. Close all non-primary views from the primary RSE perspective. Currently, a no-op
- // 3. Reload the model.
- // 4. Re-open non-primary views in primary RSE perspective. Currently a no-op
- // 5. Give model change listeners (eg, views) an opportunity to re-load themselves if they need to
-
- us.runAction = CLOSE_EDITORS;
- if (d != null)
- d.syncExec(us);
- else
- us.run();
-
- us.runAction = CLOSE_PERSPECTIVES;
- if (d != null)
- d.syncExec(us);
- else
- us.run();
-
- us.runAction = CLOSE_VIEWS;
- if (d != null)
- d.syncExec(us);
- else
- us.run();
-
- us.runAction = RSE_RESTART;
- if (d != null)
- d.syncExec(us);
- else
- us.run();
-
- us.runAction = OPEN_VIEWS;
- if (d != null)
- d.syncExec(us);
- else
- us.run();
-
- us.changesPending = false;
-
- us.runAction = FIRE_EVENT;
- if (d != null)
- d.syncExec(us);
- else
- us.run();
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.java
deleted file mode 100644
index 4019008f2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.java
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [181066] NLS missing messages with DAEMON and Shells
- * Martin Oberhuber (Wind River) - [185552] Remove remoteSystemsViewPreferencesActions extension point
- * David McKnight (IBM) - [210229] table refresh needs unique table-specific tooltip-text
- * David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- * Rupen Mardirossian (IBM) - [210682] Added BUTTON_OVERWRITE_ALL & and tooltip, also added some verbiage for new SystemCopyDialog.
- * Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
- * David Dykstal (IBM) - [210242] Credentials dialog should look different if password is not supported or optional
- * David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
- * David Dykstal (IBM) - [231943] Make "true" and "false" translatable on SystemTypeFieldEditor
- * David Dykstal (IBM) - [188150] adding "go up one level" tooltip
- * David Dykstal (IBM) - [233678] title string is constructed by concatenation, should be substituted
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-
-/**
- * Constants used throughout the System plugin.
- */
-public class SystemResources extends NLS
-{
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.ui.SystemResources";//$NON-NLS-1$
-
- // Buttons
- // *** NOT GOOD TO USE BUTTONS. BETTER TO USE ACTIONS WITH THEIR
- // .label,.tooltip and .description ASSOCIATIONS
- // THESE BUTTON LABELS ARE USED IN SYSTEMPROMPTDIALOG
- public static String BUTTON_BROWSE;
- public static String BUTTON_TEST;
- public static String BUTTON_CLOSE;
- public static String BUTTON_ADD;
- public static String BUTTON_CREATE_LABEL;
- public static String BUTTON_CREATE_TOOLTIP;
-
- public static String BUTTON_CANCEL_ALL;
- public static String BUTTON_CANCEL_ALL_TOOLTIP;
- public static String BUTTON_OVERWRITE_ALL;
- public static String BUTTON_OVERWRITE_ALL_TOOLTIP;
-
- // THESE TERMS ARE USED POTENTIALLY ANYWHERE
- public static String TERM_YES;
- public static String TERM_NO;
-
- public static String TERM_TRUE;
- public static String TERM_FALSE;
-
-
- public static String TERM_ALL;
-
- public static String RESID_MSGLINE_TIP;
-
- // ----------------------------------------
- // GENERIC/COMMON WIZARD AND DIALOG STRINGS
- // ----------------------------------------
- // GENERIC MULTI-SELECT RENAME DIALOG...
- public static String RESID_RENAME_TITLE;
- public static String RESID_RENAME_SINGLE_TITLE;
- public static String RESID_RENAME_VERBIAGE;
- public static String RESID_RENAME_COLHDG_OLDNAME;
- public static String RESID_RENAME_COLHDG_NEWNAME;
- public static String RESID_RENAME_COLHDG_TYPE;
-
- // SPECIALIZED PROMPTS FOR GENERIC RENAME DIALOG...
- public static String RESID_MULTI_RENAME_PROFILE_VERBIAGE;
-
- // GENERIC SINGLE-SELECT RENAME DIALOG...
-
- public static String RESID_SIMPLE_RENAME_PROMPT_LABEL;
-
-
- public static String RESID_SIMPLE_RENAME_RESOURCEPROMPT_LABEL;
- public static String RESID_SIMPLE_RENAME_RESOURCEPROMPT_TOOLTIP;
- public static String RESID_SIMPLE_RENAME_RADIO_OVERWRITE_LABEL;
- public static String RESID_SIMPLE_RENAME_RADIO_OVERWRITE_TOOLTIP;
- public static String RESID_SIMPLE_RENAME_RADIO_RENAME_LABEL;
- public static String RESID_SIMPLE_RENAME_RADIO_RENAME_TOOLTIP;
-
- // SPECIALIZED PROMPTS FOR GENERIC RENAME DIALOG...
- public static String RESID_SIMPLE_RENAME_PROFILE_PROMPT_LABEL;
-
- public static String RESID_SIMPLE_RENAME_PROFILE_PROMPT_TIP;
-
- // GENERIC DELETE DIALOG...
- public static String RESID_DELETE_TITLE;
-
- public static String RESID_DELETE_PROMPT;
-
- public static String RESID_DELETE_PROMPT_SINGLE;
-
-
- public static String RESID_DELETE_WARNING_LABEL;
- public static String RESID_DELETE_WARNING_TOOLTIP;
-
-
- public static String RESID_DELETE_COLHDG_OLDNAME;
-
- public static String RESID_DELETE_COLHDG_TYPE;
-
- public static String RESID_DELETE_BUTTON;
-
- // SPECIALIZED PROMPTS FOR GENERIC DELETE DIALOG...
- public static String RESID_DELETE_PROFILES_PROMPT;
-
- // GENERIC COPY DIALOG...
- public static String RESID_COPY_TITLE;
- public static String RESID_COPY_SINGLE_TITLE;
- public static String RESID_COPY_PROMPT;
- public static String RESID_COPY_TARGET_PROFILE_PROMPT;
- public static String RESID_COPY_TARGET_FILTERPOOL_PROMPT;
-
-
- // GENERIC MOVE DIALOG...
- public static String RESID_MOVE_TITLE;
- public static String RESID_MOVE_SINGLE_TITLE;
- public static String RESID_MOVE_PROMPT;
- public static String RESID_MOVE_TARGET_PROFILE_PROMPT;
- public static String RESID_MOVE_TARGET_FILTERPOOL_PROMPT;
-
- // GENERIC RESOURCE NAME COLLISION DIALOG...
- public static String RESID_COLLISION_RENAME_TITLE;
- public static String RESID_COLLISION_RENAME_VERBIAGE;
- public static String RESID_COLLISION_RENAME_LABEL;
- public static String RESID_COLLISION_COPY_VERBIAGE;
- public static String RESID_COLLISION_COPY_COLHDG_OLDNAME;
-
-
- // -------------------------
- // WIZARD AND DIALOG STRINGS
- // -------------------------
- // NEW PROFILE WIZARD...
- public static String RESID_NEWPROFILE_TITLE;
- public static String RESID_NEWPROFILE_PAGE1_TITLE;
- public static String RESID_NEWPROFILE_PAGE1_DESCRIPTION;
- public static String RESID_NEWPROFILE_NAME_LABEL;
- public static String RESID_NEWPROFILE_NAME_TOOLTIP;
- public static String RESID_NEWPROFILE_MAKEACTIVE_LABEL;
- public static String RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP;
- public static String RESID_NEWPROFILE_VERBIAGE;
-
- // RENAME DEFAULT PROFILE WIZARD PAGE...
- public static String RESID_PROFILE_PROFILENAME_LABEL;
- public static String RESID_PROFILE_PROFILENAME_TIP;
- public static String RESID_PROFILE_PROFILENAME_VERBIAGE;
-
-
- // COPY SYSTEM PROFILE DIALOG...
- public static String RESID_COPY_PROFILE_TITLE;
-
- public static String RESID_COPY_PROFILE_PROMPT_LABEL;
- public static String RESID_COPY_PROFILE_PROMPT_TOOLTIP;
-
- // NEW SYSTEM CONNECTION WIZARD...
- public static String RESID_NEWCONN_PROMPT_LABEL;
- public static String RESID_NEWCONN_PROMPT_VALUE;
- public static String RESID_NEWCONN_EXPANDABLEPROMPT_VALUE;
- public static String RESID_NEWCONN_TITLE;
- public static String RESID_NEWCONN_PAGE1_TITLE;
- public static String RESID_NEWCONN_PAGE1_REMOTE_TITLE;
- public static String RESID_NEWCONN_PAGE1_LOCAL_TITLE;
- public static String RESID_NEWCONN_PAGE1_DESCRIPTION;
- public static String RESID_NEWCONN_MAIN_PAGE_TITLE;
- public static String RESID_NEWCONN_MAIN_PAGE_DESCRIPTION;
- public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_DESCRIPTION;
- public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_TITLE;
- public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBIAGE1;
- public static String RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBIAGE2;
- public static String RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION;
-
-
- public static String RESID_CONNECTION_TYPE_LABEL;
- public static String RESID_CONNECTION_TYPE_VALUE;
- public static String RESID_CONNECTION_SYSTEMTYPE_LABEL;
- public static String RESID_CONNECTION_SYSTEMTYPE_TIP;
- public static String RESID_CONNECTION_SYSTEMTYPE_READONLY_TIP;
-
- public static String RESID_CONNECTION_CONNECTIONNAME_LABEL;
- public static String RESID_CONNECTION_CONNECTIONNAME_TIP;
-
- public static String RESID_CONNECTION_HOSTNAME_LABEL;
- public static String RESID_CONNECTION_HOSTNAME_TIP;
-
-
- public static String RESID_CONNECTION_VERIFYHOSTNAME_LABEL;
- public static String RESID_CONNECTION_VERIFYHOSTNAME_TOOLTIP;
-
- public static String RESID_CONNECTION_DEFAULTUSERID_LABEL;
- public static String RESID_CONNECTION_DEFAULTUSERID_TIP;
- public static String RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP;
-
- public static String RESID_CONNECTION_PORT_LABEL;
- public static String RESID_CONNECTION_PORT_TIP;
-
- public static String RESID_CONNECTION_DAEMON_PORT_LABEL;
- public static String RESID_CONNECTION_DAEMON_PORT_TIP;
-
-
- public static String RESID_CONNECTION_DESCRIPTION_LABEL;
- public static String RESID_CONNECTION_DESCRIPTION_TIP;
-
- public static String RESID_CONNECTION_PROFILE_LABEL;
- public static String RESID_CONNECTION_PROFILE_TIP;
-
- public static String RESID_CONNECTION_PROFILE_READONLY_TIP;
-
-
-
- // NEW FILTER POOL WIZARD...
- public static String RESID_NEWFILTERPOOL_TITLE;
-
- public static String RESID_NEWFILTERPOOL_PAGE1_TITLE;
-
- public static String RESID_NEWFILTERPOOL_PAGE1_DESCRIPTION;
-
- // WIDGETS FOR THIS WIZARD...
- public static String RESID_FILTERPOOLNAME_LABEL;
- public static String RESID_FILTERPOOLNAME_TIP;
-
- public static String RESID_FILTERPOOLMANAGERNAME_LABEL;
- public static String RESID_FILTERPOOLMANAGERNAME_TIP;
-
- // SELECT FILTER POOLS DIALOG...
- public static String RESID_SELECTFILTERPOOLS_TITLE;
-
- public static String RESID_SELECTFILTERPOOLS_PROMPT;
-
- // WORK WITH FILTER POOLS DIALOG...
- public static String RESID_WORKWITHFILTERPOOLS_TITLE;
-
- public static String RESID_WORKWITHFILTERPOOLS_PROMPT;
-
- // NEW SYSTEM FILTER WIZARD...
- public static String RESID_NEWFILTER_TITLE;
-
- public static String RESID_NEWFILTER_PAGE_TITLE;
-
- // MAIN PAGE (page 1) OF NEW FILTER WIZARD...
- public static String RESID_NEWFILTER_PAGE1_DESCRIPTION;
-
-
- // NAME PAGE (page 2) OF NEW FILTER WIZARD...
- public static String RESID_NEWFILTER_PAGE2_DESCRIPTION;
-
- public static String RESID_NEWFILTER_PAGE2_NAME_VERBIAGE;
-
- public static String RESID_NEWFILTER_PAGE2_POOL_VERBIAGE;
-
- public static String RESID_NEWFILTER_PAGE2_POOL_VERBIAGE_TIP;
-
- public static String RESID_NEWFILTER_PAGE2_PROFILE_VERBIAGE;
-
- public static String RESID_NEWFILTER_PAGE2_NAME_LABEL;
- public static String RESID_NEWFILTER_PAGE2_NAME_TOOLTIP;
-
- public static String RESID_NEWFILTER_PAGE2_PROFILE_LABEL;
- public static String RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP;
-
- public static String RESID_NEWFILTER_PAGE2_POOL_LABEL;
- public static String RESID_NEWFILTER_PAGE2_POOL_TOOLTIP;
-
- public static String RESID_NEWFILTER_PAGE2_UNIQUE_LABEL;
- public static String RESID_NEWFILTER_PAGE2_UNIQUE_TOOLTIP;
-
- // INFO PAGE (page 3) OF NEW FILTER WIZARD...
- public static String RESID_NEWFILTER_PAGE3_DESCRIPTION;
- public static String RESID_NEWFILTER_PAGE3_STRINGS_VERBIAGE;
- public static String RESID_NEWFILTER_PAGE3_POOLS_VERBIAGE;
-
-
- // CHANGE SYSTEM FILTER DIALOG...
- public static String RESID_CHGFILTER_TITLE;
- public static String RESID_CHGFILTER_LIST_NEWITEM;
- public static String RESID_CHGFILTER_NAME_LABEL;
- public static String RESID_CHGFILTER_NAME_TOOLTIP;
- public static String RESID_CHGFILTER_POOL_LABEL;
- public static String RESID_CHGFILTER_POOL_TOOLTIP;
- public static String RESID_CHGFILTER_LIST_LABEL;
- public static String RESID_CHGFILTER_LIST_TOOLTIP;
- public static String RESID_CHGFILTER_FILTERSTRING_LABEL;
- public static String RESID_CHGFILTER_FILTERSTRING_TOOLTIP;
- public static String RESID_CHGFILTER_NEWFILTERSTRING_LABEL;
- public static String RESID_CHGFILTER_NEWFILTERSTRING_TOOLTIP;
- public static String RESID_CHGFILTER_BUTTON_TEST_LABEL;
- public static String RESID_CHGFILTER_BUTTON_TEST_TOOLTIP;
- public static String RESID_CHGFILTER_BUTTON_APPLY_LABEL;
- public static String RESID_CHGFILTER_BUTTON_APPLY_TOOLTIP;
- public static String RESID_CHGFILTER_BUTTON_REVERT_LABEL;
- public static String RESID_CHGFILTER_BUTTON_REVERT_TOOLTIP;
-
- // CREATE UNNAMED FILTER DIALOG...
- public static String RESID_CRTFILTER_TITLE;
-
-
- // NEW SYSTEM FILTER STRING WIZARD...
-
- public static String RESID_FILTERSTRING_STRING_LABEL;
- public static String RESID_FILTERSTRING_STRING_TIP;
-
-
- // TEST SYSTEM FILTER STRING DIALOG...
- public static String RESID_TESTFILTERSTRING_TITLE;
-
- public static String RESID_TESTFILTERSTRING_PROMPT_LABEL;
- public static String RESID_TESTFILTERSTRING_PROMPT_TOOLTIP;
-
-
- // WORK WITH HISTORY DIALOG...
- public static String RESID_WORKWITHHISTORY_TITLE;
- public static String RESID_WORKWITHHISTORY_VERBIAGE;
- public static String RESID_WORKWITHHISTORY_PROMPT;
- public static String RESID_WORKWITHHISTORY_BUTTON_TIP;
-
- // PROMPT FOR PASSWORD DIALOG...
- public static String RESID_PASSWORD_TITLE;
-
- public static String RESID_PASSWORD_LABEL;
- public static String RESID_PASSWORD_LABEL_OPTIONAL;
- public static String RESID_PASSWORD_TIP;
-
- public static String RESID_PASSWORD_SYSTEMTYPE_LABEL;
- public static String RESID_PASSWORD_HOSTNAME_LABEL;
-
- public static String RESID_PASSWORD_USERID_LABEL;
- public static String RESID_PASSWORD_USERID_TIP;
-
- public static String RESID_PASSWORD_USERID_ISPERMANENT_LABEL;
- public static String RESID_PASSWORD_USERID_ISPERMANENT_TIP;
-
- public static String RESID_PASSWORD_SAVE_LABEL;
- public static String RESID_PASSWORD_SAVE_TOOLTIP;
-
- // CHANGE PASSWORD DIALOG
- public static String RESID_CHANGE_PASSWORD_TITLE;
- public static String RESID_CHANGE_PASSWORD_NEW_LABEL;
- public static String RESID_CHANGE_PASSWORD_NEW_TOOLTIP;
- public static String RESID_CHANGE_PASSWORD_OLD_LABEL;
- public static String RESID_CHANGE_PASSWORD_OLD_TOOLTIP;
- public static String RESID_CHANGE_PASSWORD_CONFIRM_LABEL;
- public static String RESID_CHANGE_PASSWORD_CONFIRM_TOOLTIP;
-
- // TABLE VIEW DIALOGS
- public static String RESID_TABLE_POSITIONTO_LABEL;
- public static String RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP;
-
- public static String RESID_TABLE_SUBSET_LABEL;
- public static String RESID_TABLE_SUBSET_ENTRY_TOOLTIP;
-
- public static String RESID_TABLE_PRINTLIST_TITLE;
-
- // TABLE view column selection
- public static String RESID_TABLE_SELECT_COLUMNS_LABEL;
- public static String RESID_TABLE_SELECT_COLUMNS_TOOLTIP;
-
- public static String RESID_TABLE_SELECT_COLUMNS_ADD_LABEL;
- public static String RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP;
-
- public static String RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL;
- public static String RESID_TABLE_SELECT_COLUMNS_REMOVE_TOOLTIP;
-
- public static String RESID_TABLE_SELECT_COLUMNS_UP_LABEL;
- public static String RESID_TABLE_SELECT_COLUMNS_UP_TOOLTIP;
-
- public static String RESID_TABLE_SELECT_COLUMNS_DOWN_LABEL;
- public static String RESID_TABLE_SELECT_COLUMNS_DOWN_TOOLTIP;
-
- public static String RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL;
-
- public static String RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL;
- public static String RESID_TABLE_SELECT_COLUMNS_DESCRIPTION_LABEL;
-
- // MONITOR VIEW DIALGOS
- public static String RESID_MONITOR_POLL_INTERVAL_LABEL;
- public static String RESID_MONITOR_POLL_INTERVAL_TOOLTIP;
- public static String RESID_MONITOR_POLL_LABEL;
- public static String RESID_MONITOR_POLL_TOOLTIP;
- public static String RESID_MONITOR_POLL_CONFIGURE_POLLING_LABEL;
- public static String RESID_MONITOR_POLL_CONFIGURE_POLLING_EXPAND_TOOLTIP;
- public static String RESID_MONITOR_POLL_CONFIGURE_POLLING_COLLAPSE_TOOLTIP;
-
- // TEAM VIEW
- public static String RESID_TEAMVIEW_SUBSYSFACTORY_VALUE;
- public static String RESID_TEAMVIEW_CATEGORY_VALUE;
- public static String RESID_TEAMVIEW_PROPERTYSET_VALUE;
-
- public static String RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL;
- public static String RESID_TEAMVIEW_CATEGORY_CONNECTIONS_TOOLTIP;
-
- public static String RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_LABEL;
- public static String RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP;
-
- public static String RESID_TEAMVIEW_CATEGORY_PROPERTYSET_LABEL;
- public static String RESID_TEAMVIEW_CATEGORY_PROPERTYSET_TOOLTIP;
-
- // ------------------------------
- // REUSABLE WIDGET STRINGS...
- // ------------------------------
- // SELECT MULTIPLE REMOTE FILES WIDGET...
- public static String RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_LABEL;
- public static String RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_TOOLTIP;
-
- public static String RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL;
- public static String RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_TOOLTIP;
-
- public static String RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_LABEL;
- public static String RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_TOOLTIP;
-
-
-
- public static String RESID_SYSTEMREGISTRY_CONNECTIONS;
-
- // SUBSYSTEM PROPERTIES PAGE...
- public static String RESID_SUBSYSTEM_TYPE_LABEL;
- public static String RESID_SUBSYSTEM_TYPE_VALUE;
- public static String RESID_SUBSYSTEM_VENDOR_LABEL;
- public static String RESID_SUBSYSTEM_NAME_LABEL;
- public static String RESID_SUBSYSTEM_CONNECTION_LABEL;
- public static String RESID_SUBSYSTEM_PROFILE_LABEL;
-
- public static String RESID_SUBSYSTEM_PORT_LABEL;
- public static String RESID_SUBSYSTEM_PORT_TIP;
- public static String RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP;
-
- public static String RESID_SUBSYSTEM_USERID_LABEL;
- public static String RESID_SUBSYSTEM_USERID_TIP;
-
- public static String RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP;
-
- public static String RESID_SUBSYSTEM_SSL_LABEL;
- public static String RESID_SUBSYSTEM_SSL_TIP;
-
- public static String RESID_SUBSYSTEM_AUTODETECT_LABEL;
- public static String RESID_SUBSYSTEM_AUTODETECT_TIP;
-
- public static String RESID_SUBSYSTEM_SSL_ALERT_LABEL;
- public static String RESID_SUBSYSTEM_SSL_ALERT_TIP;
-
- public static String RESID_SUBSYSTEM_NONSSL_ALERT_LABEL;
- public static String RESID_SUBSYSTEM_NONSSL_ALERT_TIP;
-
- public static String RESID_SUBSYSTEM_ENVVAR_DESCRIPTION;
- public static String RESID_SUBSYSTEM_ENVVAR_TOOLTIP;
-
- public static String RESID_SUBSYSTEM_ENVVAR_NAME_TITLE;
- public static String RESID_SUBSYSTEM_ENVVAR_NAME_LABEL;
- public static String RESID_SUBSYSTEM_ENVVAR_NAME_TOOLTIP;
-
- public static String RESID_SUBSYSTEM_ENVVAR_VALUE_TITLE;
- public static String RESID_SUBSYSTEM_ENVVAR_VALUE_LABEL;
- public static String RESID_SUBSYSTEM_ENVVAR_VALUE_TOOLTIP;
-
- public static String RESID_SUBSYSTEM_ENVVAR_ADD_TOOLTIP;
- public static String RESID_SUBSYSTEM_ENVVAR_REMOVE_TOOLTIP;
- public static String RESID_SUBSYSTEM_ENVVAR_CHANGE_TOOLTIP;
-
- public static String RESID_SUBSYSTEM_ENVVAR_MOVEUP_LABEL;
- public static String RESID_SUBSYSTEM_ENVVAR_MOVEUP_TOOLTIP;
- public static String RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_LABEL;
- public static String RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_TOOLTIP;
-
- public static String RESID_SUBSYSTEM_ENVVAR_ADD_TITLE;
- public static String RESID_SUBSYSTEM_ENVVAR_CHANGE_TITLE;
-
- // COMMON PROPERTIES PAGE UI...
- public static String RESID_PP_PROPERTIES_TYPE_LABEL;
- public static String RESID_PP_PROPERTIES_TYPE_TOOLTIP;
-
- // FILTER POOL PROPERTIES PAGE...
- public static String RESID_FILTERPOOL_TYPE_VALUE;
-
- public static String RESID_FILTERPOOL_NAME_LABEL;
- public static String RESID_FILTERPOOL_NAME_TOOLTIP;
-
- public static String RESID_FILTERPOOL_PROFILE_LABEL;
- public static String RESID_FILTERPOOL_PROFILE_TOOLTIP;
-
- public static String RESID_FILTERPOOL_REFERENCECOUNT_LABEL;
- public static String RESID_FILTERPOOL_REFERENCECOUNT_TOOLTIP;
-
- public static String RESID_FILTERPOOL_RELATEDCONNECTION_LABEL;
- public static String RESID_FILTERPOOL_RELATEDCONNECTION_TOOLTIP;
-
- // FILTER POOL REFERENCE PROPERTIES PAGE...
- public static String RESID_FILTERPOOLREF_TYPE_VALUE;
-
- public static String RESID_FILTERPOOLREF_NAME_LABEL;
- public static String RESID_FILTERPOOLREF_NAME_TOOLTIP;
-
- public static String RESID_FILTERPOOLREF_SUBSYSTEM_LABEL;
- public static String RESID_FILTERPOOLREF_SUBSYSTEM_TOOLTIP;
-
- public static String RESID_FILTERPOOLREF_CONNECTION_LABEL;
- public static String RESID_FILTERPOOLREF_CONNECTION_TOOLTIP;
-
- public static String RESID_FILTERPOOLREF_PROFILE_LABEL;
- public static String RESID_FILTERPOOLREF_PROFILE_TOOLTIP;
-
- // FILTER PROPERTIES PAGE...
- public static String RESID_PP_FILTER_TYPE_VALUE;
-
- public static String RESID_PP_FILTER_TYPE_PROMPTABLE_VALUE;
- public static String RESID_PP_FILTER_TYPE_PROMPTABLE_TOOLTIP;
-
-
- public static String RESID_PP_FILTER_NAME_LABEL;
- public static String RESID_PP_FILTER_NAME_TOOLTIP;
-
- public static String RESID_PP_FILTER_STRINGCOUNT_LABEL;
- public static String RESID_PP_FILTER_STRINGCOUNT_TOOLTIP;
-
- public static String RESID_PP_FILTER_FILTERPOOL_LABEL;
- public static String RESID_PP_FILTER_FILTERPOOL_TOOLTIP;
-
- public static String RESID_PP_FILTER_PROFILE_LABEL;
- public static String RESID_PP_FILTER_PROFILE_TOOLTIP;
-
- public static String RESID_PP_FILTER_ISCONNECTIONPRIVATE_LABEL;
- public static String RESID_PP_FILTER_ISCONNECTIONPRIVATE_TOOLTIP;
-
- // FILTER STRING PROPERTIES PAGE...
- public static String RESID_PP_FILTERSTRING_TYPE_VALUE;
-
-
- public static String RESID_PP_FILTERSTRING_FILTER_LABEL;
- public static String RESID_PP_FILTERSTRING_FILTER_TOOLTIP;
-
- public static String RESID_PP_FILTERSTRING_FILTERPOOL_LABEL;
- public static String RESID_PP_FILTERSTRING_FILTERPOOL_TOOLTIP;
-
-
- public static String RESID_PP_FILTERSTRING_PROFILE_LABEL;
- public static String RESID_PP_FILTERSTRING_PROFILE_TOOLTIP;
-
- // SUBSYSTEM FACTORY PROPERTIES PAGE...
- public static String RESID_PP_SUBSYSFACTORY_ID_LABEL;
- public static String RESID_PP_SUBSYSFACTORY_ID_TOOLTIP;
-
- public static String RESID_PP_SUBSYSFACTORY_VENDOR_LABEL;
- public static String RESID_PP_SUBSYSFACTORY_VENDOR_TOOLTIP;
-
- public static String RESID_PP_SUBSYSFACTORY_TYPES_LABEL;
- public static String RESID_PP_SUBSYSFACTORY_TYPES_TOOLTIP;
-
- public static String RESID_PP_SUBSYSFACTORY_VERBIAGE;
-
- // REMOTE SERVER LAUNCH PROPERTIES PAGE...
- public static String RESID_PROP_SERVERLAUNCHER_MEANS;
- public static String RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON;
- public static String RESID_PROP_SERVERLAUNCHER_RADIO_REXEC;
- public static String RESID_PROP_SERVERLAUNCHER_RADIO_NONE;
- public static String RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON_TOOLTIP;
- public static String RESID_PROP_SERVERLAUNCHER_RADIO_REXEC_TOOLTIP;
- public static String RESID_PROP_SERVERLAUNCHER_RADIO_NONE_TOOLTIP;
- public static String RESID_PROP_SERVERLAUNCHER_PATH;
- public static String RESID_PROP_SERVERLAUNCHER_PATH_TOOLTIP;
- public static String RESID_PROP_SERVERLAUNCHER_INVOCATION;
- public static String RESID_PROP_SERVERLAUNCHER_INVOCATION_TOOLTIP;
-
-
-
-
- // ---------------------------
- // RE-USABLE WIDGET STRINGS...
- // ---------------------------
-
- // WIDGETS IN SYSTEMCONNECTIONCOMBO.JAVA
- public static String WIDGET_CONNECTION_LABEL;
- public static String WIDGET_CONNECTION_TOOLTIP;
-
- public static String WIDGET_BUTTON_NEWCONNECTION_LABEL;
- public static String WIDGET_BUTTON_NEWCONNECTION_TOOLTIP;
-
- // -------------------------
- // PREFERENCES...
- // -------------------------
- public static String RESID_PREF_ROOT_PAGE;
-
- public static String RESID_PREF_SYSTYPE_COLHDG_NAME;
- public static String RESID_PREF_SYSTYPE_COLHDG_ENABLED;
- public static String RESID_PREF_SYSTYPE_COLHDG_DESC;
- public static String RESID_PREF_SYSTYPE_COLHDG_USERID;
-
- //
- // Signon Information Preferences Page
- //
-
- public static String RESID_PREF_SIGNON_HOSTNAME_TITLE;
- public static String RESID_PREF_SIGNON_HOSTNAME_LABEL;
- public static String RESID_PREF_SIGNON_HOSTNAME_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_SYSTYPE_TITLE;
- public static String RESID_PREF_SIGNON_SYSTYPE_LABEL;
- public static String RESID_PREF_SIGNON_SYSTYPE_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_USERID_TITLE;
- public static String RESID_PREF_SIGNON_USERID_LABEL;
- public static String RESID_PREF_SIGNON_USERID_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_PASSWORD_LABEL;
- public static String RESID_PREF_SIGNON_PASSWORD_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_PASSWORD_VERIFY_LABEL;
- public static String RESID_PREF_SIGNON_PASSWORD_VERIFY_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_ADD_LABEL;
- public static String RESID_PREF_SIGNON_ADD_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_REMOVE_LABEL;
- public static String RESID_PREF_SIGNON_REMOVE_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_CHANGE_LABEL;
- public static String RESID_PREF_SIGNON_CHANGE_TOOLTIP;
-
- public static String RESID_PREF_SIGNON_ADD_DIALOG_TITLE;
-
- public static String RESID_PREF_SIGNON_CHANGE_DIALOG_TITLE;
-
-
- // Offline constants (yantzi:3.0)
- public static String RESID_OFFLINE_LABEL;
- public static String RESID_OFFLINE_WORKOFFLINE_LABEL;
- public static String RESID_OFFLINE_WORKOFFLINE_TOOLTIP;
-
- // -------------------------------------------
- // remote search view constants
- // -------------------------------------------
-
- // Remove selected matches action
- public static String RESID_SEARCH_REMOVE_SELECTED_MATCHES_LABEL;
- public static String RESID_SEARCH_REMOVE_SELECTED_MATCHES_TOOLTIP;
-
- // Remove all matches action
- public static String RESID_SEARCH_REMOVE_ALL_MATCHES_LABEL;
- public static String RESID_SEARCH_REMOVE_ALL_MATCHES_TOOLTIP;
-
- // Clear history action
- public static String RESID_SEARCH_CLEAR_HISTORY_LABEL;
- public static String RESID_SEARCH_CLEAR_HISTORY_TOOLTIP;
-
- /** ******************************************* */
- /* Generated Vars */
- /** ******************************************* */
- public static String RESID_PREF_USERID_PERTYPE_PREFIX_LABEL;
- public static String RESID_PREF_USERID_PERTYPE_PREFIX_TOOLTIP;
-
- public static String RESID_PREF_SHOWFILTERPOOLS_PREFIX_LABEL;
- public static String RESID_PREF_SHOWFILTERPOOLS_PREFIX_TOOLTIP;
-
- public static String RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_LABEL;
- public static String RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_TOOLTIP;
-
- public static String RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_LABEL;
- public static String RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_TOOLTIP;
-
- public static String RESID_PREF_REMEMBERSTATE_PREFIX_LABEL;
- public static String RESID_PREF_REMEMBERSTATE_PREFIX_TOOLTIP;
-
-
- public static String RESID_PREF_RESTOREFROMCACHE_PREFIX_LABEL;
- public static String RESID_PREF_RESTOREFROMCACHE_PREFIX_TOOLTIP;
-
-
-
- //
- // Actions
- //
- // Browse with menu item
- public static String ACTION_CASCADING_BROWSEWITH_LABEL;
- public static String ACTION_CASCADING_BROWSEWITH_TOOLTIP;
-
- // Compare with menu item
- public static String ACTION_CASCADING_COMPAREWITH_LABEL;
- public static String ACTION_CASCADING_COMPAREWITH_TOOLTIP;
-
-
- // Replace with menu item
- public static String ACTION_CASCADING_REPLACEWITH_LABEL;
- public static String ACTION_CASCADING_REPLACEWITH_TOOLTIP;
-
- public static String ACTION_RENAME_LABEL;
- public static String ACTION_RENAME_TOOLTIP;
-
-
- public static String ACTION_NEWFILE_LABEL;
- public static String ACTION_NEWFILE_TOOLTIP;
-
- public static String ACTION_CASCADING_NEW_LABEL;
- public static String ACTION_CASCADING_NEW_TOOLTIP;
-
- public static String ACTION_CASCADING_GOTO_LABEL;
- public static String ACTION_CASCADING_GOTO_TOOLTIP;
-
- public static String ACTION_CASCADING_GOINTO_LABEL;
- public static String ACTION_CASCADING_GOINTO_TOOLTIP;
-
- public static String ACTION_CASCADING_OPEN_LABEL;
- public static String ACTION_CASCADING_OPEN_TOOLTIP;
-
- public static String ACTION_CASCADING_OPENWITH_LABEL;
- public static String ACTION_CASCADING_OPENWITH_TOOLTIP;
-
- public static String ACTION_CASCADING_WORKWITH_LABEL;
- public static String ACTION_CASCADING_WORKWITH_TOOLTIP;
-
- public static String ACTION_CASCADING_REMOTESERVERS_LABEL;
- public static String ACTION_CASCADING_REMOTESERVERS_TOOLTIP;
-
- public static String ACTION_REMOTESERVER_START_LABEL;
- public static String ACTION_REMOTESERVER_START_TOOLTIP;
-
- public static String ACTION_REMOTESERVER_STOP_LABEL;
- public static String ACTION_REMOTESERVER_STOP_TOOLTIP;
-
- public static String ACTION_CASCADING_EXPAND_TO_LABEL;
- public static String ACTION_CASCADING_EXPAND_TO_TOOLTIP;
-
- public static String ACTION_CASCADING_VIEW_LABEL;
- public static String ACTION_CASCADING_VIEW_TOOLTIP;
-
- public static String ACTION_CASCADING_PREFERENCES_LABEL;
- //FIXME This one is OBSOLETE with https://bugs.eclipse.org/bugs/show_bug.cgi?id=186769
- public static String ACTION_CASCADING_PREFERENCES_TOOLTIP;
-
- public static String ACTION_CASCADING_PULLDOWN_LABEL;
- public static String ACTION_CASCADING_PULLDOWN_TOOLTIP;
-
- public static String ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_LABEL;
- public static String ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_TOOLTIP;
-
- public static String ACTION_TEAM_RELOAD_LABEL;
- public static String ACTION_TEAM_RELOAD_TOOLTIP;
-
- public static String ACTION_PROFILE_MAKEACTIVE_LABEL;
- public static String ACTION_PROFILE_MAKEACTIVE_TOOLTIP;
-
- public static String ACTION_PROFILE_MAKEINACTIVE_LABEL;
- public static String ACTION_PROFILE_MAKEINACTIVE_TOOLTIP;
-
- public static String ACTION_PROFILE_COPY_LABEL;
- public static String ACTION_PROFILE_COPY_TOOLTIP;
-
- public static String ACTION_NEWPROFILE_LABEL;
- public static String ACTION_NEWPROFILE_TOOLTIP;
-
- public static String ACTION_NEW_PROFILE_LABEL;
- public static String ACTION_NEW_PROFILE_TOOLTIP;
-
- public static String ACTION_QUALIFY_CONNECTION_NAMES_LABEL;
- public static String ACTION_QUALIFY_CONNECTION_NAMES_TOOLTIP;
-
- public static String ACTION_RESTORE_STATE_PREFERENCE_LABEL;
- public static String ACTION_RESTORE_STATE_PREFERENCE_TOOLTIP;
-
- public static String ACTION_PREFERENCE_SHOW_FILTERPOOLS_LABEL;
- public static String ACTION_PREFERENCE_SHOW_FILTERPOOLS_TOOLTIP;
-
- public static String ACTION_SHOW_PREFERENCEPAGE_LABEL;
- public static String ACTION_SHOW_PREFERENCEPAGE_TOOLTIP;
-
- public static String ACTION_NEWCONN_LABEL;
- public static String ACTION_NEWCONN_TOOLTIP;
-
- public static String ACTION_ANOTHERCONN_LABEL;
- public static String ACTION_ANOTHERCONN_TOOLTIP;
-
- public static String ACTION_TESTFILTERSTRING_LABEL;
- public static String ACTION_TESTFILTERSTRING_TOOLTIP;
-
- public static String ACTION_NEWFILTER_LABEL;
- public static String ACTION_NEWFILTER_TOOLTIP;
-
- public static String ACTION_UPDATEFILTER_LABEL;
- public static String ACTION_UPDATEFILTER_TOOLTIP;
-
- public static String ACTION_NEWFILTERPOOL_LABEL;
- public static String ACTION_NEWFILTERPOOL_TOOLTIP;
-
- public static String ACTION_RMVFILTERPOOLREF_LABEL;
- public static String ACTION_RMVFILTERPOOLREF_TOOLTIP;
-
- public static String ACTION_SELECTFILTERPOOLS_LABEL;
- public static String ACTION_SELECTFILTERPOOLS_TOOLTIP;
-
- public static String ACTION_WORKWITH_FILTERPOOLS_LABEL;
- public static String ACTION_WORKWITH_FILTERPOOLS_TOOLTIP;
-
- public static String ACTION_WORKWITH_WWFILTERPOOLS_LABEL;
- public static String ACTION_WORKWITH_WWFILTERPOOLS_TOOLTIP;
-
- public static String ACTION_WORKWITH_PROFILES_LABEL;
- public static String ACTION_WORKWITH_PROFILES_TOOLTIP;
-
- public static String ACTION_RUN_LABEL;
- public static String ACTION_RUN_TOOLTIP;
-
- public static String ACTION_REFRESH_ALL_LABEL;
- public static String ACTION_REFRESH_ALL_TOOLTIP;
-
- public static String ACTION_REFRESH_LABEL;
- public static String ACTION_REFRESH_TOOLTIP;
-
- public static String ACTION_REFRESH_TABLE_LABLE;
- public static String ACTION_REFRESH_TABLE_TOOLTIP;
-
- public static String ACTION_DELETE_LABEL;
- public static String ACTION_DELETE_TOOLTIP;
-
- public static String ACTION_CLEAR_LABEL;
- public static String ACTION_CLEAR_TOOLTIP;
-
- public static String ACTION_CLEAR_ALL_LABEL;
- public static String ACTION_CLEAR_ALL_TOOLTIP;
-
- public static String ACTION_CLEAR_SELECTED_LABEL;
- public static String ACTION_CLEAR_SELECTED_TOOLTIP;
-
- public static String ACTION_MOVEUP_LABEL;
- public static String ACTION_MOVEUP_TOOLTIP;
-
- public static String ACTION_MOVEDOWN_LABEL;
- public static String ACTION_MOVEDOWN_TOOLTIP;
- public static String ACTION_MOVEUPLEVEL_TOOLTIP;
- public static String ACTION_GOUPLEVEL_TOOLTIP;
-
- public static String ACTION_CONNECT_LABEL;
- public static String ACTION_CONNECT_TOOLTIP;
-
- public static String ACTION_CLEARPASSWORD_LABEL;
- public static String ACTION_CLEARPASSWORD_TOOLTIP;
-
- public static String ACTION_DISCONNECT_LABEL;
- public static String ACTION_DISCONNECT_TOOLTIP;
-
- public static String ACTION_DISCONNECTALLSUBSYSTEMS_LABEL;
- public static String ACTION_DISCONNECTALLSUBSYSTEMS_TOOLTIP;
-
- public static String ACTION_CONNECT_ALL_LABEL;
- public static String ACTION_CONNECT_ALL_TOOLTIP;
-
- public static String ACTION_CLEARPASSWORD_ALL_LABEL;
- public static String ACTION_CLEARPASSWORD_ALL_TOOLTIP;
-
- public static String ACTION_SET_LABEL;
- public static String ACTION_SET_TOOLTIP;
-
- public static String ACTION_HISTORY_DELETE_LABEL;
- public static String ACTION_HISTORY_DELETE_TOOLTIP;
-
- public static String ACTION_HISTORY_CLEAR_LABEL;
- public static String ACTION_HISTORY_CLEAR_TOOLTIP;
-
- public static String ACTION_HISTORY_MOVEUP_LABEL;
- public static String ACTION_HISTORY_MOVEUP_TOOLTIP;
-
- public static String ACTION_HISTORY_MOVEDOWN_LABEL;
- public static String ACTION_HISTORY_MOVEDOWN_TOOLTIP;
-
- public static String ACTION_HISTORY_MOVEFORWARD_LABEL;
- public static String ACTION_HISTORY_MOVEFORWARD_TOOLTIP;
-
- public static String ACTION_HISTORY_MOVEBACKWARD_LABEL;
- public static String ACTION_HISTORY_MOVEBACKWARD_TOOLTIP;
-
- public static String ACTION_COPY_LABEL;
- public static String ACTION_COPY_TOOLTIP;
-
- public static String ACTION_CUT_LABEL;
- public static String ACTION_CUT_TOOLTIP;
-
- public static String ACTION_UNDO_LABEL;
- public static String ACTION_UNDO_TOOLTIP;
-
- public static String ACTION_PASTE_LABEL;
- public static String ACTION_PASTE_TOOLTIP;
-
- public static String ACTION_COPY_CONNECTION_LABEL;
- public static String ACTION_COPY_CONNECTION_TOOLTIP;
-
- public static String ACTION_COPY_FILTERPOOL_LABEL;
- public static String ACTION_COPY_FILTERPOOL_TOOLTIP;
-
- public static String ACTION_COPY_FILTER_LABEL;
- public static String ACTION_COPY_FILTER_TOOLTIP;
-
- public static String ACTION_COPY_FILTERSTRING_LABEL;
- public static String ACTION_COPY_FILTERSTRING_TOOLTIP;
-
- public static String ACTION_MOVE_LABEL;
- public static String ACTION_MOVE_TOOLTIP;
-
- public static String ACTION_MOVE_CONNECTION_LABEL;
- public static String ACTION_MOVE_CONNECTION_TOOLTIP;
-
- public static String ACTION_MOVE_FILTERPOOL_LABEL;
- public static String ACTION_MOVE_FILTERPOOL_TOOLTIP;
-
- public static String ACTION_MOVE_FILTER_LABEL;
- public static String ACTION_MOVE_FILTER_TOOLTIP;
-
- public static String ACTION_MOVE_FILTERSTRING_LABEL;
- public static String ACTION_MOVE_FILTERSTRING_TOOLTIP;
-
- public static String ACTION_TABLE_LABEL;
- public static String ACTION_TABLE_TOOLTIP;
-
- public static String ACTION_MONITOR_LABEL;
- public static String ACTION_MONITOR_TOOLTIP;
-
- public static String ACTION_SEARCH_LABEL;
- public static String ACTION_SEARCH_TOOLTIP;
-
- public static String ACTION_CANCEL_SEARCH_LABEL;
- public static String ACTION_CANCEL_SEARCH_TOOLTIP;
-
- public static String ACTION_LOCK_LABEL;
- public static String ACTION_LOCK_TOOLTIP;
-
- public static String ACTION_UNLOCK_LABEL;
- public static String ACTION_UNLOCK_TOOLTIP;
-
-
- public static String ACTION_POSITIONTO_LABEL;
- public static String ACTION_POSITIONTO_TOOLTIP;
-
- public static String ACTION_SUBSET_LABEL;
- public static String ACTION_SUBSET_TOOLTIP;
-
- public static String ACTION_PRINTLIST_LABEL;
- public static String ACTION_PRINTLIST_TOOLTIP;
-
- public static String ACTION_SELECTCOLUMNS_LABEL;
- public static String ACTION_SELECTCOLUMNS_TOOLTIP;
-
- public static String ACTION_OPENEXPLORER_DIFFPERSP2_LABEL;
- public static String ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP;
-
- public static String ACTION_EXPAND_SELECTED_LABEL;
- public static String ACTION_EXPAND_SELECTED_TOOLTIP;
-
- public static String ACTION_COLLAPSE_SELECTED_LABEL;
- public static String ACTION_COLLAPSE_SELECTED_TOOLTIP;
-
- public static String ACTION_COLLAPSE_ALL_LABEL;
- public static String ACTION_COLLAPSE_ALL_TOOLTIP;
-
- public static String ACTION_EXPAND_ALL_LABEL;
- public static String ACTION_EXPAND_ALL_TOOLTIP;
-
- public static String ACTION_SELECT_ALL_LABEL;
- public static String ACTION_SELECT_ALL_TOOLTIP;
-
- public static String ACTION_SELECT_INPUT_LABEL;
- public static String ACTION_SELECT_INPUT_DLG;
- public static String ACTION_SELECT_INPUT_TOOLTIP;
-
-
-
- // services and connector services property pages
- public static String RESID_PROPERTIES_SERVICES_NAME;
- public static String RESID_PROPERTIES_SERVICES_LABEL;
- public static String RESID_PROPERTIES_SERVICES_TOOLTIP;
- public static String RESID_PROPERTIES_DESCRIPTION_LABEL;
- public static String RESID_PROPERTIES_FACTORIES_LABEL;
- public static String RESID_PROPERTIES_FACTORIES_TOOLTIP;
- public static String RESID_PROPERTIES_PROPERTIES_LABEL;
- public static String RESID_PROPERTIES_PROPERTIES_TOOLTIP;
-
-
- // Services form
- public static String RESID_SERVICESFORM_CONFIGURATION_TOOLTIP;
- public static String RESID_SERVICESFORM_SERVICES_TOOLTIP;
- public static String RESID_SERVICESFORM_CONNECTORSERVICES_TOOLTIP;
- public static String RESID_SERVICESFORM_PROPERTIES_TOOLTIP;
-
- // Do not show again message
- public static String RESID_DO_NOT_SHOW_MESSAGE_AGAIN_LABEL;
- public static String RESID_DO_NOT_SHOW_MESSAGE_AGAIN_TOOLTIP;
-
- public static String RESID_EXPORT_CONNECTION_ACTIONS_TOOLTIP;
-
- public static String RESID_EXPORT_CONNECTIONS_ACTION_LABEL;
-
- // Encoding
- public static String RESID_HOST_ENCODING_GROUP_LABEL;
- public static String RESID_HOST_ENCODING_SETTING_NOTE;
- public static String RESID_HOST_ENCODING_SETTING_MSG;
- public static String RESID_HOST_ENCODING_REMOTE_LABEL;
- public static String RESID_HOST_ENCODING_REMOTE_ENCODING_LABEL;
- public static String RESID_HOST_ENCODING_REMOTE_TOOLTIP;
- public static String RESID_HOST_ENCODING_OTHER_LABEL;
- public static String RESID_HOST_ENCODING_OTHER_TOOLTIP;
- public static String RESID_HOST_ENCODING_ENTER_TOOLTIP;
-
- public static String RESID_IMPORT_CONNECTION_ACTION_LABEL;
-
- public static String RESID_IMPORT_CONNECTION_ACTION_TOOLTIP;
-
- public static String RESID_IMPORT_CONNECTION_LABEL_LONG;
-
- public static String SystemExportConnectionAction_CoreExceptionFound;
-
- public static String SystemExportConnectionAction_Error;
-
- public static String SystemExportConnectionAction_ExportJobName;
-
- public static String SystemExportConnectionAction_OverwriteFileCondition;
-
- public static String SystemExportConnectionAction_UnexpectedException;
-
- public static String SystemExportConnectionAction_Warning;
-
- public static String SystemExportConnectionAction_WriteProtectedFileCondition;
-
- public static String SystemImportConnectionAction_CoreExceptionFound;
-
- public static String SystemImportConnectionAction_Error;
-
- public static String SystemImportConnectionAction_FileNotFoundCondition;
-
- public static String SystemImportConnectionAction_FileNotReadableCondition;
-
- public static String SystemImportConnectionAction_ImportJobName;
-
- public static String SystemImportConnectionAction_UnexpectedException;
-
- public static String SystemTableViewPart_title;
-
- public static String SystemTypeFieldEditor_false;
-
- public static String SystemTypeFieldEditor_true;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, SystemResources.class);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.properties
deleted file mode 100644
index ca1223afa..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemResources.properties
+++ /dev/null
@@ -1,1093 +0,0 @@
-################################################################################
-# Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
-# This program and the accompanying materials are made available under the terms
-# of the Eclipse Public License v1.0 which accompanies this distribution, and is
-# available at http://www.eclipse.org/legal/epl-v10.html
-#
-# Initial Contributors:
-# The following IBM employees contributed to the Remote System Explorer
-# component that contains this file: David McKnight, Kushal Munir,
-# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
-# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
-#
-# Contributors:
-# Martin Oberhuber (Wind River) - [185552] Remove remoteSystemsViewPreferencesActions extension point
-# David McKnight (IBM) - [210229] table refresh needs unique table-specific tooltip-text
-# Kevin Doyle (IBM) - [212944] New Profile dialog should have title "New Profile"
-# David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
-# David Dykstal (IBM) - [181331] new filter wizard title should be "New Filter"
-# David Dykstal (IBM) - [142452] copy operations for connections, filterpools, and filters should be named "Copy..."
-# David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
-# Rupen Mardirossian (IBM) - [210692] Define strings for SystemCopyDialog
-# Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
-# David Dykstal (IBM) - [197018] Last Page of New Filter Wizard mentions Change Action
-# David Dykstal (IBM) - [210242] Credentials dialog should look different if password is not supported or optional
-# David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
-# David Dykstal (IBM) - [231943] Make true and false translatable on SystemTypeFieldEditor
-# David Dykstal (IBM) - [188150] adding "go up one level" tooltip
-# David Dykstal (IBM) - [233678] title string is constructed by concatenation, should be substituted
-################################################################################
-
-# NLS_MESSAGEFORMAT_VAR
-# NLS_ENCODING=UTF-8
-
-##############################################################
-# Button values. Mnemonics will be assigned automatically, don't set them here.
-##############################################################
-BUTTON_BROWSE=Browse...
-BUTTON_CLOSE=Close
-BUTTON_TEST=Test
-BUTTON_ADD=Add
-BUTTON_CREATE_LABEL=Create
-BUTTON_CREATE_TOOLTIP=Press to create the new resource
-BUTTON_CANCEL_ALL = Cancel All
-BUTTON_CANCEL_ALL_TOOLTIP = Cancel for all
-BUTTON_OVERWRITE_ALL = Overwrite All
-BUTTON_OVERWRITE_ALL_TOOLTIP = Overwrite for all
-
-TERM_YES=Yes
-TERM_NO=No
-TERM_TRUE=True
-TERM_FALSE=False
-TERM_ALL=All
-
-#=============================================================
-# RE-USABLE COMPOSITE WIDGETS
-#=============================================================
-# RE-USABLE CONNECTION-SELECTION COMPOSITE WIDGETS
-WIDGET_CONNECTION_LABEL=Connection:
-WIDGET_CONNECTION_TOOLTIP=Select remote system connection
-WIDGET_BUTTON_NEWCONNECTION_LABEL=New...
-WIDGET_BUTTON_NEWCONNECTION_TOOLTIP=Create a new remote system connection
-
-
-#=============================================================
-# MESSAGE LINE MRI
-#=============================================================
-RESID_MSGLINE_TIP=Press to see additional message details
-
-##############################################################
-# Preference pages
-##############################################################
-RESID_PREF_ROOT_PAGE=Remote Systems
-RESID_PREF_USERID_PERTYPE_PREFIX_LABEL=System type information
-RESID_PREF_USERID_PERTYPE_PREFIX_TOOLTIP=Set enablement state and default user ID for the selected system type. Press F1 for details.
-#RESID_PREF_USERID_PERTYPE_SYSTEMTYPES_LABEL=System Types
-#RESID_PREF_USERID_PERTYPE_USERID_LABEL=User ID
-RESID_PREF_SHOWFILTERPOOLS_PREFIX_LABEL=Show filter pools in Remote Systems view
-RESID_PREF_SHOWFILTERPOOLS_PREFIX_TOOLTIP=Show filter pools when expanding subsystems
-RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_LABEL=Show "New Connection" prompt in Remote Systems view
-RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_TOOLTIP=Show the prompt for a new connection in the Remote Systems view
-RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_LABEL=Show connection names prefixed by profile name
-RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_TOOLTIP=Select this if two connections or filter pools have the same name across different profiles
-RESID_PREF_REMEMBERSTATE_PREFIX_LABEL=Re-open Remote Systems view to previous state
-RESID_PREF_REMEMBERSTATE_PREFIX_TOOLTIP=Re-expand previously expanded connections when starting up
-RESID_PREF_RESTOREFROMCACHE_PREFIX_LABEL=Use cached information to restore the Remote Systems view
-RESID_PREF_RESTOREFROMCACHE_PREFIX_TOOLTIP=If cached information is available then it is used to restore the Remote Systems view instead of connecting to the remote system
-RESID_PREF_SYSTYPE_COLHDG_NAME=System Type
-RESID_PREF_SYSTYPE_COLHDG_ENABLED=Enabled
-RESID_PREF_SYSTYPE_COLHDG_DESC=Description
-RESID_PREF_SYSTYPE_COLHDG_USERID=Default User ID
-
-##############################################################
-# Miscellaneous Actions that appear as either buttons and/or menu items.
-# Actions use the following keys:
-# xxx.label=Text shown on button or menu item
-# xxx.tooltip=Short help shown in hover help box
-##############################################################
-# Style popup menu (cascading) on common Work-With lists...
-# labels...
-#MENUITEM_WWSTYLE_LABEL=Style
-#MENUITEM_WWSTYLE_NEXT_LABEL=Next style
-#MENUITEM_WWSTYLE_1_LABEL=1. Entry field and buttons on side
-#MENUITEM_WWSTYLE_2_LABEL=2. Entry field and buttons on top
-#MENUITEM_WWSTYLE_3_LABEL=3. No entry field and buttons on top
-#MENUITEM_WWSTYLE_4_LABEL=4. No entry field and no buttons
-#MENUITEM_WWSTYLE_5_LABEL=5. No entry field and buttons on side
-#MENUITEM_WWSTYLE_6_LABEL=6. No entry field, Add buttons on top, other buttons on side
-# descriptions...
-#MENUITEM_WWSTYLE_DESCRIPTION=Switch to another style of work-with list
-#MENUITEM_WWSTYLE_NEXT_DESCRIPTION=Switch to the next style of work-with list
-#MENUITEM_WWSTYLE_1_DESCRIPTION=Switch to style 1
-#MENUITEM_WWSTYLE_2_DESCRIPTION=Switch to style 2
-#MENUITEM_WWSTYLE_3_DESCRIPTION=Switch to style 3
-#MENUITEM_WWSTYLE_4_DESCRIPTION=Switch to style 4
-#MENUITEM_WWSTYLE_5_DESCRIPTION=Switch to style 5
-#MENUITEM_WWSTYLE_6_DESCRIPTION=Switch to style 6
-
-##############################################################
-# Wizard and dialog resources
-##############################################################
-
-#=============================================================
-# SINGLE-SELECT RENAME DIALOG...
-#=============================================================
-RESID_RENAME_SINGLE_TITLE=Rename Resource
-RESID_SIMPLE_RENAME_PROMPT_LABEL=New name
-RESID_SIMPLE_RENAME_RESOURCEPROMPT_LABEL=Resource type:
-RESID_SIMPLE_RENAME_RESOURCEPROMPT_TOOLTIP=Type of object being renamed
-RESID_SIMPLE_RENAME_RADIO_OVERWRITE_LABEL =Overwrite
-RESID_SIMPLE_RENAME_RADIO_OVERWRITE_TOOLTIP =Replace the existing file with the new one.
-RESID_SIMPLE_RENAME_RADIO_RENAME_LABEL =Rename
-RESID_SIMPLE_RENAME_RADIO_RENAME_TOOLTIP =Rename the file to something else.
-
-
-# SPECIALIZED PROMPTS FOR SPECIFIC TYPES OF RESOURCES...
-RESID_SIMPLE_RENAME_PROFILE_PROMPT_LABEL=New profile name:
-RESID_SIMPLE_RENAME_PROFILE_PROMPT_TIP=Enter unique new name for this profile
-
-
-
-
-#=============================================================
-# MULTI-SELECT RENAME DIALOG...
-#=============================================================
-RESID_RENAME_TITLE=Rename Resources
-RESID_RENAME_VERBIAGE=Enter a unique new name for each resource. You can Tab between the names.
-#column headings...
-RESID_RENAME_COLHDG_OLDNAME=Resource
-RESID_RENAME_COLHDG_NEWNAME=New name
-RESID_RENAME_COLHDG_TYPE=Resource Type
-# SPECIALIZED PROMPTS FOR SPECIFIC TYPES OF RESOURCES...
-RESID_MULTI_RENAME_PROFILE_VERBIAGE=Enter unique new names for each profile
-
-#=============================================================
-# GENERIC DELETE DIALOG...
-#=============================================================
-RESID_DELETE_TITLE=Delete Confirmation
-RESID_DELETE_PROMPT=Delete selected resources?
-RESID_DELETE_PROMPT_SINGLE=Delete selected resource?
-RESID_DELETE_COLHDG_OLDNAME=Resource
-RESID_DELETE_COLHDG_TYPE=Resource Type
-RESID_DELETE_BUTTON=Delete
-RESID_DELETE_WARNING_LABEL=WARNING! Remote objects are permanently deleted!
-RESID_DELETE_WARNING_TOOLTIP=You are confirming permanent deletion of the selected resource(s) from the remote system. This action cannot be undone
-
-# SPECIALIZED PROMPTS FOR SPECIFIC TYPES OF RESOURCES...
-RESID_DELETE_PROFILES_PROMPT=Delete selected profiles, including their connections, filters and user actions?
-
-
-#=============================================================
-# GENERIC COPY DIALOG...
-#=============================================================
-RESID_COPY_SINGLE_TITLE=Copy Resource
-RESID_COPY_TITLE=Copy Resources
-RESID_COPY_PROMPT=Select the copy destination
-RESID_COPY_TARGET_PROFILE_PROMPT=Select the active profile to copy into
-RESID_COPY_TARGET_FILTERPOOL_PROMPT=Select the filter pool to copy into
-
-#=============================================================
-# GENERIC MOVE DIALOG...
-#=============================================================
-RESID_MOVE_SINGLE_TITLE=Move Resource
-RESID_MOVE_TITLE=Move Resources
-RESID_MOVE_PROMPT=Select the move destination
-RESID_MOVE_TARGET_PROFILE_PROMPT=Select the active profile to move into
-RESID_MOVE_TARGET_FILTERPOOL_PROMPT=Select the filter pool to move into
-
-#=============================================================
-# GENERIC COPY/MOVE NAME-COLLISION DIALOG...
-#=============================================================
-RESID_COLLISION_RENAME_TITLE=Duplicate Name Collision
-RESID_COLLISION_RENAME_VERBIAGE=A resource named "&1" already exists.
-RESID_COLLISION_RENAME_LABEL=Rename to
-RESID_COLLISION_COPY_VERBIAGE=The following resources already exist. Would you like to overwrite all of the existing resources or cancel the operation?
-RESID_COLLISION_COPY_COLHDG_OLDNAME=Resource
-
-
-#=============================================================
-# NEW PROFILE WIZARD...
-#=============================================================
-RESID_NEWPROFILE_TITLE=New Profile
-RESID_NEWPROFILE_PAGE1_TITLE=Remote System Profile
-RESID_NEWPROFILE_PAGE1_DESCRIPTION=Define profile to hold connections
-RESID_NEWPROFILE_VERBIAGE=Profiles enable team support. They contain all the connections, filters, user actions and compile commands. Whenever these items are created, you are prompted for the profile to create them in. Whenever they are shown, the total from all active profiles are shown. By default, team members only have active their own profiles and the Team profile.
-RESID_NEWPROFILE_NAME_LABEL=Name
-RESID_NEWPROFILE_NAME_TOOLTIP=Unique profile name
-RESID_NEWPROFILE_MAKEACTIVE_LABEL=Make active
-RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP=Show connections in this profile
-
-#======================================================================
-# NEW CONNECTION PROMPT ("New Connection..." SPECIAL CONNECTION IN RSE)
-#======================================================================
-RESID_NEWCONN_PROMPT_LABEL=New Connection
-RESID_NEWCONN_PROMPT_VALUE=A prompt for a new connection
-RESID_NEWCONN_EXPANDABLEPROMPT_VALUE=An expandable prompt for a new connection
-
-#=============================================================
-# NEW CONNECTION WIZARD...
-#=============================================================
-RESID_NEWCONN_TITLE=New Connection
-RESID_NEWCONN_PAGE1_TITLE=Remote System Connection
-RESID_NEWCONN_PAGE1_LOCAL_TITLE=Local System Connection
-RESID_NEWCONN_PAGE1_REMOTE_TITLE=Remote &1 System Connection
-RESID_NEWCONN_PAGE1_DESCRIPTION=Define connection information
-RESID_NEWCONN_MAIN_PAGE_TITLE=Select Remote System Type
-RESID_NEWCONN_MAIN_PAGE_DESCRIPTION=Please select the system type of the remote system to connect.
-
-#=============================================================
-# NEW CONNECTION WIZARD INFORMATION PAGE FOR UNIX/LINUX/WINDOWS
-#=============================================================
-RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION=Define subsystem information
-RESID_NEWCONN_SUBSYSTEMPAGE_FILES_TITLE=Communications Server
-RESID_NEWCONN_SUBSYSTEMPAGE_FILES_DESCRIPTION=How to install server support
-RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBIAGE1=To connect to your remote system, you must first copy and expand the supplied Java server code jar file on that system, and either manually start that server or the supplied daemon. You will find the instructions for this in the Help.
-RESID_NEWCONN_SUBSYSTEMPAGE_FILES_VERBIAGE2=If you manually start the communications server, you will need to set the port number property for this connection. To do this, expand your newly created connection in the Remote System Explorer perspective. Right click on the Files subsystem and select Properties. You can specify the port to match the port you specified or were assigned for the server.
-
-#=============================================================
-# RENAME PROFILE PAGE...
-#=============================================================
-RESID_PROFILE_PROFILENAME_LABEL=Profile
-RESID_PROFILE_PROFILENAME_TIP=New name for the profile
-RESID_PROFILE_PROFILENAME_VERBIAGE=Welcome to Remote Systems. Connections can be sharable by the team or private to you. Enter a profile name to uniquely identify you from your team members. You will decide for each new connection whether it is owned by the team profile or your profile.
-
-#=============================================================
-# DUPLICATE PROFILE DIALOG...
-#=============================================================
-RESID_COPY_PROFILE_TITLE=Duplicate Profile
-RESID_COPY_PROFILE_PROMPT_LABEL=New profile name
-RESID_COPY_PROFILE_PROMPT_TOOLTIP=Enter a unique name for the new profile
-
-
-#=============================================================
-# UPDATE CONNECTION DIALOG...
-#=============================================================
-RESID_CONNECTION_TYPE_LABEL=Resource type
-RESID_CONNECTION_TYPE_VALUE=Connection to remote system
-
-RESID_CONNECTION_SYSTEMTYPE_LABEL=System type
-RESID_CONNECTION_SYSTEMTYPE_TIP=Operating system type of the remote host
-
-RESID_CONNECTION_SYSTEMTYPE_READONLY_TIP=Operating system type of the remote host
-
-RESID_CONNECTION_CONNECTIONNAME_LABEL=Connection name
-RESID_CONNECTION_CONNECTIONNAME_TIP=Arbitrary name for this connection, unique to this profile
-
-RESID_CONNECTION_HOSTNAME_LABEL=Host name
-RESID_CONNECTION_HOSTNAME_TIP=Hostname or IP address of target system
-
-
-RESID_CONNECTION_DEFAULTUSERID_LABEL=Default User ID
-RESID_CONNECTION_DEFAULTUSERID_TIP=Default user ID for subsystems that don't specify a user ID
-RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP=Inherit from preferences, or set locally for this connection
-
-RESID_CONNECTION_PORT_LABEL=Port
-RESID_CONNECTION_PORT_TIP=Port number used to do the connection
-
-RESID_CONNECTION_DAEMON_PORT_LABEL=Daemon Port
-RESID_CONNECTION_DAEMON_PORT_TIP=Port number used to connect to the daemon that launches Remote System Explorer servers
-
-RESID_CONNECTION_DESCRIPTION_LABEL=Description
-RESID_CONNECTION_DESCRIPTION_TIP=Commentary description of the connection
-
-RESID_CONNECTION_PROFILE_LABEL=Parent profile
-RESID_CONNECTION_PROFILE_TIP=Select profile to contain this connection
-RESID_CONNECTION_PROFILE_READONLY_TIP=The profile containing this connection
-
-RESID_CONNECTION_VERIFYHOSTNAME_LABEL=Verify host name
-RESID_CONNECTION_VERIFYHOSTNAME_TOOLTIP=Verify a host of the given name or IP address exists
-
-
-
-#=============================================================
-# SYSTEMREGISTRY PROPERTY PAGE DIALOG...
-#=============================================================
-RESID_SYSTEMREGISTRY_CONNECTIONS=Connections
-
-#=============================================================
-# SUBSYSTEM PROPERTY PAGE DIALOG...
-#=============================================================
-RESID_SUBSYSTEM_NAME_LABEL=Name
-RESID_SUBSYSTEM_TYPE_LABEL=Resource type
-RESID_SUBSYSTEM_TYPE_VALUE=Subsystem
-RESID_SUBSYSTEM_VENDOR_LABEL=Vendor
-RESID_SUBSYSTEM_CONNECTION_LABEL=Parent connection
-RESID_SUBSYSTEM_PROFILE_LABEL=Parent profile
-RESID_SUBSYSTEM_PORT_LABEL=Port
-RESID_SUBSYSTEM_PORT_TIP=Port number to connect with
-RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP=Use first available port, or explicitly set the port number
-RESID_SUBSYSTEM_USERID_LABEL=User ID
-RESID_SUBSYSTEM_USERID_TIP=User ID to connect with
-RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP=Inherit user ID from connection, or set locally for this subsystem
-
-# Communications property page
-RESID_SUBSYSTEM_SSL_LABEL=Use SSL for network communications
-RESID_SUBSYSTEM_SSL_TIP=Use Secure Sockets Layer (SSL) for communicating with the server
-RESID_SUBSYSTEM_AUTODETECT_LABEL=Auto-detect SSL
-RESID_SUBSYSTEM_AUTODETECT_TIP=Automatically detect whether or not the server uses SSL. On some systems this may cause a longer connection time.
-RESID_SUBSYSTEM_SSL_ALERT_LABEL=Alert me when connecting using SSL
-RESID_SUBSYSTEM_SSL_ALERT_TIP=Show a confirmation dialog when the Secure Sockets Layer (SSL) is used for connecting with the RSE server
-RESID_SUBSYSTEM_NONSSL_ALERT_LABEL=Alert me when connecting insecurely
-RESID_SUBSYSTEM_NONSSL_ALERT_TIP=Show a confirmation dialog when no security layer is used for connecting with the RSE server
-
-# Single signon (Kerberos) Properties Page
-
-# Environment Properties Page
-RESID_SUBSYSTEM_ENVVAR_DESCRIPTION= Specify the environment variables that will be set when a connection is established:
-RESID_SUBSYSTEM_ENVVAR_TOOLTIP= The environment variables that will be set when a connection is established
-
-RESID_SUBSYSTEM_ENVVAR_NAME_TITLE= Name
-RESID_SUBSYSTEM_ENVVAR_NAME_LABEL= Name:
-RESID_SUBSYSTEM_ENVVAR_NAME_TOOLTIP= Enter a name for the environment variable
-
-RESID_SUBSYSTEM_ENVVAR_VALUE_TITLE= Value
-RESID_SUBSYSTEM_ENVVAR_VALUE_LABEL= Value:
-RESID_SUBSYSTEM_ENVVAR_VALUE_TOOLTIP= Enter a value for the environment variable
-
-
-RESID_SUBSYSTEM_ENVVAR_ADD_TOOLTIP= Add a new environment variable
-RESID_SUBSYSTEM_ENVVAR_REMOVE_TOOLTIP= Remove the selected environment variable
-RESID_SUBSYSTEM_ENVVAR_CHANGE_TOOLTIP= Change the selected environment variable
-RESID_SUBSYSTEM_ENVVAR_MOVEUP_LABEL= Move Up
-RESID_SUBSYSTEM_ENVVAR_MOVEUP_TOOLTIP= Move the selected environment variable(s) up in the list
-RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_LABEL= Move Down
-RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_TOOLTIP= Move the selected environment variable(s) down in the list
-
-# Add / Change Environment Variable Dialog
-RESID_SUBSYSTEM_ENVVAR_ADD_TITLE= Add Environment Variable
-RESID_SUBSYSTEM_ENVVAR_CHANGE_TITLE= Change Environment Variable
-
-#=============================================================
-# PROPERTY PAGE DIALOG...
-#=============================================================
-RESID_PROP_SERVERLAUNCHER_MEANS=Indicate how the remote server should be launched
-RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON=Remote daemon
-RESID_PROP_SERVERLAUNCHER_RADIO_REXEC=REXEC
-RESID_PROP_SERVERLAUNCHER_RADIO_NONE=Connect to running server
-RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON_TOOLTIP=Launch the server using a daemon running on the host.
-RESID_PROP_SERVERLAUNCHER_RADIO_REXEC_TOOLTIP=Launch the server using REXEC.
-RESID_PROP_SERVERLAUNCHER_RADIO_NONE_TOOLTIP=Manually launch the server and then connect to it from RSE.
-RESID_PROP_SERVERLAUNCHER_PATH=Path to installed server on host
-RESID_PROP_SERVERLAUNCHER_PATH_TOOLTIP=Specify where the installed server is located on the host.
-RESID_PROP_SERVERLAUNCHER_INVOCATION=Server launch command
-RESID_PROP_SERVERLAUNCHER_INVOCATION_TOOLTIP=Specify the name of the command that invokes the server.
-
-#=============================================================
-# NEW FILTERPOOL WIZARD...
-#=============================================================
-RESID_NEWFILTERPOOL_TITLE=New Filter Pool
-RESID_NEWFILTERPOOL_PAGE1_TITLE=System Filter Pool
-RESID_NEWFILTERPOOL_PAGE1_DESCRIPTION=Define a new pool for filters
-#WIDGETS ON NEW FILTER POOL WIZARD
-RESID_FILTERPOOLNAME_LABEL=Pool name
-RESID_FILTERPOOLNAME_TIP=Enter unique name for the pool within profile
-RESID_FILTERPOOLMANAGERNAME_LABEL=Profile
-RESID_FILTERPOOLMANAGERNAME_TIP=Select profile to contain this pool
-
-#=============================================================
-# COMMON PROPERTIES PAGE WIDGETS...
-#=============================================================
-RESID_PP_PROPERTIES_TYPE_LABEL=Resource type
-RESID_PP_PROPERTIES_TYPE_TOOLTIP=What type of artifact is this?
-
-
-#=============================================================
-# FILTERPOOL PROPERTIES PAGE...
-#=============================================================
-RESID_FILTERPOOL_TYPE_VALUE=Filter pool
-
-RESID_FILTERPOOL_NAME_LABEL=Name
-RESID_FILTERPOOL_NAME_TOOLTIP=Name of this filter pool
-
-RESID_FILTERPOOL_PROFILE_LABEL=Parent profile
-RESID_FILTERPOOL_PROFILE_TOOLTIP=Profile that owns this filter pool
-
-RESID_FILTERPOOL_REFERENCECOUNT_LABEL=Reference count
-RESID_FILTERPOOL_REFERENCECOUNT_TOOLTIP=How many connections show the filters in this pool?
-
-RESID_FILTERPOOL_RELATEDCONNECTION_LABEL=Related connection
-RESID_FILTERPOOL_RELATEDCONNECTION_TOOLTIP=Name of the single connection this pool is private to
-
-#=============================================================
-# FILTERPOOL REFERENCE PROPERTIES PAGE...
-#=============================================================
-RESID_FILTERPOOLREF_TYPE_VALUE=Reference to filter pool
-
-RESID_FILTERPOOLREF_NAME_LABEL=Name
-RESID_FILTERPOOLREF_NAME_TOOLTIP=Name of the referenced filter pool
-
-RESID_FILTERPOOLREF_SUBSYSTEM_LABEL=Parent subsystem
-RESID_FILTERPOOLREF_SUBSYSTEM_TOOLTIP=The subsystem which contains this reference
-
-RESID_FILTERPOOLREF_CONNECTION_LABEL=Parent connection
-RESID_FILTERPOOLREF_CONNECTION_TOOLTIP=The connection which owns the subsystem containing this reference
-
-RESID_FILTERPOOLREF_PROFILE_LABEL=Parent profile
-RESID_FILTERPOOLREF_PROFILE_TOOLTIP=The profile which owns the connection containing the subsystem with this reference
-
-#=============================================================
-# FILTER PROPERTIES PAGE...
-#=============================================================
-RESID_PP_FILTER_TYPE_VALUE=Filter
-RESID_PP_FILTER_TYPE_PROMPTABLE_VALUE=Prompting filter
-RESID_PP_FILTER_TYPE_PROMPTABLE_TOOLTIP=Whether this is a filter that prompts the user when its expanded
-
-RESID_PP_FILTER_NAME_LABEL=Name
-RESID_PP_FILTER_NAME_TOOLTIP=The name of this filter
-
-RESID_PP_FILTER_STRINGCOUNT_LABEL=Number of filter strings
-RESID_PP_FILTER_STRINGCOUNT_TOOLTIP=The number of filter strings contained in this filter
-
-RESID_PP_FILTER_FILTERPOOL_LABEL=Parent filter pool
-RESID_PP_FILTER_FILTERPOOL_TOOLTIP=The filter pool which contains this filter
-
-RESID_PP_FILTER_PROFILE_LABEL=Parent profile
-RESID_PP_FILTER_PROFILE_TOOLTIP=The profile which contains the filter pool with this filter
-
-RESID_PP_FILTER_ISCONNECTIONPRIVATE_LABEL=Connection private
-RESID_PP_FILTER_ISCONNECTIONPRIVATE_TOOLTIP=Whether this is a filter contained in a filter pool that is private to a single connection
-
-
-#=============================================================
-# FILTERSTRING PROPERTIES PAGE...
-#=============================================================
-RESID_PP_FILTERSTRING_TYPE_VALUE==Filter string
-
-RESID_PP_FILTERSTRING_FILTER_LABEL=Parent filter
-RESID_PP_FILTERSTRING_FILTER_TOOLTIP=The filter that contains this filter string
-
-RESID_PP_FILTERSTRING_FILTERPOOL_LABEL=Parent filter pool
-RESID_PP_FILTERSTRING_FILTERPOOL_TOOLTIP=The filter pool that contains the filter with this filter string
-
-RESID_PP_FILTERSTRING_PROFILE_LABEL=Parent profile
-RESID_PP_FILTERSTRING_PROFILE_TOOLTIP=The profile that contains the filter pool with this filter string's filter
-
-#=============================================================
-# SUBSYSTEMFACTORY PROPERTIES PAGE...
-#=============================================================
-RESID_PP_SUBSYSFACTORY_VERBIAGE=A subsystem factory is responsible for creating and owning subsystem instances, one per connection typically. They may also contain, per profile, team-sharable artifacts.
-
-RESID_PP_SUBSYSFACTORY_ID_LABEL=Identifier
-RESID_PP_SUBSYSFACTORY_ID_TOOLTIP=Unique identifier for this subsystem factory
-
-RESID_PP_SUBSYSFACTORY_VENDOR_LABEL=Vendor
-RESID_PP_SUBSYSFACTORY_VENDOR_TOOLTIP=Vendor who created this subsystem factory
-
-RESID_PP_SUBSYSFACTORY_TYPES_LABEL=System types
-RESID_PP_SUBSYSFACTORY_TYPES_TOOLTIP=System types supported by this factory
-
-#=============================================================
-# NEW FILTER WIZARD...
-#=============================================================
-RESID_NEWFILTER_TITLE=New Filter
-RESID_NEWFILTER_PAGE_TITLE=Filter
-# PAGE 1 OF NEW FILTER WIZARD...
-RESID_NEWFILTER_PAGE1_DESCRIPTION=Create a new filter
-# PAGE 2 OF NEW FILTER WIZARD...
-RESID_NEWFILTER_PAGE2_DESCRIPTION=Name the new filter
-RESID_NEWFILTER_PAGE2_NAME_VERBIAGE=Filters are saved for easy re-use. Specify a unique name for this filter. This name will appear in the Remote Systems view, and will be expandable.
-RESID_NEWFILTER_PAGE2_POOL_VERBIAGE=Filters are created in filter pools, which are re-usable in multiple connections. Select the pool to create this filter in. The pool names are qualified by their profile name.
-RESID_NEWFILTER_PAGE2_PROFILE_VERBIAGE=Select a profile to own the new filter. This determines if it is unique to you, or sharable by the team. It will be placed in the default filter pool for that profile.
-RESID_NEWFILTER_PAGE2_POOL_VERBIAGE_TIP=Tip: too many filters? Turn on "Show filter pools in Remote Systems view". Select Preferences from the Window pulldown, then Remote Systems
-
-# PAGE 3 OF NEW FILTER WIZARD...
-RESID_NEWFILTER_PAGE3_DESCRIPTION=Additional Information
-RESID_NEWFILTER_PAGE3_STRINGS_VERBIAGE=Tip: Filters can contain multiple filter strings, although this wizard only prompts for one. To add more filter strings, select the filter in the Remote Systems view and select Properties from its pop-up menu.
-RESID_NEWFILTER_PAGE3_POOLS_VERBIAGE=Tip: Too many filters? Turn on "Show filter pools in Remote Systems view." Select Preferences from the Window pulldown, then Remote Systems.
-
-#=============================================================
-# CHANGE SYSTEM FILTER DIALOG...
-#=============================================================
-RESID_CHGFILTER_TITLE=Change System Filter
-RESID_CHGFILTER_LIST_NEWITEM=New filter string
-RESID_CHGFILTER_NAME_LABEL=Filter name:
-RESID_CHGFILTER_NAME_TOOLTIP=Name for this filter. A filter is a named collection of filter strings
-RESID_CHGFILTER_POOL_LABEL=Parent filter pool:
-RESID_CHGFILTER_POOL_TOOLTIP=Filter pool in which this filter exists
-RESID_CHGFILTER_LIST_LABEL=Filter strings:
-RESID_CHGFILTER_LIST_TOOLTIP=Strings to filter by. Use the pop-up menu for additional actions
-RESID_CHGFILTER_FILTERSTRING_LABEL=Selected filter string:
-RESID_CHGFILTER_FILTERSTRING_TOOLTIP=Edit the filter string and press Apply to change it in the list
-RESID_CHGFILTER_NEWFILTERSTRING_LABEL=New filter string:
-RESID_CHGFILTER_NEWFILTERSTRING_TOOLTIP=Specify the new filter string, then press Create to add it to this filter
-RESID_CHGFILTER_BUTTON_TEST_LABEL=Test
-RESID_CHGFILTER_BUTTON_TEST_TOOLTIP=Press to test the currently selected filter string
-RESID_CHGFILTER_BUTTON_APPLY_LABEL=Apply
-RESID_CHGFILTER_BUTTON_APPLY_TOOLTIP=Press to apply the changes to the currently selected filter string
-RESID_CHGFILTER_BUTTON_REVERT_LABEL=Revert
-RESID_CHGFILTER_BUTTON_REVERT_TOOLTIP=Press to revert to the last saved values for the currently selected filter string
-
-#=============================================================
-# CREATE UNNAMED FILTER DIALOG...
-#=============================================================
-RESID_CRTFILTER_TITLE=Create Filter
-
-
-#=============================================================
-# NEW FILTER STRING ACTION AND WIZARD...
-#=============================================================
-RESID_FILTERSTRING_STRING_LABEL=Filter string:
-RESID_FILTERSTRING_STRING_TIP=Enter a filter string
-
-
-#=============================================================
-# TEST FILTER STRING DIALOG...
-#=============================================================
-RESID_TESTFILTERSTRING_TITLE=Test Filter String
-RESID_TESTFILTERSTRING_PROMPT_LABEL=Filter string:
-RESID_TESTFILTERSTRING_PROMPT_TOOLTIP=Filter string being tested
-
-
-#=============================================================
-# PROMPT FOR PASSWORD DIALOG...
-#=============================================================
-RESID_PASSWORD_TITLE = Enter Password
-RESID_PASSWORD_LABEL = Password
-RESID_PASSWORD_LABEL_OPTIONAL=Password (optional)
-RESID_PASSWORD_TIP = Enter password for connecting to this host
-RESID_PASSWORD_SYSTEMTYPE_LABEL=System type
-RESID_PASSWORD_HOSTNAME_LABEL=Host name
-RESID_PASSWORD_USERID_LABEL = User ID
-RESID_PASSWORD_USERID_TIP = Enter user ID for connecting to this host
-RESID_PASSWORD_USERID_ISPERMANENT_LABEL = Save user ID
-RESID_PASSWORD_USERID_ISPERMANENT_TIP = Save the user ID for later use when connecting to this host
-RESID_PASSWORD_SAVE_LABEL = Save password
-RESID_PASSWORD_SAVE_TOOLTIP = Save the password for later use when connecting to this host with this user ID
-
-#=============================================================
-# CHANGE PASSWORD DIALOG...
-#=============================================================
-RESID_CHANGE_PASSWORD_TITLE=Change password
-RESID_CHANGE_PASSWORD_NEW_LABEL=New password:
-RESID_CHANGE_PASSWORD_NEW_TOOLTIP=Enter your new password
-RESID_CHANGE_PASSWORD_OLD_LABEL=Old password:
-RESID_CHANGE_PASSWORD_OLD_TOOLTIP=Enter your old password
-RESID_CHANGE_PASSWORD_CONFIRM_LABEL=Re-enter to confirm:
-RESID_CHANGE_PASSWORD_CONFIRM_TOOLTIP=Enter your new password again to confirm it
-
-#=============================================================
-# SELECT FILTER POOL DIALOG...
-#=============================================================
-RESID_SELECTFILTERPOOLS_TITLE=Select Filter Pools
-RESID_SELECTFILTERPOOLS_PROMPT=Select filter pools to include in this connection
-
-#=============================================================
-# WORK WITH FILTER POOLS DIALOG...
-#=============================================================
-RESID_WORKWITHFILTERPOOLS_TITLE=Work With Filter Pools
-RESID_WORKWITHFILTERPOOLS_PROMPT=Work with filter pools
-
-#=============================================================
-# WORK WITH HISTORY DIALOG...
-#=============================================================
-RESID_WORKWITHHISTORY_TITLE=Work With History
-RESID_WORKWITHHISTORY_VERBIAGE=Remove or re-order history for this GUI control
-RESID_WORKWITHHISTORY_PROMPT=History
-RESID_WORKWITHHISTORY_BUTTON_TIP=Bring up the Work With History dialog
-
-#=============================================================
-# Team View
-#=============================================================
-RESID_TEAMVIEW_SUBSYSFACTORY_VALUE=SubSystem factory
-RESID_TEAMVIEW_CATEGORY_VALUE=Category
-RESID_TEAMVIEW_PROPERTYSET_VALUE=Property set
-
-
-RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL=Connections
-RESID_TEAMVIEW_CATEGORY_CONNECTIONS_TOOLTIP=Lists all connections in this profile
-
-RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_LABEL=Filter pools
-RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP=Lists all filter pools and filters in this profile, per subsystem type that contains them.
-
-RESID_TEAMVIEW_CATEGORY_PROPERTYSET_LABEL=Property sets
-RESID_TEAMVIEW_CATEGORY_PROPERTYSET_TOOLTIP=Lists all property sets in this profile
-
-#=============================================================
-# Specific actions. All actions support:
-# .label for button/menu-item text
-# .tooltip for hover help on pushbuttons
-#=============================================================
-##############################################################
-# ACTION LABELS AND DESCRIPTIONS...
-##############################################################
-ACTION_CASCADING_NEW_LABEL=New
-ACTION_CASCADING_NEW_TOOLTIP=Create a new resource
-
-ACTION_CASCADING_GOTO_LABEL=Go To
-ACTION_CASCADING_GOTO_TOOLTIP=Replace view with previous contents
-
-ACTION_CASCADING_GOINTO_LABEL=Go Into
-ACTION_CASCADING_GOINTO_TOOLTIP=Replace view with children of selected resource. Use Go To to return
-
-ACTION_CASCADING_OPEN_LABEL=Open
-ACTION_CASCADING_OPEN_TOOLTIP=Open in editor
-
-ACTION_CASCADING_OPENWITH_LABEL=Open With
-ACTION_CASCADING_OPENWITH_TOOLTIP=Open new view
-
-ACTION_CASCADING_WORKWITH_LABEL=Work With
-ACTION_CASCADING_WORKWITH_TOOLTIP=Work with resources
-
-ACTION_CASCADING_REMOTESERVERS_LABEL=Remote Servers
-ACTION_CASCADING_REMOTESERVERS_TOOLTIP=Start or stop a server/daemon on the remote system
-ACTION_REMOTESERVER_START_LABEL=Start
-ACTION_REMOTESERVER_START_TOOLTIP=Start this server/daemon on the remote system
-ACTION_REMOTESERVER_STOP_LABEL=Stop
-ACTION_REMOTESERVER_STOP_TOOLTIP=Stop this server/daemon on the remote system
-
-ACTION_CASCADING_EXPAND_TO_LABEL=Expand To
-ACTION_CASCADING_EXPAND_TO_TOOLTIP=Expand children with subsetting criteria
-
-ACTION_CASCADING_VIEW_LABEL=View
-ACTION_CASCADING_VIEW_TOOLTIP=Set viewing options
-
-ACTION_CASCADING_PREFERENCES_LABEL=Preferences
-ACTION_CASCADING_PREFERENCES_TOOLTIP=Go to the appropriate preferences page
-
-ACTION_CASCADING_PULLDOWN_LABEL=Profile actions
-ACTION_CASCADING_PULLDOWN_TOOLTIP=Remote system profile actions
-
-ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_LABEL=Filter Pool Reference
-ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_TOOLTIP=Add new reference to existing filter pool
-
-ACTION_TEAM_RELOAD_LABEL=Reload Remote System Explorer
-ACTION_TEAM_RELOAD_TOOLTIP=Reload the Remote System Explorer contents, after synchronizing with a shared repository
-
-ACTION_PROFILE_MAKEACTIVE_LABEL=Make Active
-ACTION_PROFILE_MAKEACTIVE_TOOLTIP=Make the selected profile(s) active, so its connections, filters and so on are visible in the Remote Systems view.
-
-ACTION_PROFILE_MAKEINACTIVE_LABEL=Make Inactive
-ACTION_PROFILE_MAKEINACTIVE_TOOLTIP=Make the selected profile(s) inactive, so its connections, filters and so on are not visible in the Remote Systems view.
-
-ACTION_PROFILE_COPY_LABEL=Duplicate...
-ACTION_PROFILE_COPY_TOOLTIP=Create a copy of this profile, with a new name. Copies all connections, filters, user actions and compile commands.
-
-ACTION_NEWPROFILE_LABEL=Profile...
-ACTION_NEWPROFILE_TOOLTIP=Create a new profile
-
-ACTION_NEW_PROFILE_LABEL=New Profile...
-ACTION_NEW_PROFILE_TOOLTIP=Create a new profile
-
-ACTION_QUALIFY_CONNECTION_NAMES_LABEL=Qualify Connection Names
-ACTION_QUALIFY_CONNECTION_NAMES_TOOLTIP=Show connection and filter pool names qualified by their profile name
-
-ACTION_RESTORE_STATE_PREFERENCE_LABEL=Restore Previous State
-ACTION_RESTORE_STATE_PREFERENCE_TOOLTIP=If selected, the tree is re-expanded to its previous state, upon startup
-
-ACTION_PREFERENCE_SHOW_FILTERPOOLS_LABEL=Show Filter Pools
-ACTION_PREFERENCE_SHOW_FILTERPOOLS_TOOLTIP=Show filter pools when expanding subsystems
-
-ACTION_SHOW_PREFERENCEPAGE_LABEL=Remote Systems...
-ACTION_SHOW_PREFERENCEPAGE_TOOLTIP=Go to the Remote Systems primary preferences page
-
-ACTION_NEWCONN_LABEL=New Connection...
-ACTION_NEWCONN_TOOLTIP=Define a connection to remote system
-
-ACTION_ANOTHERCONN_LABEL=Connection...
-ACTION_ANOTHERCONN_TOOLTIP=Define another connection to the same or another remote system
-
-ACTION_UPDATEFILTER_LABEL=Change...
-ACTION_UPDATEFILTER_TOOLTIP=Change this filter's name or contents
-
-ACTION_TESTFILTERSTRING_LABEL=Test
-ACTION_TESTFILTERSTRING_TOOLTIP=Test this filter string by resolving it
-
-ACTION_NEWFILTER_LABEL=Filter...
-ACTION_NEWFILTER_TOOLTIP=Create new filter for this filter pool
-
-ACTION_NEWFILTERPOOL_LABEL=Filter Pool...
-ACTION_NEWFILTERPOOL_TOOLTIP=Create new pool to hold filters
-
-ACTION_RMVFILTERPOOLREF_LABEL=Remove Reference
-ACTION_RMVFILTERPOOLREF_TOOLTIP=Remove filter pool reference
-
-ACTION_SELECTFILTERPOOLS_LABEL=Select Filter Pools...
-ACTION_SELECTFILTERPOOLS_TOOLTIP=Add or remove filter pool references
-
-
-RESID_NEWFILTER_PAGE2_NAME_LABEL=Filter name:
-RESID_NEWFILTER_PAGE2_NAME_TOOLTIP=Enter a unique name for this filter, to show in the Remote Systems view
-RESID_NEWFILTER_PAGE2_PROFILE_LABEL=Owner profile:
-RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP=Select the profile whose default filter pool is to contain the new filter
-RESID_NEWFILTER_PAGE2_POOL_LABEL=Parent filter pool:
-RESID_NEWFILTER_PAGE2_POOL_TOOLTIP=Select the filter pool in which this filter will be created
-RESID_NEWFILTER_PAGE2_UNIQUE_LABEL=Only create filter in this connection
-RESID_NEWFILTER_PAGE2_UNIQUE_TOOLTIP=Select to create filter in this connection only, de-select to create filter in all applicable connections
-
-
-ACTION_WORKWITH_FILTERPOOLS_LABEL=Filter Pools...
-ACTION_WORKWITH_FILTERPOOLS_TOOLTIP=Create or manage filter pools
-
-ACTION_WORKWITH_WWFILTERPOOLS_LABEL=Work With Filter Pools...
-ACTION_WORKWITH_WWFILTERPOOLS_TOOLTIP=Create or manage filter pools
-
-
-ACTION_WORKWITH_PROFILES_LABEL=Work With Profiles
-ACTION_WORKWITH_PROFILES_TOOLTIP=Switch to the Team view to work with profiles
-
-ACTION_RUN_LABEL=Run
-ACTION_RUN_TOOLTIP=Run this prompt. Same as expanding it
-
-
-ACTION_REFRESH_ALL_LABEL=Refresh All
-ACTION_REFRESH_ALL_TOOLTIP=Refresh all resource information
-
-ACTION_REFRESH_LABEL=Re&fresh
-ACTION_REFRESH_TOOLTIP=Refresh information of selected resource
-
-ACTION_REFRESH_TABLE_LABLE=Refresh
-ACTION_REFRESH_TABLE_TOOLTIP=Refresh the contents of the table
-
-
-ACTION_DELETE_LABEL=Delete...
-ACTION_DELETE_TOOLTIP=Prompts for confirmation to delete selected resources
-
-ACTION_RENAME_LABEL=Rena&me...
-ACTION_RENAME_TOOLTIP=Rename selected resources
-
-ACTION_NEWFILE_LABEL=File
-ACTION_NEWFILE_TOOLTIP=Create a new File
-
-ACTION_CLEAR_LABEL=Clear
-ACTION_CLEAR_TOOLTIP=Clear the default value for the selected key
-
-ACTION_CLEAR_ALL_LABEL=Remove All From View
-ACTION_CLEAR_ALL_TOOLTIP=Remove all items from the view
-
-ACTION_CLEAR_SELECTED_LABEL=Remove Selected From View
-ACTION_CLEAR_SELECTED_TOOLTIP=Remove the selection from the view
-
-ACTION_MOVEUP_LABEL=Move Up
-ACTION_MOVEUP_TOOLTIP=Move selected resources up by one
-
-ACTION_MOVEDOWN_LABEL=Move Down
-ACTION_MOVEDOWN_TOOLTIP=Move selected resources down by one
-
-ACTION_MOVEUPLEVEL_TOOLTIP=Move selected resources up one level
-
-ACTION_GOUPLEVEL_TOOLTIP=Go up one level
-
-ACTION_CONNECT_LABEL=Connect...
-ACTION_CONNECT_TOOLTIP=Connect to remote subsystem
-
-ACTION_CLEARPASSWORD_LABEL=Clear Password
-ACTION_CLEARPASSWORD_TOOLTIP=Clear password from memory and disk
-
-ACTION_DISCONNECT_LABEL=Disconnect
-ACTION_DISCONNECT_TOOLTIP=Disconnect from remote subsystem
-
-ACTION_DISCONNECTALLSUBSYSTEMS_LABEL=Disconnect
-ACTION_DISCONNECTALLSUBSYSTEMS_TOOLTIP=Disconnect all subsystems
-
-ACTION_CONNECT_ALL_LABEL=Connect
-ACTION_CONNECT_ALL_TOOLTIP=Connect all subsystems
-
-ACTION_CLEARPASSWORD_ALL_LABEL=Clear Passwords
-ACTION_CLEARPASSWORD_ALL_TOOLTIP=Clear passwords from memory and disk for all subsystems
-
-ACTION_SET_LABEL=Set
-ACTION_SET_TOOLTIP=Set the default value for the selected key
-
-ACTION_HISTORY_DELETE_LABEL=Remove
-ACTION_HISTORY_DELETE_TOOLTIP=Remove this item from the history
-
-ACTION_HISTORY_CLEAR_LABEL=Clear
-ACTION_HISTORY_CLEAR_TOOLTIP=Clear all items in this widget's history
-
-ACTION_HISTORY_MOVEUP_LABEL=Move Up
-ACTION_HISTORY_MOVEUP_TOOLTIP=Move selected item up in history
-
-ACTION_HISTORY_MOVEDOWN_LABEL=Move Down
-ACTION_HISTORY_MOVEDOWN_TOOLTIP=Move selected item down in history
-
-ACTION_HISTORY_MOVEFORWARD_LABEL=Move Forward
-ACTION_HISTORY_MOVEFORWARD_TOOLTIP=Move to the next item in history
-
-ACTION_HISTORY_MOVEBACKWARD_LABEL=Move Backward
-ACTION_HISTORY_MOVEBACKWARD_TOOLTIP=Move to the previous item in history
-
-ACTION_COPY_LABEL=Copy
-ACTION_COPY_TOOLTIP=Copy selected resources to same or different parent
-
-ACTION_CUT_LABEL=Cut
-ACTION_CUT_TOOLTIP=Copy selection to clipboard and delete
-
-ACTION_UNDO_LABEL=Undo
-ACTION_UNDO_TOOLTIP=Undo previous edit action
-
-ACTION_PASTE_LABEL=Paste
-ACTION_PASTE_TOOLTIP=Copy clipboard contents
-
-ACTION_COPY_CONNECTION_LABEL=Copy...
-ACTION_COPY_CONNECTION_TOOLTIP=Copy selected connection to same or different profile
-
-ACTION_COPY_FILTERPOOL_LABEL=Copy...
-ACTION_COPY_FILTERPOOL_TOOLTIP=Copy selected filter pool to same or different profile
-
-ACTION_COPY_FILTER_LABEL=Copy...
-ACTION_COPY_FILTER_TOOLTIP=Copy selected filter to same or different filter pool
-
-ACTION_COPY_FILTERSTRING_LABEL=Copy
-ACTION_COPY_FILTERSTRING_TOOLTIP=Copy selected filter string to same or different filter
-
-ACTION_MOVE_LABEL=Move...
-ACTION_MOVE_TOOLTIP=Move selected resources to a different parent
-
-ACTION_MOVE_CONNECTION_LABEL=Move...
-ACTION_MOVE_CONNECTION_TOOLTIP=Move selected connection to a different profile
-
-ACTION_MOVE_FILTERPOOL_LABEL=Move...
-ACTION_MOVE_FILTERPOOL_TOOLTIP=Move selected filter pool to a different profile
-
-ACTION_MOVE_FILTER_LABEL=Move...
-ACTION_MOVE_FILTER_TOOLTIP=Move selected filter to a different filter pool
-
-ACTION_MOVE_FILTERSTRING_LABEL=Move...
-ACTION_MOVE_FILTERSTRING_TOOLTIP=Move selected filter string to a different filter
-
-ACTION_TABLE_LABEL=Show in Table
-ACTION_TABLE_TOOLTIP=Display the contents of this resource in a table
-
-ACTION_MONITOR_LABEL=Monitor
-ACTION_MONITOR_TOOLTIP=Display the contents of this resource in a monitoring table
-
-ACTION_SEARCH_LABEL=Search...
-ACTION_SEARCH_TOOLTIP=Opens a dialog to search for text and files
-
-ACTION_CANCEL_SEARCH_LABEL=Cancel Search
-ACTION_CANCEL_SEARCH_TOOLTIP=Terminate search operation
-
-ACTION_LOCK_LABEL=Lock
-ACTION_LOCK_TOOLTIP=Disable the change of view input from another view.
-
-ACTION_UNLOCK_LABEL=Unlock
-ACTION_UNLOCK_TOOLTIP=Enable the change of view input from another view.
-
-ACTION_POSITIONTO_LABEL=Position To...
-ACTION_POSITIONTO_TOOLTIP=Specify objects for the view to scroll to and select
-
-ACTION_SUBSET_LABEL=Subset...
-ACTION_SUBSET_TOOLTIP=Specify objects for the view to show
-
-ACTION_PRINTLIST_LABEL=Print...
-ACTION_PRINTLIST_TOOLTIP=Print the current table
-
-ACTION_SELECTCOLUMNS_LABEL=Customize Table...
-ACTION_SELECTCOLUMNS_TOOLTIP=Select columns to display in the table
-
-ACTION_OPENEXPLORER_DIFFPERSP2_LABEL=Open in New Window
-ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP=Open a new workbench window, with the Remote Systems view rooted at this resource
-
-ACTION_EXPAND_SELECTED_LABEL=Expand
-ACTION_EXPAND_SELECTED_TOOLTIP=Expand selected elements. '+'
-
-ACTION_COLLAPSE_SELECTED_LABEL=Collapse
-ACTION_COLLAPSE_SELECTED_TOOLTIP=Collapse selected elements. '-'
-
-ACTION_COLLAPSE_ALL_LABEL=Collapse All
-ACTION_COLLAPSE_ALL_TOOLTIP=Collapse whole tree. Ctrl+-
-
-ACTION_EXPAND_ALL_LABEL=All
-ACTION_EXPAND_ALL_TOOLTIP=Show all contents
-
-ACTION_SELECT_ALL_LABEL=Select All
-ACTION_SELECT_ALL_TOOLTIP=Select all child elements. '+'
-
-ACTION_SELECT_INPUT_LABEL=Select Input...
-ACTION_SELECT_INPUT_DLG=Select Input
-ACTION_SELECT_INPUT_TOOLTIP=Select the input for the view
-
-
-
-#==============================================================
-# Signon Information Preferences Page
-#==============================================================
-RESID_PREF_SIGNON_HOSTNAME_TITLE= Host Name
-RESID_PREF_SIGNON_HOSTNAME_LABEL= Host name:
-RESID_PREF_SIGNON_HOSTNAME_TOOLTIP= Hostname or IP address of target system
-
-RESID_PREF_SIGNON_SYSTYPE_TITLE= System Type
-RESID_PREF_SIGNON_SYSTYPE_LABEL= System type:
-RESID_PREF_SIGNON_SYSTYPE_TOOLTIP= System type for the remote system
-
-RESID_PREF_SIGNON_USERID_TITLE= User ID
-RESID_PREF_SIGNON_USERID_LABEL= User ID:
-RESID_PREF_SIGNON_USERID_TOOLTIP= User ID used to signon to the remote system
-
-RESID_PREF_SIGNON_ADD_LABEL= Add...
-RESID_PREF_SIGNON_ADD_TOOLTIP= Add a new user ID and password
-
-RESID_PREF_SIGNON_REMOVE_LABEL= Remove
-RESID_PREF_SIGNON_REMOVE_TOOLTIP= Remove the selected user ID and password
-
-RESID_PREF_SIGNON_CHANGE_LABEL= Change...
-RESID_PREF_SIGNON_CHANGE_TOOLTIP= Change the password for the selected user ID
-
-RESID_PREF_SIGNON_PASSWORD_LABEL= Password:
-RESID_PREF_SIGNON_PASSWORD_TOOLTIP= Enter the password for the remote system
-
-RESID_PREF_SIGNON_PASSWORD_VERIFY_LABEL= Verify password:
-RESID_PREF_SIGNON_PASSWORD_VERIFY_TOOLTIP= Re-enter the password for the remote system
-
-RESID_PREF_SIGNON_ADD_DIALOG_TITLE= New Saved Password
-RESID_PREF_SIGNON_CHANGE_DIALOG_TITLE= Change Saved Password
-
-###################################################################################
-######################## Remote Search View ############################
-###################################################################################
-RESID_SEARCH_REMOVE_SELECTED_MATCHES_LABEL= Remove Selected Matches
-RESID_SEARCH_REMOVE_SELECTED_MATCHES_TOOLTIP= Remove selected matches
-RESID_SEARCH_REMOVE_ALL_MATCHES_LABEL= Remove All Matches
-RESID_SEARCH_REMOVE_ALL_MATCHES_TOOLTIP= Remove all matches
-RESID_SEARCH_CLEAR_HISTORY_LABEL= Clear History
-RESID_SEARCH_CLEAR_HISTORY_TOOLTIP= Clear all search results
-
-
-###################################################################################
-############################ Monitor View ############################
-###################################################################################
-RESID_MONITOR_POLL_INTERVAL_LABEL=Wait Interval
-RESID_MONITOR_POLL_INTERVAL_TOOLTIP=Specify how long to wait before refreshing the view
-RESID_MONITOR_POLL_LABEL=Poll
-RESID_MONITOR_POLL_TOOLTIP=Periodically refresh the contents
-RESID_MONITOR_POLL_CONFIGURE_POLLING_LABEL=Poll Configuration
-RESID_MONITOR_POLL_CONFIGURE_POLLING_EXPAND_TOOLTIP=Expand to configure polling
-RESID_MONITOR_POLL_CONFIGURE_POLLING_COLLAPSE_TOOLTIP=Collapse to hide polling controls
-
-###################################################################################
-############################ Work With Compile Commands #####################
-###################################################################################
-
-
-##################################################################################
-############################ Browse menu item ##############################
-##################################################################################
-ACTION_CASCADING_BROWSEWITH_LABEL= Browse With
-ACTION_CASCADING_BROWSEWITH_TOOLTIP= Browse resource
-
-##################################################################################
-############################ Compare menu item #############################
-##################################################################################
-ACTION_CASCADING_COMPAREWITH_LABEL= Compare With
-ACTION_CASCADING_COMPAREWITH_TOOLTIP= Compare remote resources
-##################################################################################
-############################ Replace menu item #############################
-##################################################################################
-ACTION_CASCADING_REPLACEWITH_LABEL= Replace With
-ACTION_CASCADING_REPLACEWITH_TOOLTIP= Remote remote resources with local editions
-
-#=============================================================
-# SELECT REMOTE FILES RE-USABLE WIDGET...
-#=============================================================
-RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_LABEL=Select Types
-RESID_SELECTFILES_SELECTTYPES_BUTTON_ROOT_TOOLTIP=Select file types to filter by
-RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL=Select All
-RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_TOOLTIP=Select all files
-RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_LABEL=Deselect All
-RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_TOOLTIP=Deselect all files
-
-
-
-
-# Additions May 15, 2003
-
-##################################################################################
-############################ Offline Support #########################
-##################################################################################
-RESID_OFFLINE_LABEL= Offline
-RESID_OFFLINE_WORKOFFLINE_LABEL= Work Offline
-RESID_OFFLINE_WORKOFFLINE_TOOLTIP= Switch the connection between offline and online modes
-
-#=============================================================
-# ENTER OR SELECT FILE DIALOG...
-#=============================================================
-
-
-##===============================
-# Quick Open
-#================================
-
-#=============================================================
-# RE-USABLE COMPOSITE FILE SYSTEM WIDGETS
-#=============================================================
-
-#==========================
-# Generic Editor Actions
-#==========================
-
-
-###################################################################################
-############################ Table View Dlgs ############################
-###################################################################################
-
-
-RESID_TABLE_POSITIONTO_LABEL=Position To
-RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP=Enter the name filter for the objects that the view is to locate
-RESID_TABLE_SUBSET_LABEL=Subset
-RESID_TABLE_SUBSET_ENTRY_TOOLTIP=Enter a filter pattern for the specified property.
-RESID_TABLE_PRINTLIST_TITLE=Remote Systems Details
-
-
-
-RESID_TABLE_SELECT_COLUMNS_LABEL=Customize Table
-RESID_TABLE_SELECT_COLUMNS_TOOLTIP=Select columns to display in the table
-
-RESID_TABLE_SELECT_COLUMNS_ADD_LABEL=Add>
-RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP=Add the selected properties to be displayed as a column in the table
-
-RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL= <Remove
-RESID_TABLE_SELECT_COLUMNS_REMOVE_TOOLTIP=Remove the selected column from the table display
-
-RESID_TABLE_SELECT_COLUMNS_UP_LABEL=Move Up
-RESID_TABLE_SELECT_COLUMNS_UP_TOOLTIP=Move the selected column to the left in the table
-
-RESID_TABLE_SELECT_COLUMNS_DOWN_LABEL=Move Down
-RESID_TABLE_SELECT_COLUMNS_DOWN_TOOLTIP=Move the selected column to the right in the table
-
-RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL=Available contents:
-
-RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL=Displayed contents:
-RESID_TABLE_SELECT_COLUMNS_DESCRIPTION_LABEL=Choose contents to display in the table view.
-
-
-#### connectors and services $$$$
-RESID_PROPERTIES_SERVICES_NAME=Services
-RESID_PROPERTIES_SERVICES_LABEL=Available Services
-RESID_PROPERTIES_SERVICES_TOOLTIP=
-RESID_PROPERTIES_DESCRIPTION_LABEL=Description
-RESID_PROPERTIES_FACTORIES_LABEL=Configuration
-RESID_PROPERTIES_FACTORIES_TOOLTIP=
-RESID_PROPERTIES_PROPERTIES_LABEL=Properties
-RESID_PROPERTIES_PROPERTIES_TOOLTIP=
-
-
-RESID_SERVICESFORM_CONFIGURATION_TOOLTIP=Select the configuration you wish to use to enable this subsystem. A configuration comprises a connector service and a subsystem service.
-RESID_SERVICESFORM_SERVICES_TOOLTIP=Select the elements of your chosen configuration and you can view and edit their properties in the Properties section.
-RESID_SERVICESFORM_CONNECTORSERVICES_TOOLTIP=Select the connector services available to you for this connection and you can view and edit their properties in the Properties section.
-RESID_SERVICESFORM_PROPERTIES_TOOLTIP=Edit the properties of the item selected in the Available Services section by clicking on the property's value.
-
-## Do not show this message again
-RESID_DO_NOT_SHOW_MESSAGE_AGAIN_LABEL = Do not show this message again
-RESID_DO_NOT_SHOW_MESSAGE_AGAIN_TOOLTIP = Select this option if you do not want to see this message again
-RESID_EXPORT_CONNECTION_ACTIONS_TOOLTIP=Export connection definition
-RESID_EXPORT_CONNECTIONS_ACTION_LABEL=Export...
-
-# Strings for Encodings
-RESID_HOST_ENCODING_GROUP_LABEL=Default encoding
-RESID_HOST_ENCODING_SETTING_NOTE=Note:
-RESID_HOST_ENCODING_SETTING_MSG=This setting can only be changed when no subsystem is connected
-RESID_HOST_ENCODING_REMOTE_LABEL=Default from remote system
-RESID_HOST_ENCODING_REMOTE_ENCODING_LABEL=Default from remote system (%1)
-RESID_HOST_ENCODING_REMOTE_TOOLTIP=The default encoding of the platform obtained from the remote system
-RESID_HOST_ENCODING_OTHER_LABEL=Other:
-RESID_HOST_ENCODING_OTHER_TOOLTIP=Specify a different encoding
-RESID_HOST_ENCODING_ENTER_TOOLTIP=Select or enter an encoding
-RESID_IMPORT_CONNECTION_ACTION_LABEL=Import...
-RESID_IMPORT_CONNECTION_ACTION_TOOLTIP=Import connection definition
-RESID_IMPORT_CONNECTION_LABEL_LONG=Import Connection...
-SystemExportConnectionAction_CoreExceptionFound=Core exception found during export.
-SystemExportConnectionAction_Error=Error
-SystemExportConnectionAction_ExportJobName=RSE Connection Export Job
-SystemExportConnectionAction_OverwriteFileCondition=The file {0} already exists. Click OK to overwrite it.
-SystemExportConnectionAction_UnexpectedException=unexpected exception
-SystemExportConnectionAction_Warning=Warning
-SystemExportConnectionAction_WriteProtectedFileCondition=The file {0} is write protected.
-SystemImportConnectionAction_CoreExceptionFound=Core exception found during import.
-SystemImportConnectionAction_Error=Error
-SystemImportConnectionAction_FileNotFoundCondition=File {0} does not exist.
-SystemImportConnectionAction_FileNotReadableCondition=You do not have permission to read file {0}.
-SystemImportConnectionAction_ImportJobName=RSE Connection Import Job
-SystemImportConnectionAction_UnexpectedException=unexpected exception
-SystemTableViewPart_title={0} {1}
-SystemTypeFieldEditor_false=false
-SystemTypeFieldEditor_true=true
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemSortableSelection.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemSortableSelection.java
deleted file mode 100644
index 748778784..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemSortableSelection.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-/**
- * The TreeViewer widget does not seem to guarantee that multiple-selections are
- * returned sorted in order of appearance in the tree. Some action require they be,
- * such as MoveUp and MoveDown. This class captures the information for each selected item
- * and permits sorting via position, using the Arrays helper class in java.util.
- */
-public class SystemSortableSelection implements Comparable
-{
-
- private Object selectedObject;
- private int position;
-
- /**
- * Constructor for SystemSortableSelection
- */
- public SystemSortableSelection(Object selectedObject)
- {
- super();
- this.selectedObject = selectedObject;
- }
-
- /**
- * Get the selected object
- */
- public Object getSelectedObject()
- {
- return selectedObject;
- }
-
- /**
- * Set the position of the selected object within its parent list
- */
- public void setPosition(int position)
- {
- this.position = position;
- }
-
- /**
- * Get the poisition of the selected object within its parent list
- */
- public int getPosition()
- {
- return position;
- }
-
- /**
- * @see Comparable#compareTo(Object)
- */
- public int compareTo(Object other)
- {
- SystemSortableSelection otherSelectableObject = (SystemSortableSelection)other;
- int otherPosition = otherSelectableObject.getPosition();
- if (position < otherPosition)
- return -1;
- else if (position == otherPosition)
- return 0;
- else
- return 1;
- }
-
- public boolean equals(Object other)
- {
- if (!(other instanceof SystemSortableSelection))
- return super.equals(other);
- SystemSortableSelection otherSelectableObject = (SystemSortableSelection)other;
- int otherPosition = otherSelectableObject.getPosition();
- return (position == otherPosition);
- }
-
- /**
- * Convert structured selection into an array of these objects.
- * YOU MUST CALL SET POSITION AFTER FOR EACH ITEM, BEFORE YOU CAN SORT THIS ARRAY!
- */
- public static SystemSortableSelection[] makeSortableArray(IStructuredSelection selection)
- {
- SystemSortableSelection[] array = new SystemSortableSelection[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- array[idx++] = new SystemSortableSelection(i.next());
- return array;
- }
-
- /**
- * IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, THIS WILL SORT THAT ARRAY
- * BY THE POSITION
- */
- public static void sortArray(SystemSortableSelection[] sortableArray)
- {
- Arrays.sort(sortableArray);
- }
-
- /**
- * IF YOU HAVE CALLED SETPOSITION ON EACH ITEM IN THE GIVEN ARRAY, AND CALLED SORTARRAY,
- * THIS CONVERTS INTO A SORTED ARRAY THAT JUST HAS THE ORIGINAL OBJECTS IN IT FROM THE SELECTION LIST.
- */
- public static Object[] getSortedObjects(SystemSortableSelection[] sortedArray, Object[] outputArray)
- {
- //System.out.println("in SystemSortableSelection#getSortedObjects:");
- for (int idx=0;idx<outputArray.length; idx++)
- {
- outputArray[idx] = sortedArray[idx].getSelectedObject();
- //System.out.println("...selected Object: " + outputArray[idx]);
- //System.out.println("...position.......: " + sortedArray[idx].getPosition());
- }
- //System.out.println();
- return outputArray;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemTabFolderLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemTabFolderLayout.java
deleted file mode 100644
index c0693a065..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/SystemTabFolderLayout.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui;
-
-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 SystemTabFolderLayout extends Layout
-{
-
- protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Control [] children = composite.getChildren ();
- int count = children.length;
- int maxWidth = 0, maxHeight = 0;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max (maxWidth, pt.x);
- maxHeight = Math.max (maxHeight, pt.y);
- }
-
- if (wHint != SWT.DEFAULT)
- maxWidth= wHint;
- if (hHint != SWT.DEFAULT)
- maxHeight= hHint;
-
- return new Point(maxWidth, maxHeight);
-
- }
- protected void layout (Composite composite, boolean flushCache) {
- Rectangle rect= composite.getClientArea();
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
-
- // System.out.println("Setting bounds of each page to " + rect);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingBrowseWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingBrowseWithAction.java
deleted file mode 100644
index 64bab9041..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingBrowseWithAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "Browse With->"
- */
-public class SystemCascadingBrowseWithAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor
- */
- public SystemCascadingBrowseWithAction()
- {
- super(SystemResources.ACTION_CASCADING_BROWSEWITH_LABEL,SystemResources.ACTION_CASCADING_BROWSEWITH_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_BROWSEWITH);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingCompareWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingCompareWithAction.java
deleted file mode 100644
index 06257afb8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingCompareWithAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "Compare With->"
- */
-public class SystemCascadingCompareWithAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor
- */
- public SystemCascadingCompareWithAction()
- {
- super(SystemResources.ACTION_CASCADING_COMPAREWITH_LABEL, SystemResources.ACTION_CASCADING_COMPAREWITH_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_COMPAREWITH);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingExpandToAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingExpandToAction.java
deleted file mode 100644
index 32289f390..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingExpandToAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "Expand To->"
- */
-public class SystemCascadingExpandToAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor
- */
- public SystemCascadingExpandToAction()
- {
- super(SystemResources.ACTION_CASCADING_EXPAND_TO_LABEL, SystemResources.ACTION_CASCADING_EXPAND_TO_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_EXPANDTO);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingGoToAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingGoToAction.java
deleted file mode 100644
index 1d1cf45be..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingGoToAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [232355] Go To menu item missing
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewPart;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.framelist.BackAction;
-import org.eclipse.ui.views.framelist.ForwardAction;
-import org.eclipse.ui.views.framelist.FrameList;
-import org.eclipse.ui.views.framelist.UpAction;
-
-
-/**
- * A cascading menu action for "Go To->"
- */
-public class SystemCascadingGoToAction extends SystemBaseSubMenuAction
-{
- //private IAdaptable pageInput;
- //private IMenuManager parentMenuManager;
- private boolean actionsMade = false;
-
- private SystemViewPart fSystemViewPart;
- private BackAction backAction;
- private ForwardAction forwardAction;
- private UpAction upAction;
-
-
- /**
- * Constructor
- */
- public SystemCascadingGoToAction(Shell shell, SystemViewPart systemViewPart)
- {
- super(SystemResources.ACTION_CASCADING_GOTO_LABEL, SystemResources.ACTION_CASCADING_GOTO_TOOLTIP, shell);
- setMenuID(ISystemContextMenuConstants.MENU_GOTO);
- this.fSystemViewPart = systemViewPart;
- // something in ganymede m7 causes the actions of this menu to be lost, therefore must re-create each time
- // FIXME this looks like a hack
- setCreateMenuEachTime(true);
- setPopulateMenuEachTime(true);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_GOTO);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager gotoMenu)
- {
- if (!actionsMade)
- makeActions();
- gotoMenu.add(backAction);
- gotoMenu.add(forwardAction);
- gotoMenu.add(upAction);
- return gotoMenu;
- }
-
- protected void makeActions()
- {
- FrameList frameList = fSystemViewPart.getFrameList();
- backAction = new BackAction(frameList);
- forwardAction = new ForwardAction(frameList);
- upAction = new UpAction(frameList);
-
- actionsMade = true;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingNewAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingNewAction.java
deleted file mode 100644
index 64ee8a336..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingNewAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "New->"
- */
-public class SystemCascadingNewAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor for SystemCascadingNewAction
- */
- public SystemCascadingNewAction()
- {
- super(SystemResources.ACTION_CASCADING_NEW_LABEL, SystemResources.ACTION_CASCADING_NEW_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_NEW);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingOpenWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingOpenWithAction.java
deleted file mode 100644
index c448b530b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingOpenWithAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "Open With->"
- */
-public class SystemCascadingOpenWithAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor
- */
- public SystemCascadingOpenWithAction()
- {
- super(SystemResources.ACTION_CASCADING_OPENWITH_LABEL, SystemResources.ACTION_CASCADING_OPENWITH_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_OPENWITH);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingPulldownMenuAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingPulldownMenuAction.java
deleted file mode 100644
index cf5ed59b1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingPulldownMenuAction.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewPart;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * A cascading menu action for a toolbar, emulating the pulldown menu view parts have.
- */
-public class SystemCascadingPulldownMenuAction
- extends SystemBaseSubMenuAction
- implements IMenuListener, IMenuCreator
-{
-
- private SystemSubMenuManager dropDownMenuMgr;
- private ISelectionProvider sp = null;
-
- /**
- * Constructor
- */
- public SystemCascadingPulldownMenuAction(Shell shell, ISelectionProvider selectionProviderForToolbarActions)
- {
- super(SystemResources.ACTION_CASCADING_PULLDOWN_LABEL, SystemResources.ACTION_CASCADING_PULLDOWN_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID),shell);
- sp = selectionProviderForToolbarActions;
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(false);
- setMenuCreator(this); // this IAction method tells JFace this is a dropdown menu
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- menu.addMenuListener(this);
- menu.setRemoveAllWhenShown(false);
- boolean showConnectionActions = true;
- SystemViewPart.populateSystemViewPulldownMenu(menu, getShell(), showConnectionActions, null, sp);
- return menu;
- }
-
- /**
- * Called when submenu is about to show
- */
- public void menuAboutToShow(IMenuManager ourSubMenu)
- {
- }
-
- //------------------------
- // IMenuCreator methods...
- //------------------------
- /**
- * dispose method comment.
- */
- public void dispose()
- {
- if (dropDownMenuMgr != null)
- {
- dropDownMenuMgr.dispose();
- dropDownMenuMgr = null;
- }
- }
- /**
- * getMenu method comment.
- */
- public Menu getMenu(Control parent)
- {
- if (dropDownMenuMgr == null)
- {
- //dropDownMenuMgr = new MenuManager();
- dropDownMenuMgr = (SystemSubMenuManager)getSubMenu();
- }
- return dropDownMenuMgr.createContextMenu(parent);
- }
- public Menu getMenu(Menu parent)
- {
- //System.out.println("In SystemCascadingPulldownMenuAction#getMenu(Menu)");
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServerBaseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServerBaseAction.java
deleted file mode 100644
index 77d96f92c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServerBaseAction.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This is the base class for actions that populate the "Remote Servers" cascading
- * menu. The actions in this menu cascade again, into Start and Stop actions.
- * These cascading actions are handling automatically by this base class, but when
- * they are run, they call back into abstract methods in this base class, to
- * actually start and stop the remote server/daemon.
- *
- */
-public abstract class SystemCascadingRemoteServerBaseAction extends SystemBaseSubMenuAction implements IMenuListener
-{
- private SystemRemoteServerStartAction startAction;
- private SystemRemoteServerStopAction stopAction;
-
- /**
- * Constructor
- * @deprecated
- */
- public SystemCascadingRemoteServerBaseAction(String label, String tooltip, Shell shell)
- {
- super(label, tooltip, shell);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(false);
- }
-
- /**
- * Populate the submenu for this action. Here is where we add the start and stop actions.
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- startAction = new SystemRemoteServerStartAction(getShell(), this);
- stopAction = new SystemRemoteServerStopAction(getShell(), this);
- startAction.setHelp(getHelpContextId());
- stopAction.setHelp(getHelpContextId());
- menu.add(startAction);
- menu.add(stopAction);
- menu.addMenuListener(this); // we want to know when menu is about to be shown.
- //System.out.println("in populateSubMenu in "+getClass().getName());
- return menu;
- }
-
- /**
- * Called when submenu is about to show.
- * We use this to decide whether to enable/disable the start and stop actions underneath.
- */
- public void menuAboutToShow(IMenuManager subMenu)
- {
- //System.out.println("menuAboutToShow");
- /*
- IStructuredSelection selection = getSelection();
- if( selection == null )
- {
- subMenu.add(new SystemBaseAction("Programming error. Selection is null! ", null));
- return;
- } // end if(nothing is selected)
- */
- if (!isEnabled())
- {
- startAction.setEnabled(false);
- stopAction.setEnabled(false);
- }
- else if (canDetectServerState())
- {
- //System.out.println("in action itself. getSystemConnection() = "+getSystemConnection());
- boolean started = isServerStarted(getSystemConnection());
- //System.out.println("... started? "+started);
- startAction.setEnabled(started);
- stopAction.setEnabled(!started);
- }
- }
- /**
- * This method is an opportunity to decide whether to enable this action or not.
- * Sometimes we can determine if the connection is connected or not, in which case
- * we want to disable this action if the connection is not connected.
- */
- protected boolean shouldEnable(IHost connection)
- {
- return true;
- }
-
- /**
- * Overridable method to tell the base code if you are able to determine dynamically if
- * the server is currently running or not. The default is true, and so {@link #isStarted(IHost)} is
- * called to determine enablement state of the cascading start and stop actions. If you
- * cannot determine this, override this method and return false, and both start and stop
- * will be enabled always.
- * @return true if you have the capability of dynamically determining if this server is running.
- */
- protected boolean canDetectServerState()
- {
- return true;
- }
-
- /**
- * Overridable method to compute if this remote server/daemon is currently running or not.
- * This decides the enablement of the start and stop actions underneath. If there is no way
- * to determine this, return false from {@link #canDetectServerState()}, and ignore this method.
- * @return true if the server is currently running or not.
- */
- protected abstract boolean isServerStarted(IHost connection);
-
- /**
- * Callback from the {@link org.eclipse.rse.internal.ui.actions.SystemRemoteServerStartAction} class
- * that is called when the user selects to start this remote server/daemon.
- * @return true if the remote server was successfully started, false if not.
- */
- public abstract boolean startServer();
-
- /**
- * Callback from the {@link org.eclipse.rse.internal.ui.actions.SystemRemoteServerStartAction} class
- * that is called when the user selects to stop this remote server/daemon.
- * @return true if the remote server was successfully stopped, false if not.
- */
- public abstract boolean stopServer();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServersAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServersAction.java
deleted file mode 100644
index f33fd03bb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingRemoteServersAction.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "Remote Servers->". The actions contributed to the
- * menu must implement the ISystemRemoteServerAction interface.
- * @see org.eclipse.rse.ui.actions.ISystemRemoteServerAction
- */
-public class SystemCascadingRemoteServersAction extends SystemBaseSubMenuAction implements IMenuListener
-{
-
- /**
- * Constructor
- */
- public SystemCascadingRemoteServersAction()
- {
- super(SystemResources.ACTION_CASCADING_REMOTESERVERS_LABEL, SystemResources.ACTION_CASCADING_REMOTESERVERS_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_STARTSERVER);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(false);
- setHelp(RSEUIPlugin.HELPPREFIX+"actnsrsv"); //$NON-NLS-1$
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- menu.addMenuListener(this);
- //System.out.println("in populateSubMenu");
- return menu;
- }
-
- /**
- * Called when submenu is about to show
- */
- public void menuAboutToShow(IMenuManager subMenu)
- {
- //System.out.println("menuAboutToShow");
- IStructuredSelection selection = getSelection();
- if( selection == null )
- {
- subMenu.add(new SystemBaseAction("Programming error. Selection is null! ", null)); //$NON-NLS-1$
- return;
- } // end if(nothing is selected)
- Object firstSelection = selection.getFirstElement();
- IHost conn = null;
- if (firstSelection instanceof IHost)
- conn = (IHost)firstSelection;
- else if (firstSelection instanceof ISubSystem)
- conn = ((ISubSystem)firstSelection).getHost();
-
- // decide whether or not to enable/disable each entry, by letting it decide...
- IAction[] actions = getActions();
- //System.out.println("...how many actions? "+actions.length);
- //System.out.println("...connection null ? "+(conn==null));
- for (int idx=0; idx<actions.length; idx++)
- {
- if (actions[idx] instanceof SystemCascadingRemoteServerBaseAction)
- {
- if (conn != null)
- {
- SystemCascadingRemoteServerBaseAction action = (SystemCascadingRemoteServerBaseAction)actions[idx];
- action.setHost(conn);
- if (conn.isOffline())
- action.setEnabled(false);
- else
- action.setEnabled(action.shouldEnable(conn));
- }
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingReplaceWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingReplaceWithAction.java
deleted file mode 100644
index c86c0ba0e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingReplaceWithAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "Replace With->"
- */
-public class SystemCascadingReplaceWithAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor
- */
- public SystemCascadingReplaceWithAction()
- {
- super(SystemResources.ACTION_CASCADING_REPLACEWITH_LABEL, SystemResources.ACTION_CASCADING_REPLACEWITH_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_REPLACEWITH);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingViewAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingViewAction.java
deleted file mode 100644
index 811808306..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingViewAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-
-/**
- * A cascading menu action for "View->"
- */
-public class SystemCascadingViewAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor
- */
- public SystemCascadingViewAction()
- {
- super(SystemResources.ACTION_CASCADING_VIEW_LABEL, SystemResources.ACTION_CASCADING_VIEW_TOOLTIP, null);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingWorkWithAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingWorkWithAction.java
deleted file mode 100644
index 055be4ccf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCascadingWorkWithAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-
-/**
- * A cascading menu action for "Work With->"
- */
-public class SystemCascadingWorkWithAction extends SystemBaseSubMenuAction
-{
-
- /**
- * Constructor
- */
- public SystemCascadingWorkWithAction()
- {
- super(SystemResources.ACTION_CASCADING_WORKWITH_LABEL, SystemResources.ACTION_CASCADING_WORKWITH_TOOLTIP, null);
- setMenuID(ISystemContextMenuConstants.MENU_WORKWITH);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(true);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- // we don't populate it. SystemView populates it by calling each adapter and letting them populate it.
- return menu;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionCopyString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionCopyString.java
deleted file mode 100644
index c7f5da339..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionCopyString.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-
-
-/**
- * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
- * It is used to copy the selected filter string to the clipboard for subsequent paste.
- */
-public class SystemChangeFilterActionCopyString extends SystemBaseAction
-
-{
- private SystemChangeFilterPane parentDialog;
-
- /**
- * Constructor
- */
- public SystemChangeFilterActionCopyString(SystemChangeFilterPane parentDialog)
- {
- super(SystemResources.ACTION_COPY_FILTERSTRING_LABEL,SystemResources.ACTION_COPY_FILTERSTRING_TOOLTIP,
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
- null);
- allowOnMultipleSelection(false);
- this.parentDialog = parentDialog;
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX+"dufr2000"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking.
- * We intercept to ensure this is isn't the "new" filter string
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- return parentDialog.canCopy();
- }
-
- /**
- * This is the method called when the user selects this action.
- */
- public void run()
- {
- parentDialog.doCopy();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionDeleteString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionDeleteString.java
deleted file mode 100644
index 0f3388eb5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionDeleteString.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
- * It is used to delete the selected filter string
- */
-public class SystemChangeFilterActionDeleteString extends SystemBaseAction
-
-{
-
- private SystemChangeFilterPane parentDialog;
-
- /**
- * Constructor
- */
- public SystemChangeFilterActionDeleteString(SystemChangeFilterPane parentDialog)
- {
- super(SystemResources.ACTION_DELETE_LABEL,SystemResources.ACTION_DELETE_TOOLTIP,
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)
- ,null);
- allowOnMultipleSelection(false);
- this.parentDialog = parentDialog;
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX+"dufr1000"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking.
- * We intercept to ensure this is isn't the "new" filter string
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- return parentDialog.canDelete();
- }
-
- /**
- * This is the method called when the user selects this action.
- */
- public void run()
- {
- parentDialog.doDelete();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringDown.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringDown.java
deleted file mode 100644
index 2fe9949c7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringDown.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
-
-
-/**
- * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
- * It is used to move the selected filter string up by one in the list
- */
-public class SystemChangeFilterActionMoveStringDown extends SystemBaseAction
-{
-
- private SystemChangeFilterPane parentDialog;
-
- /**
- * Constructor
- */
- public SystemChangeFilterActionMoveStringDown(SystemChangeFilterPane parentDialog)
- {
- super(SystemResources.ACTION_MOVEDOWN_LABEL,SystemResources.ACTION_MOVEDOWN_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID),
- null);
- allowOnMultipleSelection(false);
- this.parentDialog = parentDialog;
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- setHelp(RSEUIPlugin.HELPPREFIX+"dufr5000"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking.
- * We intercept to ensure this is isn't the last filter string in the list
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- return parentDialog.canMoveDown();
- }
-
- /**
- * This is the method called when the user selects this action.
- */
- public void run()
- {
- parentDialog.doMoveDown();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringUp.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringUp.java
deleted file mode 100644
index 4de0e8ebf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionMoveStringUp.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
-
-
-/**
- * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
- * It is used to move the selected filter string down by one in the list
- */
-public class SystemChangeFilterActionMoveStringUp extends SystemBaseAction
-{
-
- private SystemChangeFilterPane parentDialog;
-
- /**
- * Constructor
- */
- public SystemChangeFilterActionMoveStringUp(SystemChangeFilterPane parentDialog)
- {
- super(SystemResources.ACTION_MOVEUP_LABEL,SystemResources.ACTION_MOVEUP_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID),
- null);
- allowOnMultipleSelection(false);
- this.parentDialog = parentDialog;
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- setHelp(RSEUIPlugin.HELPPREFIX+"dufr4000"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking.
- * We intercept to ensure this is isn't the fist filter string
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- return parentDialog.canMoveUp();
- }
-
- /**
- * This is the method called when the user selects this action.
- */
- public void run()
- {
- parentDialog.doMoveUp();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionPasteString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionPasteString.java
deleted file mode 100644
index ccf81688f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemChangeFilterActionPasteString.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * The action is used within the Change Filter dialog, in the context menu of the selected filter string.
- * It is used to paste the copied filter string from the clipboard to the list.
- */
-public class SystemChangeFilterActionPasteString extends SystemBaseAction
-{
- private SystemChangeFilterPane parentDialog;
-
- /**
- * Constructor
- */
- public SystemChangeFilterActionPasteString(SystemChangeFilterPane parentDialog)
- {
- super(SystemResources.ACTION_PASTE_LABEL,SystemResources.ACTION_PASTE_TOOLTIP,
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
- null);
- allowOnMultipleSelection(false);
- this.parentDialog = parentDialog;
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX+"dufr3000"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking.
- * We intercept to ensure there is something in the clipboard to copy
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- return parentDialog.canPaste();
- }
-
- /**
- * This is the method called when the user selects this action.
- */
- public void run()
- {
- parentDialog.doPaste();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearAllPasswordsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearAllPasswordsAction.java
deleted file mode 100644
index d93d4985a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearAllPasswordsAction.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Action to clear cached passwords for all subsystems in a connection.
- */
-public class SystemClearAllPasswordsAction extends SystemBaseAction {
-
- /**
- * Constructor.
- * @param shell the parent shell.
- */
- public SystemClearAllPasswordsAction(Shell shell) {
- super(SystemResources.ACTION_CLEARPASSWORD_ALL_LABEL, SystemResources.ACTION_CLEARPASSWORD_ALL_TOOLTIP, shell);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- }
-
- /**
- * @see org.eclipse.rse.ui.actions.SystemBaseAction#checkObjectType(java.lang.Object)
- */
- public boolean checkObjectType(Object selectedObject) {
-
- if (!(selectedObject instanceof IHost)) {
- return false;
- }
- else {
-
- IHost conn = (IHost)selectedObject;
-
- ISubSystem[] subsystems = conn.getSubSystems();
-
- boolean anyOk = false;
-
- for (int i = 0; i < subsystems.length; i++) {
-
- ISubSystem subsystem = subsystems[i];
- IConnectorService system = subsystem.getConnectorService();
-
- anyOk = !system.isConnected() && system.hasPassword(true);
-
- if (anyOk)
- {
- return true;
- }
- }
-
- return anyOk;
- }
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
-
- IHost conn = (IHost)getFirstSelection();
-
- ISubSystem[] subsystems = conn.getSubSystems();
-
- for (int i = 0; i < subsystems.length; i++)
- {
- ISubSystem ss = subsystems[i];
- try
- {
- IConnectorService system = ss.getConnectorService();
-
- if (system.hasPassword(false) || system.hasPassword(true))
- {
- // get the user id
-
- // clear userid/password from memory and fire event
- //DKM and disk now
- system.clearPassword(true, true);
- RSECorePlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(ss,
- ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,
- ss.getHost()));
- }
-
- }
- catch (Exception exc)
- {
- // msg already shown
- }
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearPasswordAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearPasswordAction.java
deleted file mode 100644
index 35a96bcbb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemClearPasswordAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * This is the action for clearing in-memory userId and password cache
- */
-public class SystemClearPasswordAction extends SystemBaseAction
-{
-
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- */
- public SystemClearPasswordAction(Shell shell)
- {
- super(SystemResources.ACTION_CLEARPASSWORD_LABEL, SystemResources.ACTION_CLEARPASSWORD_TOOLTIP, shell);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0049"); //$NON-NLS-1$
- }
-
- /**
- * Override of parent.
- * Called when testing if an action should be enabled based on the current selection.
- * The clear password action can be enabled if the selected object is a subsystem
- * that is not connected and has a password that is saved.
- * @return true if the clear password action can be enabled.
- */
- public boolean checkObjectType(Object obj) {
- boolean result = false;
- if (obj instanceof ISubSystem) {
- ISubSystem subsystem = (ISubSystem) obj;
- IConnectorService cs = subsystem.getConnectorService();
- result = !cs.isConnected() && cs.hasPassword(true);
- }
- return result;
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run()
- {
- ISubSystem ss = (ISubSystem)getFirstSelection();
- try {
- IConnectorService system = ss.getConnectorService();
- system.clearPassword(true, true);
- RSECorePlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(ss,
- ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,
- ss.getHost()));
- }
- catch (Exception exc) {
- // msg already shown
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAction.java
deleted file mode 100644
index 54471566e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The action allows users to collapse the selected nodes in the Remote System Explorer tree view
- */
-public class SystemCollapseAction extends SystemBaseAction {
- /**
- * Constructor
- * @param parent the parent shell for this action
- */
- public SystemCollapseAction(Shell parent) {
- super(SystemResources.ACTION_COLLAPSE_SELECTED_LABEL, SystemResources.ACTION_COLLAPSE_SELECTED_TOOLTIP, parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND);
- setAccelerator('-');
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0024"); //$NON-NLS-1$
- setAvailableOffline(true);
- }
-
- /**
- * We intercept to ensure at least one selected item is collapsable
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- boolean enable = false;
- if ((viewer != null) && (viewer instanceof ISystemTree)) {
- return ((ISystemTree) viewer).areAnySelectedItemsExpanded();
- }
- Iterator e = selection.iterator();
- ISystemViewElementAdapter adapter = null;
- while (!enable && e.hasNext()) {
- Object selectedObject = e.next();
- adapter = getViewAdapter(selectedObject);
- if (adapter != null) {
- if (adapter.hasChildren((IAdaptable)selectedObject)) enable = true;
- }
- }
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- //System.out.println("Inside run of SystemRefreshAction");
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) {
- sr.fireEvent((ISystemResourceChangeListener) viewer, new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null)); //$NON-NLS-1$
- } else
- sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED, null)); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAllAction.java
deleted file mode 100644
index 4f21f7333..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCollapseAllAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The action allows users to collapse the entire Remote System Explorer tree view.
- */
-public class SystemCollapseAllAction extends SystemBaseAction {
- /**
- * Constructor
- * @param parent the shell that is employing this action
- */
- public SystemCollapseAllAction(Shell parent) {
- super(SystemResources.ACTION_COLLAPSE_ALL_LABEL, SystemResources.ACTION_COLLAPSE_ALL_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptorFromIDE(ISystemIconConstants.ICON_IDE_COLLAPSEALL_ID), // D54577
- parent);
- setHoverImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptorFromIDE("elcl16/collapseall.gif")); //$NON-NLS-1$
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND); // should never be used
- setSelectionSensitive(false);
-
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0023"); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | '-');
- }
-
- /**
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- return true;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) {
- sr.fireEvent((ISystemResourceChangeListener) viewer, new SystemResourceChangeEvent("false", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); //$NON-NLS-1$
- } else
- sr.fireEvent(new SystemResourceChangeEvent("false", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonDeleteAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonDeleteAction.java
deleted file mode 100644
index 2645eb373..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonDeleteAction.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [188637] Handle the caught exception in DeleteJob.run when file fails to be deleted
- * Kevin Doyle (IBM) - [196582] ClassCastException when doing copy/paste with Remote Search view open
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- * David McKnight (IBM) - [234030] SystemCommonDeleteAction should not fire delete event if deleting is failed
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.SystemDeleteDialog;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemDeleteTarget;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.model.SystemRemoteElementResourceSet;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * The action that displays the Delete confirmation dialog.There are two ways to use this action:
- * <ol>
- * <li>When invoking from a class that implements ISystemDeleteTarget. In this case, that class
- * will be called back to determine if this action is to be enabled or not, and to do the actual delete for
- * each selected object, after the dialog is dismissed.
- * <li>When used without an ISystemDeleteTarget, in which case you need to call wasCancelled() after
- * running the action, and then do your own delete.
- * </ol>
- * <p>
- *
- * @see org.eclipse.rse.internal.ui.dialogs.SystemDeleteDialog
- */
-public class SystemCommonDeleteAction
- extends SystemBaseDialogAction
-{
- public class DeleteEventRunnable implements Runnable
- {
- private List _localDeletedResources;
- private List _remoteDeletedResources;
- public DeleteEventRunnable(List localDeletedResources, List remoteDeletedResources)
- {
- _localDeletedResources = localDeletedResources;
- _remoteDeletedResources = remoteDeletedResources;
- }
-
- public void run()
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- if (_remoteDeletedResources.size() > 0)
- {
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, _remoteDeletedResources, null, null, null);
- }
- if (_localDeletedResources.size() > 0)
- {
- Object[] localDeleted = _localDeletedResources.toArray();
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(localDeleted, ISystemResourceChangeEvents.EVENT_DELETE_MANY, null/*(getSelectedParent())*/));
- }
- }
- }
-
-
- public class DeleteJob extends Job
- {
- private List _localResources;
- private List _remoteSets;
- public DeleteJob(List localResources, List remoteSets)
- {
- super(SystemResources.ACTION_DELETE_LABEL);
- _localResources = localResources;
- _remoteSets = remoteSets;
- setUser(true);
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- boolean ok = true;
- List localDeletedObjects = new Vector();
- List remoteDeletedObjects = new Vector();
- HashMap objectsToDelete = new HashMap();
-
- // local delete is pretty straight-forward
- for (int l = 0; l < _localResources.size() && ok; l++)
- {
- Object element = _localResources.get(l);
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- try
- {
- ok = adapter.doDelete(getShell(), element, monitor);
- if (ok)
- {
- localDeletedObjects.add(element);
- }
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError(e.getMessage(), e);
- }
- }
- SystemMessageException exception = null;
-
-
- // remote delete is not as straight-forward
- for (int r = 0; r < _remoteSets.size() && ok; r++)
- {
- SystemRemoteElementResourceSet set = (SystemRemoteElementResourceSet)_remoteSets.get(r);
- ISystemViewElementAdapter adapter = set.getViewAdapter();
- try
- {
- for (int i = 0; i < set.size(); i++)
- {
- Object thisObject = set.get(i);
- String objectName = adapter.getName(thisObject);
- objectsToDelete.put(thisObject, objectName);
- remoteDeletedObjects.add(thisObject);
- }
- ok = adapter.doDeleteBatch(getShell(), set.getResourceSet(), monitor);
- }
- catch (SystemMessageException e)
- {
- exception = e;
- ok = false;
- }
- catch (Exception e)
- {
- SystemMessageDialog.displayExceptionMessage(getShell(), e);
- return Status.CANCEL_STATUS;
- }
-
- if (!ok){
- remoteDeletedObjects.clear();
- if (monitor.isCanceled() && set.size() > 1)
- {
- for (int i = 0; i < set.size(); i++)
- {
- Object thisObject = set.get(i);
- if (!(adapter.exists(thisObject)))
- {
- //This object has been deleted
- remoteDeletedObjects.add(thisObject);
- }
- }
- if (remoteDeletedObjects.size() > 0)
- {
- //Get the moved file names
- Object thisObject = remoteDeletedObjects.get(0);
- String deletedFileNames = null;
- //We could not use adapter.getName(thisObject) here since in dstore case, this name has
- //already been changed to "deleted". So we need to remember the object and name map, and
- //find the object name in the map here.
- deletedFileNames = (String)objectsToDelete.get(thisObject);
- for (int i=1; i<(remoteDeletedObjects.size()); i++)
- {
- thisObject = remoteDeletedObjects.get(i);
- deletedFileNames = deletedFileNames + "\n" + (String)objectsToDelete.get(thisObject); //$NON-NLS-1$
- }
- SystemMessage thisMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_DELETE_INTERRUPTED);
- thisMessage.makeSubstitution(deletedFileNames);
- SystemMessageDialog.displayErrorMessage(shell, thisMessage);
- }
- }
- else
- {
- SystemMessageDialog.displayMessage(exception);
- }
- }
-
- }
-
- // start a runnable to do the action refresh events
- DeleteEventRunnable fireEvents = new DeleteEventRunnable(localDeletedObjects, remoteDeletedObjects);
- Display.getDefault().asyncExec(fireEvents);
-
- if (ok)
- return Status.OK_STATUS;
- else
- return Status.CANCEL_STATUS;
- }
-
- }
-
- private String promptLabel;
- private List _setList;
-
- /**
- * Constructor for SystemDeleteAction when using a delete target
- * @param parent The Shell of the parent UI for this dialog
- * @param deleteTarget The UI part that has selectable and deletable parts.
- */
- public SystemCommonDeleteAction(Shell parent, ISystemDeleteTarget deleteTarget)
- {
- super(SystemResources.ACTION_DELETE_LABEL, SystemResources.ACTION_DELETE_TOOLTIP,
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)
- , parent);
- setSelectionProvider(deleteTarget);
- allowOnMultipleSelection(true);
- setProcessAllSelections(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0021"); //$NON-NLS-1$
- _setList = new Vector();
- }
-
- /**
- * Constructor for SystemDeleteAction when not using a delete target
- * @param parent The Shell of the parent UI for this dialog
- */
- public SystemCommonDeleteAction(Shell parent)
- {
- this(parent, null);
- }
-
- /**
- * Specify the text to show for the label prompt. The default is
- * "Delete selected resources?"
- */
- public void setPromptLabel(String text)
- {
- this.promptLabel = text;
- }
-
- private ISystemDeleteTarget getDeleteTarget()
- {
- return (ISystemDeleteTarget)getSelectionProvider();
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- _setList.clear();
- ISystemDeleteTarget deleteTarget = getDeleteTarget();
- if (deleteTarget == null)
- return true;
- else
- return deleteTarget.showDelete() && getDeleteTarget().canDelete();
- }
-
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to create and return
- * the dialog that is displayed by the default run method
- * implementation.
- * <p>
- * If you override run with your own, then
- * simply implement this to return null as it won't be used.
- * @see #run()
- */
- protected Dialog createDialog(Shell shell)
- {
- Object firstSelection = getFirstSelection();
- if (firstSelection != null)
- {
- SystemDeleteDialog dlg = new SystemDeleteDialog(shell);
- if (promptLabel != null)
- dlg.setPromptLabel(promptLabel);
-
- if (getRemoteAdapter(firstSelection) != null)
- {
- String warningMsg = null;
- String warningTip = null;
-
- warningMsg = SystemResources.RESID_DELETE_WARNING_LABEL;
- warningTip = SystemResources.RESID_DELETE_WARNING_TOOLTIP;
- dlg.setWarningMessage(warningMsg,warningTip);
- }
- return dlg;
- }
- else
- {
- return null;
- }
- }
-
-
- /**
- * New method of doing delete where the physical deletion occurs in a job whereas the refresh is done in a runnable
- */
- protected Object getDialogValue(Dialog dlg)
- {
- if (!((SystemDeleteDialog)dlg).wasCancelled() && (getDeleteTarget() != null))
- {
- ISystemDeleteTarget target = getDeleteTarget();
- ISelection selection = target.getSelection();
-
- if (selection instanceof IStructuredSelection)
- {
- // keep track of the current set
- List localSet = new Vector();
-
- // divide up all objects to delete
- IStructuredSelection ssel = (IStructuredSelection)selection;
- Iterator iter = ssel.iterator();
- while (iter.hasNext())
- {
- Object object = iter.next();
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(object);
- if (getRemoteAdapter(object) != null)
- {
- ISubSystem subSystem = adapter.getSubSystem(object);
- // a remote object so add to remote set
- SystemRemoteElementResourceSet set = getSetFor(subSystem, adapter);
- set.addResource(object);
- }
- else
- {
- localSet.add(object);
- }
- }
-
- // do delete for each set
- DeleteJob job = new DeleteJob(localSet, _setList);
- job.schedule();
- }
-
- }
- return null;
- }
-
-
-
-
- protected SystemRemoteElementResourceSet getSetFor(ISubSystem subSystem, ISystemViewElementAdapter adapter) {
- for (int i = 0; i < _setList.size(); i++) {
- SystemRemoteElementResourceSet set = (SystemRemoteElementResourceSet) _setList.get(i);
- if (set.getViewAdapter() == adapter && set.getSubSystem() == subSystem) {
- return set;
- }
- }
-
- // no existing set - create one
- SystemRemoteElementResourceSet newSet = new SystemRemoteElementResourceSet(subSystem, adapter);
- _setList.add(newSet);
- return newSet;
- }
-
-
-
- protected IRunnableContext getRunnableContext(Shell shell)
- {
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc != null)
- {
- return irc;
- }
- else
- {
- irc = new ProgressMonitorDialog(shell);
- RSEUIPlugin.getTheSystemRegistryUI().setRunnableContext(shell, irc);
- return irc;
- }
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonRenameAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonRenameAction.java
deleted file mode 100644
index fd927aea3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonRenameAction.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.SystemRenameDialog;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemRenameTarget;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action that displays the Rename dialog. There are two ways to use this action:
- * <ol>
- * <li>When invoking from a class that implements ISystemRenameTarget. In this case, that class
- * will be called back to determine if this action is to be enabled or not, and to do the actual rename for
- * each selected object, after the dialog is dismissed.
- * <li>When used without an ISystemRenameTarget, in which case you need to call getNewNames() after
- * running the action, and then use the new names to do the rename. This will return null if the dialog
- * was cancelled.
- * </ol>
- * <p>
- * If the input objects do not adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
- * {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter}, then you
- * should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
- * specify a validator that is called to verify the typed new name is valid. Further, to show the type value
- * of the input objects, they should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
- *
- * @see org.eclipse.rse.internal.ui.dialogs.SystemRenameDialog
- * @see org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog
- */
-public class SystemCommonRenameAction extends SystemBaseDialogAction
-
-{
- private ISystemRenameTarget renameTarget;
- private boolean copyCollisionMode = false;
- private String newNames[];
- private ISystemValidator nameValidator;
- private String singleSelectionHelp, multiSelectionHelp, promptLabel, promptTip, verbiage;
-
- /**
- * Constructor when using a rename target
- * @param parent The Shell of the parent UI for this dialog
- * @param target The UI part that has selectable and renamable parts.
- */
- public SystemCommonRenameAction(Shell parent, ISystemRenameTarget target)
- {
- super(SystemResources.ACTION_RENAME_LABEL, SystemResources.ACTION_RENAME_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_RENAME_ID), parent);
- setSelectionProvider(target);
- allowOnMultipleSelection(true);
- setProcessAllSelections(true);
- renameTarget = target;
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0018"); //$NON-NLS-1$
- }
-
- /**
- * Constructor when not using a rename target
- * @param parent The Shell of the parent UI for this dialog
- */
- public SystemCommonRenameAction(Shell parent)
- {
- this(parent, null);
- }
- /**
- * Set the help to use in the dialog when there is a single selection
- */
- public void setDialogSingleSelectionHelp(String helpID)
- {
- this.singleSelectionHelp = helpID;
- }
- /**
- * Set the help to use in the dialog when there are multiple selections
- */
- public void setDialogMultiSelectionHelp(String helpID)
- {
- this.multiSelectionHelp = helpID;
- }
- /**
- * Set the label and tooltip of the prompt, used when only one thing is selected. The default is "New name:"
- */
- public void setSingleSelectPromptLabel(String label, String tooltip)
- {
- this.promptLabel = label;
- this.promptTip = tooltip;
- }
- /**
- * Set the verbiage to show at the top of the table, used when multi things are selected. The default is "Enter a new name for each resource"
- */
- public void setMultiSelectVerbiage(String verbiage)
- {
- this.verbiage = verbiage;
- }
-
- /**
- * Set the validator for the new name,as supplied by the adaptor for name checking.
- * Overrides the default which is to query it from the object's adapter.
- */
- public void setNameValidator(ISystemValidator nameValidator)
- {
- this.nameValidator = nameValidator;
- }
-
- /**
- * Indicate this dialog is the result of a copy/move name collision.
- * Affects the title, verbiage at the top of the dialog, and context help.
- */
- public void setCopyCollisionMode(boolean copyCollisionMode)
- {
- this.copyCollisionMode = copyCollisionMode;
- }
- /**
- * Query if this dialog is the result of a copy/move name collision.
- * Affects the title, verbiage at the top of the dialog, and context help.
- */
- public boolean getCopyCollisionMode()
- {
- return copyCollisionMode;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- * We overload it to call canRename() in the SystemView class.
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- if (renameTarget == null)
- return true;
- else
- return renameTarget.canRename();
- }
-
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to create and return
- * the dialog that is displayed by the default run method
- * implementation.
- * <p>
- * If you override run with your own, then
- * simply implement this to return null as it won't be used.
- * @see #run()
- */
- protected Dialog createDialog(Shell parent)
- {
- IStructuredSelection sel = getSelection();
- // multi-select
- if (sel != null && sel.size() > 1)
- {
- SystemRenameDialog dlg = new SystemRenameDialog(parent);
- if (nameValidator != null)
- dlg.setNameValidator(nameValidator);
- if (multiSelectionHelp != null)
- dlg.setHelp(multiSelectionHelp);
- if (verbiage != null)
- dlg.setVerbiage(verbiage);
- return dlg;
- }
- // single-select
- else if (sel != null && sel.size() == 1)
- {
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(parent);
- if (copyCollisionMode)
- dlg.setCopyCollisionMode(copyCollisionMode);
- if (nameValidator != null)
- dlg.setNameValidator(nameValidator);
- if (singleSelectionHelp != null)
- dlg.setHelp(singleSelectionHelp);
- if ((promptLabel != null) || (promptTip != null))
- dlg.setPromptLabel(promptLabel, promptTip);
- return dlg;
- }
- else
- {
- return null;
- }
- }
-
- /**
- * Required by parent. We use it to actually do the rename by calling doRename
- * in the supplied ISystemRenameTarget, if we are in that mode.
- * As a result, we return null from here.
- * @see #getNewNames()
- */
- protected Object getDialogValue(Dialog dlg)
- {
- newNames = null;
- if (dlg instanceof SystemRenameDialog)
- {
- SystemRenameDialog rnmDlg = (SystemRenameDialog)dlg;
- if (!rnmDlg.wasCancelled())
- {
- newNames = rnmDlg.getNewNames();
- if (renameTarget != null)
- renameTarget.doRename(newNames); // perform the actual renames.
- }
- }
- else
- {
- SystemRenameSingleDialog rnmDlg = (SystemRenameSingleDialog)dlg;
- if (!rnmDlg.wasCancelled())
- {
- String name = rnmDlg.getNewName();
- newNames = new String[1];
- newNames[0] = name;
- if (renameTarget != null)
- renameTarget.doRename(newNames); // perform the actual renames.
- }
- }
- return null;
- }
-
- /**
- * Return the new names entered by the user. You only need to call this when you don't supply a
- * rename target. In this case, it is your responsibility to do the actual renames.
- * @return - array of new names, with the order matching the order of the input selection. Null if dialog cancelled.
- */
- public String[] getNewNames()
- {
- return newNames;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonSelectAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonSelectAllAction.java
deleted file mode 100644
index 9d482c2c1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCommonSelectAllAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * The global action that enables select all.
- * For the RSE tree view, we interpret select all to mean select all the
- * children of the currently selected parent, if applicable.
- */
-public class SystemCommonSelectAllAction
- extends SystemBaseAction
-
-{
- private ISystemSelectAllTarget target;
-
- /**
- * Constructor
- * @param parent The Shell of the parent UI for this dialog
- * @param selProvider The viewer that provides the selections
- * @param target The viewer that is running this action
- */
- public SystemCommonSelectAllAction(Shell parent, ISelectionProvider selProvider, ISystemSelectAllTarget target)
- {
- //super(RSEUIPlugin.getResourceBundle(), ISystemConstants.ACTION_SELECTALL, null, parent); TODO: XLATE!
- super("Select All", (ImageDescriptor)null, parent); //$NON-NLS-1$
- setSelectionProvider(selProvider);
- this.target = target;
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- //setHelp(RSEUIPlugin.HELPPREFIX+"actn0021"); // TODO: ADD HELP!
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- return target.enableSelectAll(selection);
- }
-
- /**
- * This is the method called when the user selects this action.
- */
- public void run()
- {
- target.doSelectAll(getSelection());
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java
deleted file mode 100644
index 4502bd451..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
- * Martin Oberhuber (Wind River) - [149285][ssh] multiple prompts and errors in case of incorrect username
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This is the action for connecting to the remote subsystem
- */
-public class SystemConnectAction extends SystemBaseAction
-{
- public class ConnectJob extends Job
- {
- private ISubSystem _subsystem;
- public ConnectJob(ISubSystem subsystem)
- {
- super(SystemResources.ACTION_CONNECT_LABEL);
- _subsystem = subsystem;
- }
-
-
- public IStatus run(IProgressMonitor monitor)
- {
- try {
- if (_subsystem.getHost().getSystemType().isWindows())
- _subsystem.connect(monitor, false);
- else
- _subsystem.connect(monitor, true);
- }
- catch (OperationCanceledException e) {
- // user cancelled
- return Status.CANCEL_STATUS;
- }
- catch (SystemMessageException e) {
- SystemMessageDialog.displayMessage(e);
- }
- catch (Exception e) {
- SystemBasePlugin.logError(
- e.getLocalizedMessage()!=null ? e.getLocalizedMessage() : e.getClass().getName(),
- e);
- }
- if (monitor.isCanceled())
- {
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
- }
-
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- */
- public SystemConnectAction(Shell shell)
- {
- super(SystemResources.ACTION_CONNECT_LABEL,SystemResources.ACTION_CONNECT_TOOLTIP, shell);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0047"); //$NON-NLS-1$
- }
- /**
- * Override of parent. Called when testing if action should be enabled base on current
- * selection. We check the selected object is one of our subsystems, and we are not
- * already connected.
- */
- public boolean checkObjectType(Object obj)
- {
- if ( !(obj instanceof ISubSystem) ||
- ((ISubSystem)obj).getConnectorService().isConnected() )
- return false;
- else
- return true;
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run()
- {
- ISubSystem ss = (ISubSystem)getFirstSelection();
- ConnectJob job = new ConnectJob(ss);
- job.schedule();
-
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAllSubSystemsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAllSubSystemsAction.java
deleted file mode 100644
index 80a60151e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAllSubSystemsAction.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
- * Martin Oberhuber (Wind River) - [216266] Consider stateless subsystems (supportsSubSystemConnect==false)
- * David McKnight (IBM) - [237970] Subsystem.connect( ) fails for substituting host name when isOffline( ) is true
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This is the action for connecting all subsystems for a given connection.
- */
-public class SystemConnectAllSubSystemsAction extends SystemBaseAction
-{
- public class ConnectAllJob extends Job
- {
- private IHost _connection;
- public ConnectAllJob(IHost connection)
- {
- super(SystemResources.ACTION_CONNECT_ALL_LABEL);
- _connection = connection;
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- List failedSystems = new ArrayList();
- try
- {
- //forced instantiation of all subsystems
- ISubSystem[] subsystems = _connection.getSubSystems();
- for (int i = 0; i < subsystems.length; i++)
- {
- ISubSystem subsystem = subsystems[i];
- IConnectorService system = subsystem.getConnectorService();
- if (!subsystem.isConnected()
- && subsystem.getSubSystemConfiguration().supportsSubSystemConnect()
- && !failedSystems.contains(system))
- {
- try
- {
- subsystem.connect(monitor, false);
- }
- catch (SystemMessageException e) {
- //TODO should we collect all messages and just show one dialog with a MultiStatus?
- failedSystems.add(system);
- SystemMessageDialog.displayMessage(e);
- }
- catch (Exception e) {
- failedSystems.add(system);
- if ((e instanceof InterruptedException) || (e instanceof OperationCanceledException)) {
- // if the user was prompted for password and cancelled
- // or if the connect was interrupted for some other reason
- // we don't attempt to connect the other subsystems
- break;
- }
- SystemBasePlugin.logError(
- e.getLocalizedMessage()!=null ? e.getLocalizedMessage() : e.getClass().getName(),
- e);
- }
- }
- }
- }
- catch (Exception exc)
- {
- } // msg already shown
- if (failedSystems.size() > 0)
- {
- return Status.CANCEL_STATUS;
- }
- else
- {
- return Status.OK_STATUS;
- }
- }
-
- }
-
- private ISystemRegistry sr = null;
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- */
- public SystemConnectAllSubSystemsAction(Shell shell)
- {
- super(SystemResources.ACTION_CONNECT_ALL_LABEL,SystemResources.ACTION_CONNECT_ALL_TOOLTIP, shell);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- sr = RSECorePlugin.getTheSystemRegistry();
- //setHelp(RSEUIPlugin.HELPPREFIX+"actn0022");
- }
- /**
- * Override of parent. Called when testing if action should be enabled base on current
- * selection. We check the selected object is one of our subsystems, and if we are
- * currently connected.
- */
- public boolean checkObjectType(Object obj)
- {
- if ((obj instanceof IHost) &&
- !((IHost)obj).isOffline() &&
- !sr.areAllSubSystemsConnected((IHost)obj))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run()
- {
-
- IHost conn = (IHost)getFirstSelection();
- ConnectAllJob job = new ConnectAllJob(conn);
- job.schedule();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCopyConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCopyConnectionAction.java
deleted file mode 100644
index 6007a80c7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemCopyConnectionAction.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Copy a connection action.
- */
-public class SystemCopyConnectionAction extends SystemBaseCopyAction
-{
- private SystemSimpleContentElement initialSelectionElement = null;
- /**
- * Constructor for SystemCopyConnectionAction
- */
- public SystemCopyConnectionAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_COPY_CONNECTION_LABEL, MODE_COPY);
- setToolTipText(SystemResources.ACTION_COPY_CONNECTION_TOOLTIP);
- sr = RSECorePlugin.getTheSystemRegistry();
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0019"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX+"dccn0000"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We intercept to ensure only connections from the same profile are selected.
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- ISystemProfile prevProfile = null;
- Iterator e= selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof IHost)
- {
- IHost conn = (IHost)selectedObject;
- if (prevProfile == null)
- prevProfile = conn.getSystemProfile();
- else
- enable = (prevProfile == conn.getSystemProfile());
- if (enable)
- prevProfile = conn.getSystemProfile();
- }
- else
- enable = false;
- }
- return enable;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
-
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemProfile profile = (ISystemProfile)targetContainer;
- String newName = oldName;
- IHost match = sr.getHost(profile, oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- //ValidatorConnectionName validator = new ValidatorConnectionName(sr.getConnectionAliasNames(profile));
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- IHost oldConnection = (IHost)oldObject;
- //String oldName = oldConnection.getAliasName();
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"starting to copy "+oldName+" to "+newName);
- ISystemProfile targetProfile = (ISystemProfile)targetContainer;
- IHost newConn = sr.copyHost(oldConnection, targetProfile, newName, monitor);
- return (newConn != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- return getProfileTreeModel(getFirstSelectedConnection().getSystemProfile());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- return SystemResources.RESID_COPY_TARGET_PROFILE_PROMPT;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYCONNECTIONS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage( String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYCONNECTION_PROGRESS).makeSubstitution(oldName);
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedConnections();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- IHost[] conns = getSelectedConnections();
- String[] names = new String[conns.length];
- for (int idx=0; idx<conns.length; idx++)
- names[idx] = conns[idx].getAliasName();
- return names;
- }
-
- /**
- * Get the currently selected connections
- */
- protected IHost[] getSelectedConnections()
- {
- IStructuredSelection selection = getSelection();
- IHost[] conns = new IHost[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- conns[idx++] = (IHost)i.next();
- }
- return conns;
- }
- /**
- * Get the first selected connection
- */
- protected IHost getFirstSelectedConnection()
- {
- return (IHost)getFirstSelection();
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param profile whose tree model element is to be selected
- */
- protected SystemSimpleContentElement getProfileTreeModel(ISystemProfile profile)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Profiles", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemProfile[] profiles = RSECorePlugin.getTheSystemRegistry().getActiveSystemProfiles();
- ImageDescriptor image = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
-
- if (profiles == null)
- return veryRootElement;
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<profiles.length; idx++)
- {
- SystemSimpleContentElement profileElement =
- new SystemSimpleContentElement(profiles[idx].getName(),
- profiles[idx], veryRootElement, (Vector)null);
- profileElement.setRenamable(false);
- profileElement.setDeletable(false);
- profileElement.setImageDescriptor(image);
- veryRootChildren.addElement(profileElement);
- if (profiles[idx] == profile)
- initialSelectionElement = profileElement;
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAction.java
deleted file mode 100644
index ad360f36c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAction.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * This is the action for disconnecting from a remote subsystem.
- */
-public class SystemDisconnectAction extends SystemBaseAction
-{
-
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- */
- public SystemDisconnectAction(Shell shell)
- {
- super(SystemResources.ACTION_DISCONNECT_LABEL, SystemResources.ACTION_DISCONNECT_TOOLTIP, shell);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0048"); //$NON-NLS-1$
- }
- /**
- * Override of parent. Called when testing if action should be enabled based on current
- * selection. We check the selected object is one of our subsystems, and if we are
- * currently connected.
- */
- public boolean checkObjectType(Object obj)
- {
- if ( !(obj instanceof ISubSystem) ||
- !((ISubSystem)obj).getConnectorService().isConnected() )
- return false;
- else
- return true;
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run()
- {
- ISubSystem ss = (ISubSystem)getFirstSelection();
- try {
- ss.disconnect();
- } catch (Exception exc) {} // msg already shown
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAllSubSystemsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAllSubSystemsAction.java
deleted file mode 100644
index aa7b09f6c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemDisconnectAllSubSystemsAction.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [175277] Cannot disconnect multiple connections at once with multiselect
- * David Dykstal (IBM) - [197036] minor refactoring
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This is the action for disconnecting all subsystems for a given connection.
- */
-public class SystemDisconnectAllSubSystemsAction extends SystemBaseAction
-{
-
- private ISystemRegistry sr = null;
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- */
- public SystemDisconnectAllSubSystemsAction(Shell shell)
- {
- super(SystemResources.ACTION_DISCONNECTALLSUBSYSTEMS_LABEL, SystemResources.ACTION_DISCONNECTALLSUBSYSTEMS_TOOLTIP, shell);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- sr = RSECorePlugin.getTheSystemRegistry();
- // TODO help for connect all
- //setHelp(RSEUIPlugin.HELPPREFIX+"actn0022");
- }
-
- private static ISubSystem[] getDisconnectableSubsystems(Object element)
- {
- ISubSystem[] result = null;
- if (element instanceof IHost) {
- IHost host = (IHost)element;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISubSystem[] ss = sr.getSubSystems(host);
- List l = new ArrayList();
- for (int i=0; i<ss.length; i++) {
- if (ss[i].isConnected() && ss[i].getSubSystemConfiguration().supportsSubSystemConnect()) {
- l.add(ss[i]);
- }
- }
- result = (ISubSystem[])l.toArray(new ISubSystem[l.size()]);
- }
- return result;
- }
-
- /**
- * Override of parent. Called when testing if action should be enabled base on current
- * selection. We check the selected object is one of our subsystems, and if we are
- * currently connected.
- */
- public boolean checkObjectType(Object obj)
- {
- if ( !(obj instanceof IHost) ||
- !(sr.isAnySubSystemConnected((IHost)obj) ))
- return false;
- else {
- ISubSystem[] ss = getDisconnectableSubsystems(obj);
- return (ss!=null && ss.length>0);
- }
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run()
- {
- Iterator it = getSelection().iterator();
- while (it.hasNext()) {
- Object item = it.next();
- if (item instanceof IHost) {
- try {
- sr.disconnectAllSubSystems((IHost) item);
- } catch (Exception exc) {} // msg already shown
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExpandAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExpandAction.java
deleted file mode 100644
index 98847930c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExpandAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The action allows users to expand the selected nodes in the Remote System Explorer tree view
- */
-public class SystemExpandAction extends SystemBaseAction {
-
- /**
- * Constructor
- * @param parent the shell that employs this action
- */
- public SystemExpandAction(Shell parent) {
- super(SystemResources.ACTION_EXPAND_SELECTED_LABEL, SystemResources.ACTION_EXPAND_SELECTED_TOOLTIP, parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_EXPAND);
- setAccelerator('+');
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0025"); //$NON-NLS-1$
- setAvailableOffline(true);
- }
-
- /**
- * <p>
- * We intercept to ensure at least one selected item is expandable
- *
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- boolean enable = false;
- if ((viewer != null) && (viewer instanceof ISystemTree)) {
- return ((ISystemTree) viewer).areAnySelectedItemsExpandable();
- }
- Iterator e = selection.iterator();
- ISystemViewElementAdapter adapter = null;
- while (!enable && e.hasNext()) {
- Object selectedObject = e.next();
- adapter = getViewAdapter(selectedObject);
- if (adapter != null) {
- if (adapter.hasChildren((IAdaptable)selectedObject)) enable = true;
- }
- }
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- //System.out.println("Inside run of SystemRefreshAction");
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener)) {
- sr.fireEvent((ISystemResourceChangeListener) viewer, new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_EXPAND_SELECTED, null)); //$NON-NLS-1$
- } else
- sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_EXPAND_SELECTED, null)); //$NON-NLS-1$
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExportConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExportConnectionAction.java
deleted file mode 100644
index d09166d5e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemExportConnectionAction.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Dykstal (IBM) - [216858] provide ability to import and export connections
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.persistence.RSEEnvelope;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.persistence.IRSEPersistenceManager;
-import org.eclipse.rse.persistence.IRSEPersistenceProvider;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-
-import com.ibm.icu.text.MessageFormat;
-
-/**
- * This is the action for exporting a connection to a file.
- */
-public class SystemExportConnectionAction extends SystemBaseAction {
-
- private class ExportJob extends Job {
-
- private File outFile;
- private IHost host;
-
- public ExportJob(IHost host, File outFile) {
- super(SystemResources.SystemExportConnectionAction_ExportJobName);
- this.outFile = outFile;
- this.host = host;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- IRSEPersistenceManager manager = RSECorePlugin.getThePersistenceManager();
- IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider"); //$NON-NLS-1$
- RSEEnvelope envelope = new RSEEnvelope();
- envelope.add(host);
- try {
- FileOutputStream out = new FileOutputStream(outFile);
- envelope.put(out, persistenceProvider, monitor);
- out.close();
- } catch (FileNotFoundException e) {
- // should not happen, log as unexpected
- SystemBasePlugin.logError(SystemResources.SystemExportConnectionAction_UnexpectedException, e);
- } catch (CoreException e) {
- // log the exception and return the status code
- SystemBasePlugin.logError(SystemResources.SystemExportConnectionAction_CoreExceptionFound, e);
- status = e.getStatus();
- } catch (IOException e) {
- // should not happend, log as unexpected
- SystemBasePlugin.logError(SystemResources.SystemExportConnectionAction_UnexpectedException, e);
- }
- return status;
- }
-
- }
-
- /**
- * Constructor.
- */
- public SystemExportConnectionAction() {
- super(SystemResources.RESID_EXPORT_CONNECTIONS_ACTION_LABEL, SystemResources.RESID_EXPORT_CONNECTION_ACTIONS_TOOLTIP, null);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX + "ActionExportConnectionDefinitions"); //$NON-NLS-1$
- }
-
- /**
- * The export connection action is enabled when the selection contains only connections (hosts)
- */
- public boolean checkObjectType(Object obj) {
- boolean result = obj instanceof IHost;
- return result;
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run() {
- FileDialog saveDialog = new FileDialog(shell, SWT.SAVE);
- String path = saveDialog.open();
- if (path != null) {
- File outFile = new File(path);
- boolean ok = true;
- if (outFile.exists()) {
- if (outFile.canWrite()) {
- String title = SystemResources.SystemExportConnectionAction_Warning;
- String message = MessageFormat.format(SystemResources.SystemExportConnectionAction_OverwriteFileCondition, new String[] {path});
- ok = MessageDialog.openConfirm(shell, title, message);
- } else {
- String title = SystemResources.SystemExportConnectionAction_Error;
- String message = MessageFormat.format(SystemResources.SystemExportConnectionAction_WriteProtectedFileCondition, new String[] {path});
- MessageDialog.openError(shell, title, message);
- ok = false;
- }
- }
- if (ok) {
- IStructuredSelection selection = getSelection();
- Assert.isTrue(selection.size() == 1, "selection size should be one"); //$NON-NLS-1$
- IHost host = (IHost) selection.getFirstElement();
- Job exportJob = new ExportJob(host, outFile);
- exportJob.schedule();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java
deleted file mode 100644
index 82c929a7d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceAction.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.ISystemViewMenuListener;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * A cascading menu action for "New Filter Pool Reference->"
- */
-public class SystemFilterCascadingNewFilterPoolReferenceAction
- extends SystemBaseSubMenuAction
- implements IMenuListener
-{
- private ISystemFilterPoolReferenceManager refMgr;
-
- /**
- * Constructor when reference mgr not available. Must call setSystemFilterPoolReferenceManager.
- */
- public SystemFilterCascadingNewFilterPoolReferenceAction(Shell shell)
- {
- this(shell, null);
- }
-
- /**
- * Constructor when reference mgr is available. No need to call setSystemFilterPoolReferenceManager.
- */
- public SystemFilterCascadingNewFilterPoolReferenceAction(Shell shell, ISystemFilterPoolReferenceManager refMgr)
- {
- super(SystemResources.ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_LABEL, SystemResources.ACTION_CASCADING_FILTERPOOL_NEWREFERENCE_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLREF_ID),shell);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- this.refMgr = refMgr;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- menu.addMenuListener(this);
- menu.setRemoveAllWhenShown(true);
- //menu.setEnabled(true);
- menu.add(new SystemBaseAction("dummy",null)); //$NON-NLS-1$
- return menu;
- }
-
- /**
- * Set the master filter pool reference manager from which the filter pools are to be selectable,
- * and into which we will add the filter pool reference
- */
- public void setSystemFilterPoolReferenceManager(ISystemFilterPoolReferenceManager refMgr)
- {
- this.refMgr = refMgr;
- }
-
- /**
- * Called when submenu is about to show
- */
- public void menuAboutToShow(IMenuManager ourSubMenu)
- {
- Shell shell = getShell();
- ISystemFilterPoolManager[] mgrs = refMgr.getSystemFilterPoolManagers();
- SystemFilterCascadingNewFilterPoolReferenceFPMgrAction action = null;
- ISystemFilterPoolManager mgr = null;
- ISystemFilterPoolManager defaultMgr = refMgr.getDefaultSystemFilterPoolManager();
- String helpId = getHelpContextId();
- if (defaultMgr != null)
- {
- action = new SystemFilterCascadingNewFilterPoolReferenceFPMgrAction(shell, defaultMgr, refMgr);
- if (helpId != null)
- action.setHelp(helpId);
- ourSubMenu.add(action.getSubMenu());
- }
- for (int idx=0; idx<mgrs.length; idx++)
- {
- mgr = mgrs[idx];
- if (mgr != defaultMgr)
- {
- action = new SystemFilterCascadingNewFilterPoolReferenceFPMgrAction(shell, mgr, refMgr);
- if (helpId != null)
- action.setHelp(helpId);
- ourSubMenu.add(action.getSubMenu());
- }
- }
- }
-
- /**
- * Overridable method from parent that instantiates the menu listener who job is to add mnemonics.
- * @param setMnemonicsOnlyOnce true if the menu is static and so mnemonics need only be set once. False if it is dynamic
- */
- protected ISystemViewMenuListener createMnemonicsListener(boolean setMnemonicsOnlyOnce)
- {
- return new SystemViewMenuListener(false); // our menu is re-built dynamically each time
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java
deleted file mode 100644
index 8fa6fcc20..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCascadingNewFilterPoolReferenceFPMgrAction.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
-import org.eclipse.rse.ui.actions.ISystemViewMenuListener;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * A cascading submenu action for "New Filter Pool Reference->".
- * This is after the first cascade, where we list filter pool managers.
- */
-public class SystemFilterCascadingNewFilterPoolReferenceFPMgrAction
- extends SystemBaseSubMenuAction
- implements IMenuListener
-{
- private ISystemFilterPoolManager mgr;
- private ISystemFilterPoolReferenceManager refMgr;
-
- /**
- * Constructor.
- */
- public SystemFilterCascadingNewFilterPoolReferenceFPMgrAction(Shell shell,
- ISystemFilterPoolManager mgr,
- ISystemFilterPoolReferenceManager refMgr)
- {
- super(mgr.getName(),shell);
- setCreateMenuEachTime(false);
- setPopulateMenuEachTime(false);
- this.mgr = mgr;
- this.refMgr = refMgr;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * @see SystemBaseSubMenuAction#getSubMenu()
- */
- public IMenuManager populateSubMenu(IMenuManager menu)
- {
- menu.addMenuListener(this);
- menu.setRemoveAllWhenShown(true);
- //menu.setEnabled(true);
- menu.add(new SystemBaseAction("dummy",null)); //$NON-NLS-1$
- return menu;
- }
-
- /**
- * Called when submenu is about to show
- */
- public void menuAboutToShow(IMenuManager ourSubMenu)
- {
- //System.out.println("inside menu about to show");
- ISystemFilterPool[] pools = mgr.getSystemFilterPools();
- SystemFilterPoolReferenceSelectAction action = null;
- ISystemFilterPool pool = null;
- Shell shell = getShell();
- String helpId = getHelpContextId();
- for (int idx=0; idx<pools.length; idx++)
- {
- pool = pools[idx];
- if (!isPoolAlreadyReferenced(pool) && !isPoolConnectionUnique(pool))
- {
- action = new SystemFilterPoolReferenceSelectAction(shell,pool,refMgr);
- if (helpId != null)
- action.setHelp(helpId);
- ourSubMenu.add(action);
- }
- }
- }
-
- /**
- * Determine if the given filter pool is already referenced by this reference manager
- */
- private boolean isPoolAlreadyReferenced(ISystemFilterPool pool)
- {
- return refMgr.isSystemFilterPoolReferenced(pool);
- }
- /**
- * Determine if the given filter pool is the special unique pool for a connection.
- * If so, we don't want to let anyone else reference it.
- */
- private boolean isPoolConnectionUnique(ISystemFilterPool pool)
- {
- return (pool.getOwningParentName() != null);
- }
-
- /**
- * Overridable method from parent that instantiates the menu listener who job is to add mnemonics.
- * @param setMnemonicsOnlyOnce true if the menu is static and so mnemonics need only be set once. False if it is dynamic
- */
- protected ISystemViewMenuListener createMnemonicsListener(boolean setMnemonicsOnlyOnce)
- {
- return new SystemViewMenuListener(false); // our menu is re-built dynamically each time
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterAction.java
deleted file mode 100644
index 0e473997e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterAction.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Copy a filter action.
- */
-public class SystemFilterCopyFilterAction extends SystemBaseCopyAction
-{
- private String promptString = null;
- private SystemSimpleContentElement initialSelectionElement = null;
- private SystemSimpleContentElement root = null;
-
- /**
- * Constructor
- */
- public SystemFilterCopyFilterAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_COPY_FILTER_LABEL, MODE_COPY);
- setToolTipText(SystemResources.ACTION_COPY_FILTER_TOOLTIP);
- promptString = SystemResources.RESID_COPY_PROMPT;
- }
-
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- super.reset();
- initialSelectionElement = null;
- root = null;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- /* */
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof SystemSimpleContentElement)
- selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
- if (!checkObjectType(selectedObject))
- enable = false;
- }
- /* */
- return enable;
- }
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilter)
- {
- ISystemFilter fs = (ISystemFilter)selectedObject;
- return !fs.isNonChangable();
- }
- else if (selectedObject instanceof ISystemFilterReference)
- {
- ISystemFilter fs = ((ISystemFilterReference)selectedObject).getReferencedFilter();
- return !fs.isNonChangable();
- }
- else
- return false;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
- {
- if (selectedElement == null)
- return false;
- Object data = selectedElement.getData();
- return (data instanceof ISystemFilterPool);
- }
-
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
- //ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
- String newName = oldName;
- ISystemFilter match = newPool.getSystemFilter(oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- //ValidatorFilterName validator = new ValidatorFilterName(newPool.getSystemFilterNames());
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- ISystemFilter oldFilter = (ISystemFilter)oldObject;
- ISystemFilterPool oldFilterPool = oldFilter.getParentFilterPool();
- ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
- ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
- //ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
-
- ISystemFilter newFilter = oldMgr.copySystemFilter(newPool, oldFilter, newName);
-
- if ((root != null) && (newFilter!=null))
- {
- Object data = root.getData();
- if ((data!=null) && (data instanceof TreeViewer))
- ((TreeViewer)data).refresh();
- }
- return (newFilter != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- ISystemFilter firstFilter = getFirstSelectedFilter();
- ISystemFilterPoolManagerProvider provider = firstFilter.getProvider();
- return getPoolMgrTreeModel(provider, firstFilter.getSystemFilterPoolManager());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * Set the prompt string that shows up at the top of the copy-destination dialog.
- */
- public void setPromptString(String promptString)
- {
- this.promptString = promptString;
- }
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- return promptString;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage(String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTER_PROGRESS).makeSubstitution(oldName);
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedFilters();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- ISystemFilter[] filters = getSelectedFilters();
- String[] names = new String[filters.length];
- for (int idx=0; idx<filters.length; idx++)
- names[idx] = filters[idx].getName();
- return names;
- }
-
- /**
- * Get the currently selected filters
- */
- protected ISystemFilter[] getSelectedFilters()
- {
- IStructuredSelection selection = getSelection();
- ISystemFilter[] filters = new ISystemFilter[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- Object next = i.next();
- if (next instanceof SystemSimpleContentElement)
- next = ((SystemSimpleContentElement)next).getData();
- if (next instanceof ISystemFilterReference)
- filters[idx++] = ((ISystemFilterReference)next).getReferencedFilter();
- else
- filters[idx++] = (ISystemFilter)next;
- }
- return filters;
- }
- /**
- * Get the first selected filter
- */
- protected ISystemFilter getFirstSelectedFilter()
- {
- Object first = getFirstSelection();
- if (first instanceof SystemSimpleContentElement)
- {
- root = ((SystemSimpleContentElement)first).getRoot();
- first = ((SystemSimpleContentElement)first).getData();
- }
- if (first == null)
- return null;
- else if (first instanceof ISystemFilterReference)
- return ((ISystemFilterReference)first).getReferencedFilter();
- else if (first instanceof ISystemFilter)
- return (ISystemFilter)first;
- else
- return null;
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with
- * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected
- */
- protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager poolMgr)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Root", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers();
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- ImageDescriptor image = adapter.getSystemFilterPoolManagerImage();
-
- if ((mgrs == null) || (mgrs.length == 0))
- return veryRootElement;
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<mgrs.length; idx++)
- {
- SystemSimpleContentElement mgrElement =
- new SystemSimpleContentElement(mgrs[idx].getName(),
- mgrs[idx], veryRootElement, (Vector)null);
- mgrElement.setRenamable(false);
- mgrElement.setDeletable(false);
- mgrElement.setImageDescriptor(image);
-
- Vector elements = new Vector();
- populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements, mgrElement);
- mgrElement.setChildren(elements);
-
- veryRootChildren.addElement(mgrElement);
- if (mgrs[idx] == poolMgr)
- initialSelectionElement = mgrElement;
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
- /**
- * Populate filter pool manager subtree with filter pools
- */
- protected static void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager mgr,
- Vector elements,
- SystemSimpleContentElement parentElement)
- {
- //String mgrName = mgr.getName();
- ISystemFilterPool[] pools = mgr.getSystemFilterPools();
- for (int idx=0; idx<pools.length; idx++)
- {
- ISystemFilterPool pool = pools[idx];
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null);
- cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider, pool));
- //cElement.setSelected(setFilterPoolSelection(pool));
- elements.addElement(cElement);
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterPoolAction.java
deleted file mode 100644
index 56897e178..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterPoolAction.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * David Dykstal (IBM) - [194268] fixed updateSelection to disable when selection is empty
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Copy a filter pool action.
- */
-public class SystemFilterCopyFilterPoolAction extends SystemBaseCopyAction
-{
- private String promptString = null;
- private SystemSimpleContentElement initialSelectionElement = null;
- private SystemSimpleContentElement root = null;
-
- /**
- * Constructor
- */
- public SystemFilterCopyFilterPoolAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_COPY_FILTERPOOL_LABEL, MODE_COPY);
- setToolTipText(SystemResources.ACTION_COPY_FILTERPOOL_TOOLTIP);
- promptString = SystemResources.RESID_COPY_PROMPT;
- }
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- super.reset();
- initialSelectionElement = null;
- root = null;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- boolean enable = false;
- if (!selection.isEmpty()) {
- enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext()) {
- Object selectedObject = e.next();
- if (selectedObject instanceof SystemSimpleContentElement) {
- selectedObject = ((SystemSimpleContentElement) selectedObject).getData();
- }
- ISystemFilterPool pool = null;
- if (selectedObject instanceof ISystemFilterPool) {
- pool = (ISystemFilterPool) selectedObject;
- } else if (selectedObject instanceof ISystemFilterPoolReference) {
- pool = ((ISystemFilterPoolReference) selectedObject).getReferencedFilterPool();
- }
- // enable if this is not a connection specific filter pool
- enable = (pool != null) && (pool.getOwningParentName() == null);
- }
- }
- return enable;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
- {
- if (selectedElement == null)
- return false;
- Object data = selectedElement.getData();
- return (data instanceof ISystemFilterPoolManager);
- }
-
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
- String newName = oldName;
- //SystemFilterPool oldFilterPool = (SystemFilterPool)oldObject;
- ISystemFilterPool match = newMgr.getSystemFilterPool(oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- //ValidatorFilterPoolName validator = new ValidatorFilterPoolName(newMgr.getSystemFilterPoolNames());
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- ISystemFilterPool oldFilterPool = (ISystemFilterPool)oldObject;
- ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
- ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
- ISystemFilterPool newFilterPool = oldMgr.copySystemFilterPool(newMgr, oldFilterPool, newName);
- if ((root != null) && (newFilterPool!=null))
- {
- Object data = root.getData();
- if ((data!=null) && (data instanceof TreeViewer))
- ((TreeViewer)data).refresh();
- }
- return (newFilterPool != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- ISystemFilterPool firstPool = getFirstSelectedFilterPool();
- ISystemFilterPoolManagerProvider provider = firstPool.getProvider();
- return getPoolMgrTreeModel(provider, firstPool.getSystemFilterPoolManager());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * Set the prompt string that shows up at the top of the copy-destination dialog.
- */
- public void setPromptString(String promptString)
- {
- this.promptString = promptString;
- }
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- //return SystemResources.RESID_COPY_TARGET_PROFILE_PROMPT);
- return promptString;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOLS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage(String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOL_PROGRESS).makeSubstitution(oldName);
- }
- /**
- * Return complete message
- */
- public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERPOOL_COMPLETE).makeSubstitution(((ISystemFilterPoolManager)targetContainer).getName());
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedFilterPools();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- ISystemFilterPool[] filterPools = getSelectedFilterPools();
- String[] names = new String[filterPools.length];
- for (int idx=0; idx<filterPools.length; idx++)
- names[idx] = filterPools[idx].getName();
- return names;
- }
-
- /**
- * Get the currently selected filter pools
- */
- protected ISystemFilterPool[] getSelectedFilterPools()
- {
- IStructuredSelection selection = getSelection();
- ISystemFilterPool[] filterPools = new ISystemFilterPool[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- Object next = i.next();
- if (next instanceof SystemSimpleContentElement)
- next = ((SystemSimpleContentElement)next).getData();
- if (next instanceof ISystemFilterPoolReference)
- filterPools[idx++] = ((ISystemFilterPoolReference)next).getReferencedFilterPool();
- else
- filterPools[idx++] = (ISystemFilterPool)next;
- }
- return filterPools;
- }
- /**
- * Get the first selected filter pool
- */
- protected ISystemFilterPool getFirstSelectedFilterPool()
- {
- Object first = getFirstSelection();
- if (first instanceof SystemSimpleContentElement)
- {
- root = ((SystemSimpleContentElement)first).getRoot();
- first = ((SystemSimpleContentElement)first).getData();
- }
- if (first == null)
- return null;
- else if (first instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference)first).getReferencedFilterPool();
- else if (first instanceof ISystemFilterPool)
- return (ISystemFilterPool)first;
- else
- return null;
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with
- * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected
- */
- protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, ISystemFilterPoolManager poolMgr)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Root", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- ImageDescriptor image = adapter.getSystemFilterPoolManagerImage();
-
- if ((mgrs == null) || (mgrs.length == 0))
- return veryRootElement;
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<mgrs.length; idx++)
- {
- SystemSimpleContentElement mgrElement =
- new SystemSimpleContentElement(mgrs[idx].getName(),
- mgrs[idx], veryRootElement, (Vector)null);
- mgrElement.setRenamable(false);
- mgrElement.setDeletable(false);
- mgrElement.setImageDescriptor(image);
- veryRootChildren.addElement(mgrElement);
- if (mgrs[idx] == poolMgr)
- initialSelectionElement = mgrElement;
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterStringAction.java
deleted file mode 100644
index 244c77d58..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterCopyFilterStringAction.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ValidatorUniqueString;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Copy a filter string action.
- */
-public class SystemFilterCopyFilterStringAction extends SystemBaseCopyAction
-{
- private String promptString = null;
- private SystemSimpleContentElement initialSelectionElement = null;
- private SystemSimpleContentElement root = null;
- private ISystemFilterString[] strings = null;
-
- /**
- * Constructor
- */
- public SystemFilterCopyFilterStringAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_COPY_FILTERSTRING_LABEL, MODE_COPY);
- promptString = SystemResources.RESID_COPY_PROMPT;
- }
-
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- super.reset();
- initialSelectionElement = null;
- root = null;
- strings = null;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * Overridable method if you support duplicate filter strings in the same filter.
- * By default, queries the "supportsDuplicateFilterStrings" attribute in the filter.
- */
- protected boolean supportsDuplicateFilterStrings(ISystemFilter filter)
- {
- return filter.isSupportsDuplicateFilterStrings();
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- /* */
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof SystemSimpleContentElement)
- selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
- if (!checkObjectType(selectedObject))
- enable = false;
- }
- /* */
- return enable;
- }
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilterString)
- {
- ISystemFilterString fs = (ISystemFilterString)selectedObject;
- return fs.isChangable();
- }
- else if (selectedObject instanceof ISystemFilterStringReference)
- {
- ISystemFilterStringReference frs = (ISystemFilterStringReference)selectedObject;
- return frs.getReferencedFilterString().isChangable();
- }
- else
- return false;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- * <p>
- * The default is to return true if the selected element has no children. This is sufficient for most cases. However,
- * in some cases it is not, such as for filter strings where we want to only enable OK if a filter is selected. It is
- * possible that filter pools have no filters, so the default algorithm is not sufficient. In these cases the child class
- * can override this method.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
- {
- Object data = selectedElement.getData();
- if (data instanceof ISystemFilter)
- return !((ISystemFilter)data).isPromptable();
- else
- return false;
- }
-
- /**
- * Overridable entry point when you want to prevent any copies/moves if any of the
- * selected objects have a name collision.
- * <p>
- * If you decide to override this, it is your responsibility to issue the error
- * message to the user and return false here.
- * <p>
- * @return true if there is no problem, false if there is a fatal collision
- */
- protected boolean preCheckForCollision(Shell shell, Object targetContainer,
- Object oldObject, String oldName)
- {
- ISystemFilter newFilter = (ISystemFilter)targetContainer;
- if (supportsDuplicateFilterStrings(newFilter))
- return true;
- ISystemFilterString match = newFilter.getSystemFilterString(oldName);
- if (match != null)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_ALREADYEXISTS);
- msg.makeSubstitution(oldName, newFilter.getName());
- SystemMessageDialog.displayErrorMessage(shell, msg);
- }
- return (match == null); // all is well iff such a filter string doesn't already exist.
- }
-
- /**
- * SHOULD NEVER BE CALLED IF preCheckForCollision WORKS PROPERLY
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemFilter newFilter = (ISystemFilter)targetContainer;
- if (supportsDuplicateFilterStrings(newFilter))
- return oldName;
- //ISystemFilterPool newPool = newFilter.getParentFilterPool();
- //ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
- String newName = oldName;
- ISystemFilterString match = newFilter.getSystemFilterString(oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- boolean caseSensitive = false;
- ValidatorUniqueString validator = new ValidatorUniqueString(newFilter.getFilterStrings(),caseSensitive);
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, validator); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- ISystemFilterString oldFilterString = (ISystemFilterString)oldObject;
- ISystemFilterPoolManager oldMgr = oldFilterString.getSystemFilterPoolManager();
- ISystemFilter targetFilter = (ISystemFilter)targetContainer;
- //SystemFilterPoolManager newMgr = targetFilter.getSystemFilterPoolManager();
-
- ISystemFilterString newFilterString = oldMgr.copySystemFilterString(targetFilter, oldFilterString);
-
- if ((root != null) && (newFilterString!=null))
- {
- Object data = root.getData();
- if ((data!=null) && (data instanceof TreeViewer))
- ((TreeViewer)data).refresh();
- }
- return (newFilterString != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- ISystemFilterString firstFilterString = getFirstSelectedFilterString();
- ISystemFilterPoolManagerProvider provider = firstFilterString.getProvider();
- return getPoolMgrTreeModel(provider, firstFilterString.getSystemFilterPoolManager(), getSelectedFilters());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * Set the prompt string that shows up at the top of the copy-destination dialog.
- */
- public void setPromptString(String promptString)
- {
- this.promptString = promptString;
- }
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- return promptString;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERSTRINGS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage( String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYFILTERSTRING_PROGRESS).makeSubstitution(oldName);
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedFilterStrings();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- strings = null; // clear previous history
- ISystemFilterString[] strings = getSelectedFilterStrings();
- String[] names = new String[strings.length];
- for (int idx=0; idx<strings.length; idx++)
- names[idx] = strings[idx].getString();
- return names;
- }
-
- /**
- * Get the currently selected filter strings
- */
- protected ISystemFilterString[] getSelectedFilterStrings()
- {
- if (strings == null)
- {
- IStructuredSelection selection = getSelection();
- strings = new ISystemFilterString[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- Object next = i.next();
- if (next instanceof SystemSimpleContentElement)
- next = ((SystemSimpleContentElement)next).getData();
- if (next instanceof ISystemFilterStringReference)
- strings[idx++] = ((ISystemFilterStringReference)next).getReferencedFilterString();
- else
- strings[idx++] = (ISystemFilterString)next;
- }
- }
- return strings;
- }
- /**
- * Get the intersection list of filters of currently selected filter strings
- */
- protected ISystemFilter[] getSelectedFilters()
- {
- Vector v = new Vector();
- ISystemFilterString[] strings = getSelectedFilterStrings();
- for (int idx=0; idx<strings.length; idx++)
- {
- ISystemFilter filter = strings[idx].getParentSystemFilter();
- if (!supportsDuplicateFilterStrings(filter))
- {
- if (!containsFilter(v,filter))
- v.addElement(filter);
- }
- }
- ISystemFilter[] filters = new ISystemFilter[v.size()];
- for (int idx=0; idx<v.size(); idx++)
- filters[idx] = (ISystemFilter)v.elementAt(idx);
- return filters;
- }
- /**
- * Get the first selected filter string
- */
- protected ISystemFilterString getFirstSelectedFilterString()
- {
- Object first = getFirstSelection();
- if (first instanceof SystemSimpleContentElement)
- {
- root = ((SystemSimpleContentElement)first).getRoot();
- first = ((SystemSimpleContentElement)first).getData();
- }
- if (first == null)
- return null;
- else if (first instanceof ISystemFilterStringReference)
- return ((ISystemFilterStringReference)first).getReferencedFilterString();
- else if (first instanceof ISystemFilterString)
- return (ISystemFilterString)first;
- else
- return null;
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with
- * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected
- * @param filtersToExclude All the currently selected filters, which are excluded from the target list
- */
- protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager poolMgr,
- ISystemFilter[] filtersToExclude)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Root", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers();
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- ImageDescriptor image = adapter.getSystemFilterPoolManagerImage();
-
- if ((mgrs == null) || (mgrs.length == 0))
- return veryRootElement;
-
- ISystemFilter parentFilter = getFirstSelectedFilterString().getParentSystemFilter();
- ISystemFilterPool parentFilterPool = parentFilter.getParentFilterPool();
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<mgrs.length; idx++)
- {
- SystemSimpleContentElement mgrElement =
- new SystemSimpleContentElement(mgrs[idx].getName(),
- mgrs[idx], veryRootElement, (Vector)null);
- mgrElement.setRenamable(false);
- mgrElement.setDeletable(false);
- mgrElement.setImageDescriptor(image);
-
- Vector elements = new Vector();
- populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements,
- mgrElement, filtersToExclude, parentFilterPool, parentFilter);
- mgrElement.setChildren(elements);
-
- veryRootChildren.addElement(mgrElement);
- //if (mgrs[idx] == poolMgr)
- // initialSelectionElement = mgrElement;
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
- /**
- * Populate filter pool manager subtree with filter pools
- */
- protected void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager mgr,
- Vector elements,
- SystemSimpleContentElement parentElement,
- ISystemFilter[] filtersToExclude,
- ISystemFilterPool filterPoolToSelect,
- ISystemFilter filterToSelect)
- {
- ISystemFilterPool[] pools = mgr.getSystemFilterPools();
- for (int idx=0; idx<pools.length; idx++)
- {
- ISystemFilterPool pool = pools[idx];
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null);
- cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider,pool));
-
- Vector childElements = new Vector();
- populateFilterContentElementVector(poolMgrProvider, pool, childElements, cElement, filtersToExclude, filterToSelect);
- cElement.setChildren(childElements);
-
- elements.addElement(cElement);
- if ((pool == filterPoolToSelect) && (initialSelectionElement==null))
- initialSelectionElement = cElement;
- }
- }
-
- /**
- * Populate filter pool subtree with filters
- */
- protected void populateFilterContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPool pool,
- Vector elements,
- SystemSimpleContentElement parentElement,
- ISystemFilter[] filtersToExclude,
- ISystemFilter filterToSelect)
- {
- ISystemFilter[] filters = pool.getSystemFilters();
- for (int idx=0; idx<filters.length; idx++)
- {
- ISystemFilter filter = filters[idx];
- if (!filter.isNonChangable() && !filter.isPromptable() && // defect 43242
- !containsFilter(filtersToExclude,filter))
- {
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(filter.getName(), filter, parentElement, (Vector)null);
- cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterImage(poolMgrProvider, filter));
- elements.addElement(cElement);
- if (filterToSelect == filter)
- initialSelectionElement = cElement;
- }
- }
- }
-
- private static boolean containsFilter(ISystemFilter[] filters, ISystemFilter filter)
- {
- ISystemFilter match = null;
- for (int idx=0; (match==null) && (idx<filters.length); idx++)
- if (filters[idx] == filter)
- match = filters[idx];
- return (match != null);
- }
- public static boolean containsFilter(Vector filters, ISystemFilter filter)
- {
- ISystemFilter match = null;
- for (int idx=0; (match==null) && (idx<filters.size()); idx++)
- if (filters.elementAt(idx) == filter)
- match = (ISystemFilter)filters.elementAt(idx);
- return (match != null);
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterAction.java
deleted file mode 100644
index 64b1441a7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterAction.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterContainer;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.SystemSortableSelection;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to move the current filter down in the list
- */
-public class SystemFilterMoveDownFilterAction extends SystemBaseAction
-
-{
-
-
- /**
- * Constructor
- */
- public SystemFilterMoveDownFilterAction(Shell parent)
- {
- super(SystemResources.ACTION_MOVEDOWN_LABEL,SystemResources.ACTION_MOVEDOWN_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID),
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * Intercept of parent method. We need to test that the filters
- * come from the same parent
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- ISystemFilterContainer prevContainer = null;
- boolean enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- ISystemFilter filter = getSystemFilter(selectedObject);
- if (prevContainer != null)
- {
- if (prevContainer != filter.getParentFilterContainer())
- enable = false;
- else
- prevContainer = filter.getParentFilterContainer();
- }
- else
- prevContainer = filter.getParentFilterContainer();
- if (enable)
- enable = checkObjectType(filter);
- }
- return enable;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (!((selectedObject instanceof ISystemFilter) ||
- (selectedObject instanceof ISystemFilterReference)))
- return false;
-
- ISystemFilter filter = getSystemFilter(selectedObject);
- //SystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager();
- ISystemFilterContainer fpContainer = filter.getParentFilterContainer();
- int pos = fpContainer.getSystemFilterPosition(filter);
- return (pos < (fpContainer.getSystemFilterCount()-1));
- }
-
- private ISystemFilter getSystemFilter(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilter)
- return (ISystemFilter)selectedObject;
- else
- return ((ISystemFilterReference)selectedObject).getReferencedFilter();
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- IStructuredSelection selections = getSelection();
-
- SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()];
- Iterator i = selections.iterator();
- int idx = 0;
- ISystemFilter filter = null;
- ISystemFilterContainer fpContainer = null;
- while (i.hasNext())
- {
- sortableArray[idx] = new SystemSortableSelection(getSystemFilter(i.next()));
- filter = (ISystemFilter)sortableArray[idx].getSelectedObject();
- fpContainer = filter.getParentFilterContainer();
- sortableArray[idx].setPosition(fpContainer.getSystemFilterPosition(filter));
- idx++;
- }
- SystemSortableSelection.sortArray(sortableArray);
- ISystemFilter[] filters = (ISystemFilter[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilter[sortableArray.length]);
-
- if (idx>0)
- {
- ISystemFilterPoolManager fpMgr = filters[0].getSystemFilterPoolManager();
- try {
- fpMgr.moveSystemFilters(filters,1);
- } catch (Exception exc)
- {
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterPoolReferenceAction.java
deleted file mode 100644
index 6ab1096f9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveDownFilterPoolReferenceAction.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.SystemSortableSelection;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to move the current filter down in the list
- */
-public class SystemFilterMoveDownFilterPoolReferenceAction extends SystemBaseAction
-
-{
-
-
- /**
- * Constructor
- */
- public SystemFilterMoveDownFilterPoolReferenceAction(Shell parent)
- {
- super(SystemResources.ACTION_MOVEDOWN_LABEL,SystemResources.ACTION_MOVEDOWN_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID),
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * Intercept of parent method. We need to test that the filter pools
- * come from the same parent
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- ISystemFilterPoolReferenceManager prevMgr = null;
- boolean enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
- if (prevMgr != null)
- {
- if (prevMgr != filterPoolRef.getFilterPoolReferenceManager())
- enable = false;
- else
- prevMgr = filterPoolRef.getFilterPoolReferenceManager();
- }
- else
- prevMgr = filterPoolRef.getFilterPoolReferenceManager();
- if (enable)
- enable = checkObjectType(filterPoolRef);
- }
- return enable;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (!(selectedObject instanceof ISystemFilterPoolReference))
- return false;
- ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
- ISystemFilterPoolReferenceManager fprMgr = filterPoolRef.getFilterPoolReferenceManager();
- int pos = fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef);
- return (pos < (fprMgr.getSystemFilterPoolReferenceCount()-1));
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- IStructuredSelection selections = getSelection();
- //SystemFilterPoolReference filterPoolRefs[] = new SystemFilterPoolReference[selections.size()];
- //Iterator i = selections.iterator();
- //int idx = 0;
- //while (i.hasNext())
- //filterPoolRefs[idx++] = (SystemFilterPoolReference)i.next();
-
- SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()];
- Iterator i = selections.iterator();
- int idx = 0;
- ISystemFilterPoolReference filterPoolRef = null;
- ISystemFilterPoolReferenceManager fprMgr = null;
- while (i.hasNext())
- {
- sortableArray[idx] = new SystemSortableSelection(i.next());
- filterPoolRef = (ISystemFilterPoolReference)sortableArray[idx].getSelectedObject();
- fprMgr = filterPoolRef.getFilterPoolReferenceManager();
- sortableArray[idx].setPosition(fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef));
- idx++;
- }
- SystemSortableSelection.sortArray(sortableArray);
- ISystemFilterPoolReference[] filterPoolRefs = (ISystemFilterPoolReference[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilterPoolReference[sortableArray.length]);
-
- if (idx>0)
- {
- fprMgr = filterPoolRefs[0].getFilterPoolReferenceManager();
- fprMgr.moveSystemFilterPoolReferences(filterPoolRefs,1);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterAction.java
deleted file mode 100644
index 8586af980..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterAction.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Copy a filter action.
- */
-public class SystemFilterMoveFilterAction extends SystemBaseCopyAction
-{
- private String promptString = null;
- private SystemSimpleContentElement initialSelectionElement = null;
- private SystemSimpleContentElement root = null;
-
- /**
- * Constructor
- */
- public SystemFilterMoveFilterAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_MOVE_FILTER_LABEL, MODE_MOVE);
- setToolTipText(SystemResources.ACTION_MOVE_FILTER_TOOLTIP);
- promptString = SystemResources.RESID_MOVE_PROMPT;
- }
-
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- super.reset();
- initialSelectionElement = null;
- root = null;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- /* */
- Iterator e= selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof SystemSimpleContentElement)
- selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
- if (!checkObjectType(selectedObject))
- enable = false;
- }
- /* */
- return enable;
- }
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilter)
- {
- ISystemFilter fs = (ISystemFilter)selectedObject;
- return !fs.isNonChangable();
- }
- else if (selectedObject instanceof ISystemFilterReference)
- {
- ISystemFilter fs = ((ISystemFilterReference)selectedObject).getReferencedFilter();
- return !fs.isNonChangable();
- }
- else
- return false;
- }
-
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
- {
- if (selectedElement == null)
- return false;
- Object data = selectedElement.getData();
- return (data instanceof ISystemFilterPool);
- }
-
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
- //ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
- String newName = oldName;
- ISystemFilter match = newPool.getSystemFilter(oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- //ValidatorFilterName validator = new ValidatorFilterName(newPool.getSystemFilterNames());
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- ISystemFilter oldFilter = (ISystemFilter)oldObject;
- ISystemFilterPool oldFilterPool = oldFilter.getParentFilterPool();
- ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
- ISystemFilterPool newPool = (ISystemFilterPool)targetContainer;
- //ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
-
- ISystemFilter newFilter = oldMgr.moveSystemFilter(newPool, oldFilter, newName);
-
- if ((root != null) && (newFilter!=null))
- {
- Object data = root.getData();
- if ((data!=null) && (data instanceof TreeViewer))
- ((TreeViewer)data).refresh();
- }
- return (newFilter != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- ISystemFilter firstFilter = getFirstSelectedFilter();
- ISystemFilterPoolManagerProvider provider = firstFilter.getProvider();
- return getPoolMgrTreeModel(provider, firstFilter.getSystemFilterPoolManager(), firstFilter.getParentFilterPool());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * Set the prompt string that shows up at the top of the copy-destination dialog.
- */
- public void setPromptString(String promptString)
- {
- this.promptString = promptString;
- }
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- return promptString;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage( String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTER_PROGRESS).makeSubstitution(oldName);
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedFilters();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- ISystemFilter[] filters = getSelectedFilters();
- String[] names = new String[filters.length];
- for (int idx=0; idx<filters.length; idx++)
- names[idx] = filters[idx].getName();
- return names;
- }
-
- /**
- * Get the currently selected filters
- */
- protected ISystemFilter[] getSelectedFilters()
- {
- IStructuredSelection selection = getSelection();
- ISystemFilter[] filters = new ISystemFilter[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- Object next = i.next();
- if (next instanceof SystemSimpleContentElement)
- next = ((SystemSimpleContentElement)next).getData();
- if (next instanceof ISystemFilterReference)
- filters[idx++] = ((ISystemFilterReference)next).getReferencedFilter();
- else
- filters[idx++] = (ISystemFilter)next;
- }
- return filters;
- }
- /**
- * Get the first selected filter
- */
- protected ISystemFilter getFirstSelectedFilter()
- {
- Object first = getFirstSelection();
- if (first instanceof SystemSimpleContentElement)
- {
- root = ((SystemSimpleContentElement)first).getRoot();
- first = ((SystemSimpleContentElement)first).getData();
- }
- if (first == null)
- return null;
- else if (first instanceof ISystemFilterReference)
- return ((ISystemFilterReference)first).getReferencedFilter();
- else if (first instanceof ISystemFilter)
- return (ISystemFilter)first;
- else
- return null;
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with
- * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected
- * @param pool The SystemFilterPool whose tree model element is to be excluded
- */
- protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager poolMgr,
- ISystemFilterPool pool)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Root", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers();
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- ImageDescriptor image = adapter.getSystemFilterPoolManagerImage();
-
- if ((mgrs == null) || (mgrs.length == 0))
- return veryRootElement;
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<mgrs.length; idx++)
- {
- SystemSimpleContentElement mgrElement =
- new SystemSimpleContentElement(mgrs[idx].getName(),
- mgrs[idx], veryRootElement, (Vector)null);
- mgrElement.setRenamable(false);
- mgrElement.setDeletable(false);
- mgrElement.setImageDescriptor(image);
-
- Vector elements = new Vector();
- populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements, mgrElement, pool);
- mgrElement.setChildren(elements);
-
- if (mgrs[idx] == poolMgr)
- initialSelectionElement = mgrElement;
-
- veryRootChildren.addElement(mgrElement);
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
- /**
- * Populate filter pool manager subtree with filter pools
- */
- protected static void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager mgr,
- Vector elements,
- SystemSimpleContentElement parentElement,
- ISystemFilterPool poolToExclude)
- {
- ISystemFilterPool[] pools = mgr.getSystemFilterPools();
- for (int idx=0; idx<pools.length; idx++)
- {
- ISystemFilterPool pool = pools[idx];
- if (pool != poolToExclude)
- {
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null);
- cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider, pool));
- //cElement.setSelected(setFilterPoolSelection(pool));
- elements.addElement(cElement);
- }
- }
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterPoolAction.java
deleted file mode 100644
index 235435686..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterPoolAction.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * David Dykstal (IBM) - [194268] fixed updateSelection() to disable when selection is empty
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Move a filter pool action.
- */
-public class SystemFilterMoveFilterPoolAction extends SystemBaseCopyAction
-{
- private String promptString = null;
- private SystemSimpleContentElement initialSelectionElement = null;
- private SystemSimpleContentElement root = null;
-
- /**
- * Constructor
- */
- public SystemFilterMoveFilterPoolAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_MOVE_FILTERPOOL_LABEL, MODE_MOVE);
- setToolTipText(SystemResources.ACTION_MOVE_FILTERPOOL_TOOLTIP);
- promptString = SystemResources.RESID_MOVE_PROMPT;
- }
-
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- super.reset();
- initialSelectionElement = null;
- root = null;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We intercept to ensure only filterpools from the same filterpool manager are selected.
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- boolean enable = false;
- if (!selection.isEmpty()) {
- enable = true;
- Iterator e = selection.iterator();
- Set managers = new HashSet();
- while (enable && e.hasNext()) {
- Object selectedObject = e.next();
- if (selectedObject instanceof SystemSimpleContentElement) {
- selectedObject = ((SystemSimpleContentElement) selectedObject).getData();
- }
- ISystemFilterPool pool = null;
- if (selectedObject instanceof ISystemFilterPool){
- pool = (ISystemFilterPool) selectedObject;
- }
- else if (selectedObject instanceof ISystemFilterPoolReference) {
- pool = ((ISystemFilterPoolReference) selectedObject).getReferencedFilterPool();
- }
- if (pool != null) {
- String ownerName = pool.getOwningParentName();
- ISystemFilterPoolManager manager = pool.getSystemFilterPoolManager();
- managers.add(manager);
- // enable if the number of managers is one and the owner name is null (i.e. the pool does not belong to a connection)
- enable = (managers.size() == 1) && (ownerName == null);
- } else {
- enable = false;
- }
- }
- }
- return enable;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
- {
- if (selectedElement == null)
- return false;
- Object data = selectedElement.getData();
- return (data instanceof ISystemFilterPoolManager);
- }
-
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
- String newName = oldName;
- ISystemFilterPool match = newMgr.getSystemFilterPool(oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- //ValidatorFilterPoolName validator = new ValidatorFilterPoolName(newMgr.getSystemFilterPoolNames());
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- ISystemFilterPool oldFilterPool = (ISystemFilterPool)oldObject;
- ISystemFilterPoolManager oldMgr = oldFilterPool.getSystemFilterPoolManager();
- ISystemFilterPoolManager newMgr = (ISystemFilterPoolManager)targetContainer;
- ISystemFilterPool newFilterPool = oldMgr.moveSystemFilterPool(newMgr, oldFilterPool, newName);
- if ((root != null) && (newFilterPool!=null))
- {
- Object data = root.getData();
- if ((data!=null) && (data instanceof TreeViewer))
- ((TreeViewer)data).refresh();
- }
- return (newFilterPool != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- ISystemFilterPool firstPool = getFirstSelectedFilterPool();
- ISystemFilterPoolManagerProvider provider = firstPool.getProvider();
-
- return getPoolMgrTreeModel(provider, firstPool.getSystemFilterPoolManager());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * Set the prompt string that shows up at the top of the copy-destination dialog.
- */
- public void setPromptString(String promptString)
- {
- this.promptString = promptString;
- }
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- return promptString;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERPOOLS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage( String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERPOOL_PROGRESS).makeSubstitution(oldName);
- }
- /**
- * Return complete message
- */
- public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERPOOL_COMPLETE).makeSubstitution(((ISystemFilterPoolManager)targetContainer).getName());
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedFilterPools();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- ISystemFilterPool[] filterPools = getSelectedFilterPools();
- String[] names = new String[filterPools.length];
- for (int idx=0; idx<filterPools.length; idx++)
- names[idx] = filterPools[idx].getName();
- return names;
- }
-
- /**
- * Get the currently selected filter pools
- */
- protected ISystemFilterPool[] getSelectedFilterPools()
- {
- IStructuredSelection selection = getSelection();
- ISystemFilterPool[] filterPools = new ISystemFilterPool[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- Object next = i.next();
- if (next instanceof SystemSimpleContentElement)
- next = ((SystemSimpleContentElement)next).getData();
- if (next instanceof ISystemFilterPoolReference)
- filterPools[idx++] = ((ISystemFilterPoolReference)next).getReferencedFilterPool();
- else
- filterPools[idx++] = (ISystemFilterPool)next;
- }
- return filterPools;
- }
- /**
- * Get the managers of the currently selected filter pools
- */
- protected ISystemFilterPoolManager[] getSelectedFilterPoolManagers()
- {
- ISystemFilterPoolManager[] mgrs = null;
- Vector v = new Vector();
- ISystemFilterPool[] pools = getSelectedFilterPools();
- for (int idx=0; idx<pools.length; idx++)
- {
- ISystemFilterPoolManager mgr = pools[idx].getSystemFilterPoolManager();
- if (!v.contains(mgr))
- v.addElement(mgr);
- }
-
- mgrs = new ISystemFilterPoolManager[v.size()];
- for (int idx=0; idx<mgrs.length; idx++)
- mgrs[idx] = (ISystemFilterPoolManager)v.elementAt(idx);
-
- return mgrs;
- }
-
- /**
- * Get the first selected filter pool
- */
- protected ISystemFilterPool getFirstSelectedFilterPool()
- {
- Object first = getFirstSelection();
- if (first instanceof SystemSimpleContentElement)
- {
- root = ((SystemSimpleContentElement)first).getRoot();
- first = ((SystemSimpleContentElement)first).getData();
- }
- if (first == null)
- return null;
- else if (first instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference)first).getReferencedFilterPool();
- else if (first instanceof ISystemFilterPool)
- return (ISystemFilterPool)first;
- else
- return null;
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with
- * @param poolMgr The current SystemFilterPoolManager which is to be excluded from the list.
- */
- protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider, ISystemFilterPoolManager poolMgr)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Root", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers();
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- ImageDescriptor image = adapter.getSystemFilterPoolManagerImage();
-
- if ((mgrs == null) || (mgrs.length == 0))
- return veryRootElement;
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<mgrs.length; idx++)
- {
- if (mgrs[idx] != poolMgr)
- {
- SystemSimpleContentElement mgrElement =
- new SystemSimpleContentElement(mgrs[idx].getName(),
- mgrs[idx], veryRootElement, (Vector)null);
- mgrElement.setRenamable(false);
- mgrElement.setDeletable(false);
- mgrElement.setImageDescriptor(image);
- veryRootChildren.addElement(mgrElement);
- if (initialSelectionElement == null)
- initialSelectionElement = mgrElement;
- }
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterStringAction.java
deleted file mode 100644
index f587cd6ed..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveFilterStringAction.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ValidatorUniqueString;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Move a filter string action.
- */
-public class SystemFilterMoveFilterStringAction extends SystemBaseCopyAction
-{
- private String promptString = null;
- private SystemSimpleContentElement initialSelectionElement = null;
- private SystemSimpleContentElement root = null;
- private ISystemFilterString[] strings = null;
-
- /**
- * Constructor
- */
- public SystemFilterMoveFilterStringAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_MOVE_FILTERSTRING_LABEL, MODE_MOVE);
- setToolTipText(SystemResources.ACTION_MOVE_FILTERSTRING_TOOLTIP);
- promptString = SystemResources.RESID_MOVE_PROMPT;
- }
-
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- super.reset();
- initialSelectionElement = null;
- root = null;
- strings = null;
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * Overridable method if you support duplicate filter strings in the same filter.
- * By default, queries the "supportsDuplicateFilterStrings" attribute in the filter.
- */
- protected boolean supportsDuplicateFilterStrings(ISystemFilter filter)
- {
- return filter.isSupportsDuplicateFilterStrings();
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- /* */
- Iterator e= selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof SystemSimpleContentElement)
- selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
- if (!checkObjectType(selectedObject))
- enable = false;
- }
- /* */
- return enable;
- }
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilterString)
- {
- ISystemFilterString fs = (ISystemFilterString)selectedObject;
- return fs.isChangable();
- }
- else if (selectedObject instanceof ISystemFilterStringReference)
- {
- ISystemFilterStringReference frs = (ISystemFilterStringReference)selectedObject;
- return frs.getReferencedFilterString().isChangable();
- }
- else
- return false;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- * <p>
- * The default is to return true if the selected element has no children. This is sufficient for most cases. However,
- * in some cases it is not, such as for filter strings where we want to only enable OK if a filter is selected. It is
- * possible that filter pools have no filters, so the default algorithm is not sufficient. In these cases the child class
- * can override this method.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
- {
- Object data = selectedElement.getData();
- if (data instanceof ISystemFilter)
- return !((ISystemFilter)data).isPromptable();
- else
- return false;
- }
-
- /**
- * Overridable entry point when you want to prevent any copies/moves if any of the
- * selected objects have a name collision.
- * <p>
- * If you decide to override this, it is your responsibility to issue the error
- * message to the user and return false here.
- * <p>
- * @return true if there is no problem, false if there is a fatal collision
- */
- protected boolean preCheckForCollision(Shell shell, Object targetContainer,
- Object oldObject, String oldName)
- {
- ISystemFilter newFilter = (ISystemFilter)targetContainer;
- if (supportsDuplicateFilterStrings(newFilter))
- return true;
- ISystemFilterString match = newFilter.getSystemFilterString(oldName);
- if (match != null)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_ALREADYEXISTS);
- msg.makeSubstitution(oldName, newFilter.getName());
- SystemMessageDialog.displayErrorMessage(shell, msg);
-
- }
- return (match == null); // all is well iff such a filter string doesn't already exist.
- }
-
- /**
- * SHOULD NEVER BE CALLED IF preCheckForCollision WORKS PROPERLY
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemFilter newFilter = (ISystemFilter)targetContainer;
- if (supportsDuplicateFilterStrings(newFilter))
- return oldName;
- //ISystemFilterPool newPool = newFilter.getParentFilterPool();
- //ISystemFilterPoolManager newMgr = newPool.getSystemFilterPoolManager();
- String newName = oldName;
- ISystemFilterString match = newFilter.getSystemFilterString(oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- boolean caseSensitive = false;
- ValidatorUniqueString validator = new ValidatorUniqueString(newFilter.getFilterStrings(),caseSensitive);
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, validator); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- ISystemFilterString oldFilterString = (ISystemFilterString)oldObject;
- ISystemFilterPoolManager oldMgr = oldFilterString.getSystemFilterPoolManager();
- ISystemFilter targetFilter = (ISystemFilter)targetContainer;
- //SystemFilterPoolManager newMgr = targetFilter.getSystemFilterPoolManager();
-
- ISystemFilterString newFilterString = oldMgr.moveSystemFilterString(targetFilter, oldFilterString);
-
- if ((root != null) && (newFilterString!=null))
- {
- Object data = root.getData();
- if ((data!=null) && (data instanceof TreeViewer))
- ((TreeViewer)data).refresh();
- }
- return (newFilterString != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- ISystemFilterString firstFilterString = getFirstSelectedFilterString();
- ISystemFilterPoolManagerProvider provider = firstFilterString.getProvider();
- return getPoolMgrTreeModel(provider, firstFilterString.getSystemFilterPoolManager(), getSelectedFilters());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * Set the prompt string that shows up at the top of the copy-destination dialog.
- */
- public void setPromptString(String promptString)
- {
- this.promptString = promptString;
- }
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- return promptString;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERSTRINGS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage( String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEFILTERSTRING_PROGRESS).makeSubstitution(oldName);
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedFilterStrings();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- ISystemFilterString[] strings = getSelectedFilterStrings();
- String[] names = new String[strings.length];
- for (int idx=0; idx<strings.length; idx++)
- names[idx] = strings[idx].getString();
- return names;
- }
-
- /**
- * Get the currently selected filter strings
- */
- protected ISystemFilterString[] getSelectedFilterStrings()
- {
- if (strings == null)
- {
- IStructuredSelection selection = getSelection();
- strings = new ISystemFilterString[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- Object next = i.next();
- if (next instanceof SystemSimpleContentElement)
- next = ((SystemSimpleContentElement)next).getData();
- if (next instanceof ISystemFilterStringReference)
- strings[idx++] = ((ISystemFilterStringReference)next).getReferencedFilterString();
- else
- strings[idx++] = (ISystemFilterString)next;
- }
- }
- return strings;
- }
- /**
- * Get the intersection list of filters of currently selected filter strings
- */
- protected ISystemFilter[] getSelectedFilters()
- {
- Vector v = new Vector();
- ISystemFilterString[] strings = getSelectedFilterStrings();
- for (int idx=0; idx<strings.length; idx++)
- {
- ISystemFilter filter = strings[idx].getParentSystemFilter();
- if (!supportsDuplicateFilterStrings(filter) &&
- !SystemFilterCopyFilterStringAction.containsFilter(v,filter))
- v.addElement(filter);
- }
- ISystemFilter[] filters = new ISystemFilter[v.size()];
- for (int idx=0; idx<v.size(); idx++)
- filters[idx] = (ISystemFilter)v.elementAt(idx);
- return filters;
- }
- /**
- * Get the first selected filter string
- */
- protected ISystemFilterString getFirstSelectedFilterString()
- {
- Object first = getFirstSelection();
- if (first instanceof SystemSimpleContentElement)
- {
- root = ((SystemSimpleContentElement)first).getRoot();
- first = ((SystemSimpleContentElement)first).getData();
- }
- if (first == null)
- return null;
- else if (first instanceof ISystemFilterStringReference)
- return ((ISystemFilterStringReference)first).getReferencedFilterString();
- else if (first instanceof ISystemFilterString)
- return (ISystemFilterString)first;
- else
- return null;
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param poolMgrProvider The provider who will give us the list of filter pool managers to populate the list with
- * @param poolMgr The SystemFilterPoolManager whose tree model element is to be pre-selected
- * @param filtersToExclude All the currently selected filters, which are excluded from the target list
- */
- protected SystemSimpleContentElement getPoolMgrTreeModel(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager poolMgr,
- ISystemFilter[] filtersToExclude)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Root", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemFilterPoolManager[] mgrs = poolMgrProvider.getSystemFilterPoolManagers();
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- ImageDescriptor image = adapter.getSystemFilterPoolManagerImage();
-
- if ((mgrs == null) || (mgrs.length == 0))
- return veryRootElement;
-
- ISystemFilter parentFilter = getFirstSelectedFilterString().getParentSystemFilter();
- ISystemFilterPool parentFilterPool = parentFilter.getParentFilterPool();
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<mgrs.length; idx++)
- {
- SystemSimpleContentElement mgrElement =
- new SystemSimpleContentElement(mgrs[idx].getName(),
- mgrs[idx], veryRootElement, (Vector)null);
- mgrElement.setRenamable(false);
- mgrElement.setDeletable(false);
- mgrElement.setImageDescriptor(image);
-
- Vector elements = new Vector();
- populateFilterPoolContentElementVector(poolMgrProvider, mgrs[idx], elements,
- mgrElement, filtersToExclude,
- parentFilterPool, parentFilter);
- mgrElement.setChildren(elements);
-
- veryRootChildren.addElement(mgrElement);
- //if (mgrs[idx] == poolMgr)
- //initialSelectionElement = mgrElement;
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
- /**
- * Populate filter pool manager subtree with filter pools
- */
- protected void populateFilterPoolContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPoolManager mgr,
- Vector elements,
- SystemSimpleContentElement parentElement,
- ISystemFilter[] filtersToExclude,
- ISystemFilterPool filterPoolToSelect,
- ISystemFilter filterToSelect)
- {
- ISystemFilterPool[] pools = mgr.getSystemFilterPools();
- for (int idx=0; idx<pools.length; idx++)
- {
- ISystemFilterPool pool = pools[idx];
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null);
- cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(poolMgrProvider,pool));
-
- Vector childElements = new Vector();
- populateFilterContentElementVector(poolMgrProvider, pool, childElements, cElement, filtersToExclude, filterToSelect);
- cElement.setChildren(childElements);
-
- elements.addElement(cElement);
- if ((pool == filterPoolToSelect) && (initialSelectionElement==null))
- initialSelectionElement = cElement;
- }
- }
-
- /**
- * Populate filter pool subtree with filters
- */
- protected void populateFilterContentElementVector(ISystemFilterPoolManagerProvider poolMgrProvider,
- ISystemFilterPool pool,
- Vector elements,
- SystemSimpleContentElement parentElement,
- ISystemFilter[] filtersToExclude,
- ISystemFilter filterToSelect)
- {
- ISystemFilter[] filters = pool.getSystemFilters();
- for (int idx=0; idx<filters.length; idx++)
- {
- ISystemFilter filter = filters[idx];
- if (!filter.isNonChangable() && !filter.isPromptable() && // defect 43242
- !containsFilter(filtersToExclude,filter))
- {
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(filter.getName(), filter, parentElement, (Vector)null);
- cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterImage(poolMgrProvider,filter));
- elements.addElement(cElement);
- if (filter == filterToSelect)
- initialSelectionElement = cElement;
- }
- }
- }
-
- private boolean containsFilter(ISystemFilter[] filters, ISystemFilter filter)
- {
- ISystemFilter match = null;
- for (int idx=0; (match==null) && (idx<filters.length); idx++)
- if (filters[idx] == filter)
- match = filters[idx];
- return (match != null);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterAction.java
deleted file mode 100644
index 6285cd814..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterAction.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterContainer;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.SystemSortableSelection;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to move the current filter up in the list
- */
-public class SystemFilterMoveUpFilterAction extends SystemBaseAction
-
-{
-
- /**
- * Constructor
- */
- public SystemFilterMoveUpFilterAction(Shell parent)
- {
- super(SystemResources.ACTION_MOVEUP_LABEL,SystemResources.ACTION_MOVEUP_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID),
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * Intercept of parent method. We need to test that the filters
- * come from the same parent
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- ISystemFilterContainer prevContainer = null;
- boolean enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- ISystemFilter filter = getSystemFilter(selectedObject);
- if (prevContainer != null)
- {
- if (prevContainer != filter.getParentFilterContainer())
- enable = false;
- else
- prevContainer = filter.getParentFilterContainer();
- }
- else
- prevContainer = filter.getParentFilterContainer();
- if (enable)
- enable = checkObjectType(filter);
- }
- return enable;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (!((selectedObject instanceof ISystemFilter) ||
- (selectedObject instanceof ISystemFilterReference)))
- return false;
- ISystemFilter filter = getSystemFilter(selectedObject);
- ISystemFilterContainer fpContainer = filter.getParentFilterContainer();
- int pos = fpContainer.getSystemFilterPosition(filter);
- return (pos>0);
- }
-
- private ISystemFilter getSystemFilter(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilter)
- return (ISystemFilter)selectedObject;
- else
- return ((ISystemFilterReference)selectedObject).getReferencedFilter();
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- IStructuredSelection selections = getSelection();
- //SystemFilter filters[] = new SystemFilter[selections.size()];
- //Iterator i = selections.iterator();
- //int idx = 0;
- //while (i.hasNext())
- //filters[idx++] = getSystemFilter(i.next());
-
- SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()];
- Iterator i = selections.iterator();
- int idx = 0;
- ISystemFilter filter = null;
- ISystemFilterContainer fpContainer = null;
- while (i.hasNext())
- {
- sortableArray[idx] = new SystemSortableSelection(getSystemFilter(i.next()));
- filter = (ISystemFilter)sortableArray[idx].getSelectedObject();
- fpContainer = filter.getParentFilterContainer();
- sortableArray[idx].setPosition(fpContainer.getSystemFilterPosition(filter));
- idx++;
- }
- SystemSortableSelection.sortArray(sortableArray);
- ISystemFilter[] filters = (ISystemFilter[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilter[sortableArray.length]);
-
- if (idx>0)
- {
- ISystemFilterPoolManager fpMgr = filters[0].getSystemFilterPoolManager();
- try {
- //System.out.println("In SystemFilterMoveUpFilterAction#run(). Calling mgr.moveSystemFilters");
- fpMgr.moveSystemFilters(filters,-1);
- } catch (Exception exc)
- {
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterPoolReferenceAction.java
deleted file mode 100644
index 455ce1306..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterMoveUpFilterPoolReferenceAction.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.SystemSortableSelection;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to move the current filter pool reference up in the list
- */
-public class SystemFilterMoveUpFilterPoolReferenceAction extends SystemBaseAction
-
-{
-
-
- /**
- * Constructor
- */
- public SystemFilterMoveUpFilterPoolReferenceAction(Shell parent)
- {
- super(SystemResources.ACTION_MOVEUP_LABEL,SystemResources.ACTION_MOVEUP_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID),
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction#setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction#getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * Intercept of parent method. We need to test that the filter pools
- * come from the same parent
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- ISystemFilterPoolReferenceManager prevMgr = null;
- boolean enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
- if (prevMgr != null)
- {
- if (prevMgr != filterPoolRef.getFilterPoolReferenceManager())
- enable = false;
- else
- prevMgr = filterPoolRef.getFilterPoolReferenceManager();
- }
- else
- prevMgr = filterPoolRef.getFilterPoolReferenceManager();
- if (enable)
- enable = checkObjectType(filterPoolRef);
- }
- return enable;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (!(selectedObject instanceof ISystemFilterPoolReference))
- return false;
- ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)selectedObject;
- ISystemFilterPoolReferenceManager fprMgr = filterPoolRef.getFilterPoolReferenceManager();
- int pos = fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef);
- return (pos>0);
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- IStructuredSelection selections = getSelection();
- //SystemFilterPoolReference filterPoolRefs[] = new SystemFilterPoolReference[selections.size()];
- //Iterator i = selections.iterator();
- //int idx = 0;
- //while (i.hasNext())
- //filterPoolRefs[idx++] = (SystemFilterPoolReference)i.next();
-
- SystemSortableSelection[] sortableArray = new SystemSortableSelection[selections.size()];
- Iterator i = selections.iterator();
- int idx = 0;
- ISystemFilterPoolReference filterPoolRef = null;
- ISystemFilterPoolReferenceManager fprMgr = null;
- while (i.hasNext())
- {
- sortableArray[idx] = new SystemSortableSelection(i.next());
- filterPoolRef = (ISystemFilterPoolReference)sortableArray[idx].getSelectedObject();
- fprMgr = filterPoolRef.getFilterPoolReferenceManager();
- sortableArray[idx].setPosition(fprMgr.getSystemFilterPoolReferencePosition(filterPoolRef));
- idx++;
- }
- SystemSortableSelection.sortArray(sortableArray);
- ISystemFilterPoolReference[] filterPoolRefs = (ISystemFilterPoolReference[])SystemSortableSelection.getSortedObjects(sortableArray, new ISystemFilterPoolReference[sortableArray.length]);
-
- if (idx > 0)
- {
- fprMgr = filterPoolRefs[0].getFilterPoolReferenceManager();
- fprMgr.moveSystemFilterPoolReferences(filterPoolRefs,-1);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterNewFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterNewFilterPoolAction.java
deleted file mode 100644
index 551e3c20a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterNewFilterPoolAction.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterNewFilterPoolWizard;
-import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardDialog;
-import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.ISystemWizardAction;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolWizardAction;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action that displays the New Filter Pool wizard
- * @see #setHelpContextId(String)
- */
-public class SystemFilterNewFilterPoolAction
- extends SystemFilterAbstractFilterPoolWizardAction
- implements ISystemWizardAction
-{
-
- private SystemFilterWorkWithFilterPoolsDialog wwdialog = null;
- //private SystemFilterNewFilterPoolWizard wizard = null;
-
- /**
- * Constructor for SystemNewFilterPoolAction when not called from work-with dialog.
- */
- public SystemFilterNewFilterPoolAction(Shell parent)
- {
- this(parent, null);
- }
-
- /**
- * Constructor for SystemNewFilterPoolAction when called from work-with dialog.
- */
- public SystemFilterNewFilterPoolAction(Shell parent,
- SystemFilterWorkWithFilterPoolsDialog wwdialog)
- {
- super(parent,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOL_ID),
- SystemResources.ACTION_NEWFILTERPOOL_LABEL, SystemResources.ACTION_NEWFILTERPOOL_TOOLTIP);
- this.wwdialog = wwdialog;
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- }
-
- /**
- * Override of init in parent
- */
- protected void init()
- {
- super.init();
- dlgInputs.prompt = SystemResources.RESID_NEWFILTERPOOL_PAGE1_DESCRIPTION;
- dlgInputs.title = SystemResources.RESID_NEWFILTERPOOL_PAGE1_TITLE;
- dlgInputs.poolNamePrompt = SystemResources.RESID_FILTERPOOLNAME_LABEL;
- dlgInputs.poolNameTip = SystemResources.RESID_FILTERPOOLNAME_TIP;
- dlgInputs.poolMgrNamePrompt = SystemResources.RESID_FILTERPOOLMANAGERNAME_LABEL;
- dlgInputs.poolMgrNameTip = SystemResources.RESID_FILTERPOOLMANAGERNAME_TIP;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (selectedObject instanceof SystemSimpleContentElement)
- selectedObject = ((SystemSimpleContentElement)selectedObject).getData();
- boolean enable =
- (selectedObject instanceof ISystemFilterPoolReferenceManagerProvider) ||
- (selectedObject instanceof ISystemFilterPoolManager) ||
- (selectedObject instanceof ISystemFilterPool);
- return enable;
- }
-
-
- /**
- * Return the wizard so we can customize it prior to showing it.
- * Returns new SystemFilterNewFilterPoolWizard(). Override to replace with your own.
- */
- public SystemFilterPoolWizardInterface getFilterPoolWizard()
- {
- //if (wizard == null)
- // wizard = new SystemFilterNewFilterPoolWizard();
- //return wizard;
- return new SystemFilterNewFilterPoolWizard();
- }
-
- /**
- * Overrides parent. Called after dialog dismissed.
- */
- protected Object getDialogValue(Dialog dlg)
- {
- SystemFilterPoolWizardDialog wizardDlg = (SystemFilterPoolWizardDialog)dlg;
- SystemFilterPoolDialogOutputs dlgOutput = wizardDlg.getFilterPoolDialogOutputs();
- return dlgOutput;
- }
-
- /**
- * Overrides parent. Called after dialog dismissed and getDialogValue called.
- * The output of getDialogValue passed as input here.
- */
- public void doOKprocessing(Object dlgValue)
- {
- //System.out.println("In SystemFilterNewFIlterPoolAction.doOKProcessing");
- SystemFilterPoolDialogOutputs dlgOutput = (SystemFilterPoolDialogOutputs)dlgValue;
- // called from WorkWith dialog... we do not offer to create a reference...
- if ((dlgOutput.newPool != null) && (wwdialog != null))
- wwdialog.addNewFilterPool(getShell(), dlgOutput.newPool);
- else if (dlgOutput.newPool != null)
- {
- ISystemFilterPoolReferenceManagerProvider sfprmp = getReferenceManagerProviderSelection();
- // Action selected by user when a reference manager provider was selected.
- // Seems obvious then that the user wishes to see the newly created pool, so
- // we take the liberty of creating a reference object...
- if (sfprmp != null)
- {
- ISystemFilterPoolReferenceManager sfprm = sfprmp.getSystemFilterPoolReferenceManager();
- //System.out.println("...calling addREferenceToSystemFilterPool...");
- sfprm.addReferenceToSystemFilterPool(dlgOutput.newPool);
- //System.out.println("...back from addREferenceToSystemFilterPool");
- }
- }
- }
-
- /**
- * Returns array of managers to show in combo box.
- * Overrides parent to call back to wwdialog if not null.
- */
- public ISystemFilterPoolManager[] getFilterPoolManagers()
- {
- if (wwdialog != null)
- return wwdialog.getFilterPoolManagers();
- else
- return super.getFilterPoolManagers();
- }
-
- /**
- * Returns the zero-based index of the manager name to preselect.
- * Overrides parent to call back to wwdialog if not null.
- */
- public int getFilterPoolManagerNameSelectionIndex()
- {
- if (wwdialog != null)
- return wwdialog.getFilterPoolManagerSelection();
- else
- return super.getFilterPoolManagerNameSelectionIndex();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterPoolReferenceSelectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterPoolReferenceSelectAction.java
deleted file mode 100644
index 038ec5438..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterPoolReferenceSelectAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * A selectable filter pool name action.
- * This is typically used to allow users to select a filter pool for referencing
- */
-public class SystemFilterPoolReferenceSelectAction extends SystemBaseAction
-
-{
- private ISystemFilterPool pool;
- private ISystemFilterPoolReferenceManager refMgr;
-
- /**
- * Constructor
- */
- public SystemFilterPoolReferenceSelectAction(Shell parent, ISystemFilterPool pool, ISystemFilterPoolReferenceManager refMgr)
- {
- super(pool.getName(), RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLREF_ID), parent);
- this.pool = pool;
- this.refMgr = refMgr;
- //setChecked(false);
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- //System.out.println("Pretend to select");
- try
- {
- refMgr.addReferenceToSystemFilterPool(pool);
- } catch (Exception exc)
- {
- SystemBasePlugin.logError("Unexpected error adding filter pool reference",exc); //$NON-NLS-1$
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterRemoveFilterPoolReferenceAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterRemoveFilterPoolReferenceAction.java
deleted file mode 100644
index 6d2c6dd96..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterRemoveFilterPoolReferenceAction.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to remove a filter pool reference
- */
-public class SystemFilterRemoveFilterPoolReferenceAction
- extends SystemBaseAction
-
-{
-
-
- /**
- * Constructor
- */
- public SystemFilterRemoveFilterPoolReferenceAction(Shell parent)
- {
- super(SystemResources.ACTION_RMVFILTERPOOLREF_LABEL,SystemResources.ACTION_RMVFILTERPOOLREF_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_DELETEREF_ID),
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- if (!(selectedObject instanceof ISystemFilterPoolReference))
- return false;
- // disable if this is a connection-unique filter pool
- else
- return ((ISystemFilterPoolReference)selectedObject).getReferencedFilterPool().getOwningParentName() == null;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- IStructuredSelection selections = getSelection();
- Iterator i = selections.iterator();
- ISystemFilterPoolReferenceManager fprMgr = null;
- while (i.hasNext())
- {
- ISystemFilterPoolReference poolReference = (ISystemFilterPoolReference)i.next();
- fprMgr = poolReference.getFilterPoolReferenceManager();
- fprMgr.removeSystemFilterPoolReference(poolReference,true); // true means do dereference
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterSelectFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterSelectFilterPoolsAction.java
deleted file mode 100644
index 2669a5af4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterSelectFilterPoolsAction.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Vector;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.dialogs.SystemSimpleSelectDialog;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
-import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action that displays the Select Filter Pools dialog, and which returns
- * an array of selected filter pools.
- * <p>
- * Dialog will display a root node for each manager, and then the filter pools
- * within each manager as children. User can select any pool from any of the
- * given managers.
- * <p>
- * Uses getName() on manager for display name of root nodes.
- * <p>
- * Typically, such a dialog is used to allow the user to select a subset of pools
- * that they will access in some context. There is framework support for such
- * selections, via SystemFilterPoolReferences. Each of these are a reference to a
- * filter pool, and the SystemFilterPoolReferenceManager class offers full support
- * for manager a list of such references, optionally even saving and restoring such
- * a list.
- *
- * <p>
- * You call the setFilterPoolManagers method to set the array of filter pool managers
- * this dialog allows the user to select from.
- * <p>
- * If you also call the optional method setFilterPoolReferenceManager, you need not
- * subclass this action. It will handle everything for you!!
- * <ul
- * <li>Preselects the filter pools currently referenced by one or more reference objects
- * in the filter pool reference manager.
- * <li>What OK is pressed, removes the previous references from the reference manager,
- * and adds references for the pools selected by the user.
- * </ul>
- *
- * You can either supply the label, dialog title, dialog prompt, filter pool image,
- * input filter pool managers and filter pool reference manager by calling the
- * appropriate setXXX methods, or by overriding the related getXXX methods.
- */
-public class SystemFilterSelectFilterPoolsAction
- extends SystemFilterAbstractFilterPoolAction
-
-{
-
-
- /**
- * Constructor when default label desired.
- */
- public SystemFilterSelectFilterPoolsAction(Shell parent)
- {
- super(parent,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SELECTFILTERPOOLS_ID),
- SystemResources.ACTION_SELECTFILTERPOOLS_LABEL, SystemResources.ACTION_SELECTFILTERPOOLS_TOOLTIP);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
- // set default help for action and dialog
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0043"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX + "dsfp0000"); //$NON-NLS-1$
- }
- /**
- * Constructor when given the translated action label
- */
- public SystemFilterSelectFilterPoolsAction(Shell parent, String title)
- {
- super(parent, title);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
- // set default help for action and dialog
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0043"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX + "dsfp0000"); //$NON-NLS-1$
- }
-
-
- /**
- * Constructor when given the translated action label
- */
- public SystemFilterSelectFilterPoolsAction(Shell parent, String title, String tooltip)
- {
- super(parent, title, tooltip);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
- // set default help for action and dialog
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0043"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX + "dsfp0000"); //$NON-NLS-1$
- }
-
-
- /**
- * Override of init in parent
- */
- protected void init()
- {
- super.init();
- dlgInputs.prompt = SystemResources.RESID_SELECTFILTERPOOLS_PROMPT;
- dlgInputs.title = SystemResources.RESID_SELECTFILTERPOOLS_TITLE;
- }
-
- /**
- * Creates our select-filter-pools dialog, and populates it with the list of
- * filter pools to select from.
- * <p>
- * <i>Assumes setFilterPoolManagers has been called.</i>
- * <p>
- * Dialog will display a root node for each manager, and then the filter pools
- * within each manager as children. User can select any pool from any of the
- * given managers.
- * <p>
- * Uses getName() on manager for display name of root nodes.
- *
- * @see org.eclipse.rse.ui.actions.SystemBaseDialogAction#run()
- */
- protected Dialog createDialog(Shell parent)
- {
- SystemSimpleSelectDialog dialog =
- new SystemSimpleSelectDialog(parent, getDialogTitle(), getDialogPrompt());
-
- ISystemFilterPoolManager[] mgrs = getFilterPoolManagers();
- ISystemFilterPoolReferenceManagerProvider sprmp = getReferenceManagerProviderSelection();
- ISystemFilterPoolManager[] additionalMgrs = null;
- if (sprmp != null)
- additionalMgrs = sprmp.getSystemFilterPoolReferenceManager().getAdditionalSystemFilterPoolManagers();
- if (additionalMgrs != null)
- {
- ISystemFilterPoolManager[] allmgrs = new ISystemFilterPoolManager[mgrs.length+additionalMgrs.length];
- int allidx = 0;
- for (int idx=0; idx<mgrs.length; idx++)
- allmgrs[allidx++] = mgrs[idx];
- for (int idx=0; idx<additionalMgrs.length; idx++)
- allmgrs[allidx++] = additionalMgrs[idx];
- mgrs = allmgrs;
- }
-
- SystemSimpleContentElement input =
- SystemFilterUIHelpers.getFilterPoolModel(getFilterPoolManagerProvider(), mgrs);
- preSelect(input);
- setValue(input);
-
- if (sprmp != null)
- {
- ISystemFilterPoolManager initialSelection = sprmp.getSystemFilterPoolReferenceManager().getDefaultSystemFilterPoolManager();
- if (initialSelection != null)
- {
- SystemSimpleContentElement initialElementSelection = SystemFilterUIHelpers.getDataElement(input, initialSelection);
- if (initialElementSelection != null)
- dialog.setRootToPreselect(initialElementSelection);
- }
- }
- return dialog;
- }
- /**
- * We override createDialog from parent, so this is a no-op.
- */
- public SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent)
- {
- return null;
- }
-
- /**
- * Walk elements deciding pre-selection
- */
- protected void preSelect(SystemSimpleContentElement inputElement)
- {
- super.preSelect(inputElement);
- }
- /**
- * Decide per pool if it should be selected or not.
- * Default behaviour is to select it if it is currently referenced.
- */
- protected boolean getFilterPoolPreSelection(ISystemFilterPool pool)
- {
- ISystemFilterPoolReferenceManagerProvider refMgrProvider = getReferenceManagerProviderSelection();
- if (refMgrProvider != null)
- {
- ISystemFilterPoolReferenceManager refMgr = refMgrProvider.getSystemFilterPoolReferenceManager();
- if (refMgr != null)
- {
- return refMgr.isSystemFilterPoolReferenced(pool);
- }
- else
- return false;
- }
- else
- return false;
- }
-
- /**
- * Called by parent class after dialog returns. We set the internal value attribute
- * to be the array of user selected filter pools.
- * <p>
- * After this action executes, simply call getValue() to get an
- * array of SystemFilterPool objects representing what pools the user selected.
- * A result of null means the dialog was cancelled.
- */
- protected Object getDialogValue(Dialog dlg)
- {
- SystemSimpleSelectDialog dialog = (SystemSimpleSelectDialog)dlg;
- if (!dialog.wasCancelled())
- {
- Vector selectedFilterPools = new Vector();
- SystemSimpleContentElement inputElement = dialog.getUpdatedContent();
- SystemSimpleContentElement[] mgrElements = inputElement.getChildren();
- for (int idx=0; idx<mgrElements.length; idx++)
- {
- SystemSimpleContentElement[] poolElements = mgrElements[idx].getChildren();
- for (int jdx=0; jdx<poolElements.length; jdx++)
- {
- if (poolElements[jdx].isSelected())
- selectedFilterPools.addElement(poolElements[jdx].getData());
- }
- }
-
- ISystemFilterPool[] selectedPoolArray = new ISystemFilterPool[selectedFilterPools.size()];
- for (int idx=0; idx<selectedFilterPools.size(); idx++)
- selectedPoolArray[idx] = (ISystemFilterPool)selectedFilterPools.elementAt(idx);
- return selectedPoolArray;
- }
- else
- return null;
- }
-
-
- /**
- * Method called when ok pressed on dialog and after getDialogValue has set the
- * value attribute to an array of SystemFilterPool objects for the selected pools.
- * <p>
- * By default, if the current selected object implements SystemFilterPoolReferenceManagerProvider,
- * then this will call setFilterPoolReferences on that selected object.
- * <p>
- * @param dlgOutput The array of SystemFilterPools selected by the user, as set in getDialogValue()
- */
- public void doOKprocessing(Object dlgOutput)
- {
- ISystemFilterPool[] selectedPools = (ISystemFilterPool[])dlgOutput;
- ISystemFilterPoolReferenceManagerProvider sfprmp = getReferenceManagerProviderSelection();
- if (sfprmp != null)
- {
- sfprmp.getSystemFilterPoolReferenceManager().setSystemFilterPoolReferences(selectedPools,true);
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsAction.java
deleted file mode 100644
index 68186b9e1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsAction.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [194268] action now assumes the first filter pool manager is selected if there was no selection
- * provided by the caller.
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.filters.SystemFilterPoolManagerUIProvider;
-import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
-import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * The action that displays the Work With Filter Pools dialog
- */
-public class SystemFilterWorkWithFilterPoolsAction
- extends SystemFilterAbstractFilterPoolAction
- implements SystemFilterPoolManagerUIProvider
-{
-
- private ValidatorFilterPoolName poolNameValidator = null;
-
- /**
- * Constructor when default label desired.
- */
- public SystemFilterWorkWithFilterPoolsAction(Shell parent)
- {
- super(parent,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS_ID),
- SystemResources.ACTION_WORKWITH_FILTERPOOLS_LABEL, SystemResources.ACTION_WORKWITH_FILTERPOOLS_TOOLTIP);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);
- allowOnMultipleSelection(false);
- // set default action and dialog help
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0044"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX + "dwfp0000"); //$NON-NLS-1$
- }
- /**
- * Constructor when default label desired, and you want to choose between
- * Work With -> Filter Pools and Work With Filter Pools.
- */
- public SystemFilterWorkWithFilterPoolsAction(Shell parent, boolean cascadingAction)
- {
- super(parent,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS_ID),
- cascadingAction ? SystemResources.ACTION_WORKWITH_FILTERPOOLS_LABEL : SystemResources.ACTION_WORKWITH_WWFILTERPOOLS_LABEL,
- cascadingAction ? SystemResources.ACTION_WORKWITH_FILTERPOOLS_TOOLTIP : SystemResources.ACTION_WORKWITH_WWFILTERPOOLS_TOOLTIP
- );
- if (cascadingAction)
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_WORKWITH);
- else
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- allowOnMultipleSelection(false);
- // set default action and dialog help
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0044"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX + "dwfp0000"); //$NON-NLS-1$
- }
- /**
- * Constructor when given the translated action label
- */
- public SystemFilterWorkWithFilterPoolsAction(Shell parent, String title)
- {
- super(parent, title);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- allowOnMultipleSelection(false);
- // set default action and dialog help
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0044"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX + "dwfp0000"); //$NON-NLS-1$
- }
-
-
- /**
- * Override of init in parent
- */
- protected void init()
- {
- super.init();
- dlgInputs.prompt = SystemResources.RESID_WORKWITHFILTERPOOLS_PROMPT;
- dlgInputs.title = SystemResources.RESID_WORKWITHFILTERPOOLS_TITLE;
- }
-
- /**
- * Reset between runs
- */
- public void reset()
- {
- }
-
- /**
- * Set the pool name validator for the rename action.
- * The work-with dialog automatically calls setExistingNamesList on it for each selection.
- */
- public void setFilterPoolNameValidator(ValidatorFilterPoolName pnv)
- {
- this.poolNameValidator = pnv;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- //return (selectedObject instanceof SystemFilterPoolReferenceManagerProvider); // override as appropriate
- return true; // override as appropriate
- }
-
-
- /**
- * Override of parent to create and return our specific filter pool dialog.
- */
- public SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent)
- {
- //SystemFilterPoolManager[] mgrs = getFilterPoolManagers();
- //SystemSimpleContentElement input = getTreeModel();
- //SystemFilterUIHelpers.getFilterPoolModel(getFilterPoolImageDescriptor(),mgrs);
-
- SystemFilterWorkWithFilterPoolsDialog dialog =
- new SystemFilterWorkWithFilterPoolsDialog(parent, getDialogTitle(), getDialogPrompt(), this);
-
- if (poolNameValidator != null)
- dialog.setFilterPoolNameValidator(poolNameValidator);
-
- //SystemSimpleContentElement initialElementSelection = getTreeModelPreSelection(input);
- //if (initialElementSelection != null)
- //dialog.setRootToPreselect(initialElementSelection);
-
- return dialog;
- }
-
- /**
- * Callback for dialog to refresh its contents
- */
- public SystemSimpleContentElement getTreeModel()
- {
- ISystemFilterPoolManager[] mgrs = getFilterPoolManagers();
- SystemSimpleContentElement input =
- SystemFilterUIHelpers.getFilterPoolModel(getFilterPoolManagerProvider(), mgrs);
- return input;
- }
-
- /**
- * Callback for dialog to refresh its contents
- */
- public SystemSimpleContentElement getTreeModelPreSelection(SystemSimpleContentElement input) {
- SystemSimpleContentElement initialElementSelection = null;
- ISystemFilterPoolReferenceManagerProvider sprmp = getReferenceManagerProviderSelection();
- if (sprmp != null) {
- ISystemFilterPoolManager initialSelection = sprmp.getSystemFilterPoolReferenceManager().getDefaultSystemFilterPoolManager();
- if (initialSelection != null) {
- initialElementSelection = SystemFilterUIHelpers.getDataElement(input, initialSelection);
- }
- } else {
- SystemSimpleContentElement[] children = input.getChildren();
- if (children.length > 0) {
- initialElementSelection = children[0];
- }
- }
- return initialElementSelection;
- }
-
- /**
- * We are a special case of dialog, where we do not need to do anything
- * upon return from the dialog, as the dialog itself does it all.
- */
- protected Object getDialogValue(Dialog dlg)
- {
- return null;
- }
-
- /**
- * Because we return null from getDialogValue(Dialog dlg), this
- * method will never be called.
- */
- public void doOKprocessing(Object dlgValue)
- {
-
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java
deleted file mode 100644
index 16f6784d3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemFilterWorkWithFilterPoolsRefreshAllAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Michael Berger (IBM) - 146339 Added refresh action graphic.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to refresh the entire Remote System Explorer tree view
- */
-public class SystemFilterWorkWithFilterPoolsRefreshAllAction extends SystemBaseAction
-
-{
-
-
- private TreeViewer viewer = null;
-
- /**
- * Constructor
- */
- public SystemFilterWorkWithFilterPoolsRefreshAllAction(TreeViewer viewer, Shell parent)
- {
- super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID),
- parent);
- this.viewer = viewer;
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
- }
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- /**
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- viewer.refresh();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemImportConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemImportConnectionAction.java
deleted file mode 100644
index bfae6ba5d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemImportConnectionAction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Dykstal (IBM) - [216858] provide ability to import and export connections
- * David Dykstal (IBM) - [233876] filters lost after restart
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.core.model.ISystemProfileOperation;
-import org.eclipse.rse.internal.core.model.SystemProfileManager;
-import org.eclipse.rse.internal.persistence.RSEEnvelope;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-
-import com.ibm.icu.text.MessageFormat;
-
-/**
- * This action is used to import a connection from a file into the selected profile.
- */
-public class SystemImportConnectionAction extends SystemBaseAction {
-
- private class ImportJob extends Job {
-
- private ISystemProfile profile = null;
- private File inFile = null;
-
- public ImportJob(File inFile, ISystemProfile profile) {
- super(SystemResources.SystemImportConnectionAction_ImportJobName);
- this.inFile = inFile;
- this.profile = profile;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- protected IStatus run(final IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- final FileInputStream in = new FileInputStream(inFile);
- // run inside an ISystemProfileOperation to ensure that the changes are committed
- status = SystemProfileManager.run(new ISystemProfileOperation() {
- public IStatus run() {
- IStatus operationStatus = Status.OK_STATUS;
- try {
- final RSEEnvelope envelope = new RSEEnvelope();
- envelope.get(in, monitor);
- envelope.mergeWith(profile);
- } catch (CoreException e) {
- // log the exception and return the status code
- operationStatus = e.getStatus();
- String message = operationStatus.getMessage();
- if (message == null) {
- message = SystemResources.SystemImportConnectionAction_CoreExceptionFound;
- }
- SystemBasePlugin.logError(message, e);
- }
- return operationStatus;
- }
- });
- } catch (FileNotFoundException e) {
- // should not happen, log as unexpected
- SystemBasePlugin.logError(SystemResources.SystemImportConnectionAction_UnexpectedException, e);
- }
- return status;
- }
-
- }
-
- /**
- * Creates a new action to import a connection into a profile.
- */
- public SystemImportConnectionAction() {
- super(SystemResources.RESID_IMPORT_CONNECTION_ACTION_LABEL, SystemResources.RESID_IMPORT_CONNECTION_ACTION_TOOLTIP, null);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX + "ActionImportConnectionDefinitions"); //$NON-NLS-1$
- }
-
- /**
- * The import action can be run if the selection contains profiles or hosts.
- * @return true if the selection contains a profile or a host.
- */
- public boolean checkObjectType(Object obj) {
- return (obj instanceof ISystemProfile || obj instanceof IHost);
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run() {
- FileDialog openDialog = new FileDialog(shell, SWT.OPEN);
- String path = openDialog.open();
- if (path != null) {
- File inFile = new File(path);
- if (inFile.exists()) {
- if (inFile.canRead()) {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISystemProfileManager profileManager = registry.getSystemProfileManager();
- ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile();
- IStructuredSelection selection = getSelection();
- if (selection != null && selection.size() > 0) {
- Object selected = getFirstSelection();
- if (selected instanceof IHost) {
- profile = ((IHost)selected).getSystemProfile();
- } else if (selected instanceof ISystemProfile) {
- profile = (ISystemProfile) selected;
- }
- }
- ImportJob importJob = new ImportJob(inFile, profile);
- importJob.schedule();
- } else {
- String title = SystemResources.SystemImportConnectionAction_Error;
- String message = MessageFormat.format(SystemResources.SystemImportConnectionAction_FileNotReadableCondition, new String[] {path});
- MessageDialog.openError(shell, title, message);
- }
- } else {
- String title = SystemResources.SystemImportConnectionAction_Error;
- String message = MessageFormat.format(SystemResources.SystemImportConnectionAction_FileNotFoundCondition, new String[] {path});
- MessageDialog.openError(shell, title, message);
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveConnectionAction.java
deleted file mode 100644
index f9c2b4795..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveConnectionAction.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.actions.SystemBaseCopyAction;
-import org.eclipse.rse.ui.dialogs.SystemRenameSingleDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Move a connection action.
- */
-public class SystemMoveConnectionAction extends SystemBaseCopyAction
-{
-
- private SystemSimpleContentElement initialSelectionElement = null;
-
- /**
- * Constructor
- */
- public SystemMoveConnectionAction(Shell parent)
- {
- super(parent, SystemResources.ACTION_MOVE_CONNECTION_LABEL, MODE_MOVE);
- //allowOnMultipleSelection(false); // too hard to handle, for now!
- setToolTipText(SystemResources.ACTION_MOVE_CONNECTION_TOOLTIP);
- sr = RSECorePlugin.getTheSystemRegistry();
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0020"); //$NON-NLS-1$
- setDialogHelp(RSEUIPlugin.HELPPREFIX+"dmcn0000"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We intercept to ensure only connections from the same profile are selected.
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- if (sr.getActiveSystemProfiles().length <= 1)
- return false;
- boolean enable = true;
- ISystemProfile prevProfile = null;
- Iterator e= selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof IHost)
- {
- IHost conn = (IHost)selectedObject;
- if (prevProfile == null)
- prevProfile = conn.getSystemProfile();
- else
- enable = (prevProfile == conn.getSystemProfile());
- if (enable)
- prevProfile = conn.getSystemProfile();
- }
- else
- enable = false;
- }
- return enable;
- }
-
- // --------------------------
- // PARENT METHOD OVERRIDES...
- // --------------------------
-
- /**
- * @see SystemBaseCopyAction#checkForCollision(Shell, IProgressMonitor, Object, Object, String)
- */
- protected String checkForCollision(Shell shell, IProgressMonitor monitor,
- Object targetContainer, Object oldObject, String oldName)
- {
- ISystemProfile profile = (ISystemProfile)targetContainer;
- String newName = oldName;
- IHost match = sr.getHost(profile, oldName);
- if (match != null)
- {
- //monitor.setVisible(false); wish we could!
- //ValidatorConnectionName validator = new ValidatorConnectionName(sr.getConnectionAliasNames(profile));
- //SystemCollisionRenameDialog dlg = new SystemCollisionRenameDialog(shell, validator, oldName);
- SystemRenameSingleDialog dlg = new SystemRenameSingleDialog(shell, true, match, null); // true => copy-collision-mode
- dlg.open();
- if (!dlg.wasCancelled())
- newName = dlg.getNewName();
- else
- newName = null;
- }
- return newName;
- }
- /**
- * @see SystemBaseCopyAction#doCopy(Object, Object, String, IProgressMonitor)
- */
- protected boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception
- {
- IHost oldConnection = (IHost)oldObject;
- //String oldName = oldConnection.getAliasName();
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"starting to copy "+oldName+" to "+newName);
- ISystemProfile targetProfile = (ISystemProfile)targetContainer;
- IHost newConn = sr.moveHost(oldConnection, targetProfile, newName, monitor);
- return (newConn != null);
- }
-
- /**
- * @see SystemBaseCopyAction#getTreeModel()
- */
- protected SystemSimpleContentElement getTreeModel()
- {
- return getProfileTreeModel(getFirstSelectedConnection().getSystemProfile());
- }
- /**
- * @see SystemBaseCopyAction#getTreeInitialSelection()
- */
- protected SystemSimpleContentElement getTreeInitialSelection()
- {
- return initialSelectionElement;
- }
-
- /**
- * @see SystemBaseCopyAction#getPromptString()
- */
- protected String getPromptString()
- {
- return SystemResources.RESID_MOVE_TARGET_PROFILE_PROMPT;
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage()
- */
- protected SystemMessage getCopyingMessage()
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVECONNECTIONS_PROGRESS);
- }
- /**
- * @see SystemBaseCopyAction#getCopyingMessage( String)
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVECONNECTION_PROGRESS).makeSubstitution(oldName);
- }
-
- /**
- * @see SystemBaseCopyAction#getOldObjects()
- */
- protected Object[] getOldObjects()
- {
- return getSelectedConnections();
- }
-
- /**
- * @see SystemBaseCopyAction#getOldNames()
- */
- protected String[] getOldNames()
- {
- IHost[] conns = getSelectedConnections();
- String[] names = new String[conns.length];
- for (int idx=0; idx<conns.length; idx++)
- names[idx] = conns[idx].getAliasName();
- return names;
- }
-
- /**
- * Get the currently selected connections
- */
- protected IHost[] getSelectedConnections()
- {
- IStructuredSelection selection = getSelection();
- IHost[] conns = new IHost[selection.size()];
- Iterator i = selection.iterator();
- int idx=0;
- while (i.hasNext())
- {
- conns[idx++] = (IHost)i.next();
- }
- return conns;
- }
- /**
- * Get the first selected connection
- */
- protected IHost getFirstSelectedConnection()
- {
- return (IHost)getFirstSelection();
- }
-
- // ------------------
- // PRIVATE METHODS...
- // ------------------
-
- /**
- * Create and return data model to populate selection tree with.
- * @param profile whose tree model element is not to be include
- */
- protected SystemSimpleContentElement getProfileTreeModel(ISystemProfile profile)
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Profiles", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- ISystemProfile[] profiles = RSECorePlugin.getTheSystemRegistry().getActiveSystemProfiles();
- ImageDescriptor image = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
-
- if (profiles == null)
- return veryRootElement;
-
- Vector veryRootChildren = new Vector();
-
- for (int idx=0; idx<profiles.length; idx++)
- {
- if (!(profiles[idx]==profile))
- {
- SystemSimpleContentElement profileElement =
- new SystemSimpleContentElement(profiles[idx].getName(),
- profiles[idx], veryRootElement, (Vector)null);
- profileElement.setRenamable(false);
- profileElement.setDeletable(false);
- profileElement.setImageDescriptor(image);
- veryRootChildren.addElement(profileElement);
- if (initialSelectionElement == null)
- initialSelectionElement = profileElement;
- }
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveDownConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveDownConnectionAction.java
deleted file mode 100644
index 1c708ef23..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveDownConnectionAction.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.SystemSortableSelection;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to move the current connection down in the list
- */
-public class SystemMoveDownConnectionAction extends SystemBaseAction
-
-{
-
- private ISystemProfile prevProfile = null;
-
- /**
- * Constructor for SystemMoveDownAction
- */
- public SystemMoveDownConnectionAction(Shell parent)
- {
- super(SystemResources.ACTION_MOVEDOWN_LABEL, SystemResources.ACTION_MOVEDOWN_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID),
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0002"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We intercept to ensure only connections from the same profile are selected.
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- prevProfile = null;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof IHost)
- {
- IHost conn = (IHost)selectedObject;
- int connCount = sr.getHostCountWithinProfile(conn)-1;
- if (prevProfile == null)
- prevProfile = conn.getSystemProfile();
- else
- enable = (prevProfile == conn.getSystemProfile());
- if (enable)
- {
- enable = (sr.getHostPosition(conn) < connCount);
- prevProfile = conn.getSystemProfile();
- }
- }
- else
- enable = false;
- }
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- SystemSortableSelection[] sortableArray = SystemSortableSelection.makeSortableArray(getSelection());
- IHost conn = null;
- for (int idx=0; idx<sortableArray.length; idx++)
- {
- conn = (IHost)sortableArray[idx].getSelectedObject();
- sortableArray[idx].setPosition(sr.getHostPosition(conn));
- }
- SystemSortableSelection.sortArray(sortableArray);
- IHost[] conns = (IHost[])SystemSortableSelection.getSortedObjects(sortableArray, new IHost[sortableArray.length]);
- sr.moveHosts(prevProfile.getName(),conns,1);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveUpConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveUpConnectionAction.java
deleted file mode 100644
index 9ffb6a043..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemMoveUpConnectionAction.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.SystemSortableSelection;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to move the current connection up in the list
- */
-public class SystemMoveUpConnectionAction extends SystemBaseAction
-
-{
-
- private ISystemProfile prevProfile = null;
-
- /**
- * Constructor for SystemMoveUpAction
- */
- public SystemMoveUpConnectionAction(Shell parent)
- {
- super(SystemResources.ACTION_MOVEUP_LABEL, SystemResources.ACTION_MOVEUP_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID),
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORDER);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0001"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We intercept to ensure only connections from the same profile are selected.
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- prevProfile = null;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof IHost)
- {
- IHost conn = (IHost)selectedObject;
- if (prevProfile == null)
- prevProfile = conn.getSystemProfile();
- else
- enable = (prevProfile == conn.getSystemProfile());
- if (enable)
- {
- enable = (sr.getHostPosition(conn) > 0);
- prevProfile = conn.getSystemProfile();
- }
- }
- else
- enable = false;
- }
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- SystemSortableSelection[] sortableArray = SystemSortableSelection.makeSortableArray(getSelection());
- IHost conn = null;
- for (int idx=0; idx<sortableArray.length; idx++)
- {
- conn = (IHost)sortableArray[idx].getSelectedObject();
- sortableArray[idx].setPosition(sr.getHostPosition(conn));
- }
- SystemSortableSelection.sortArray(sortableArray);
- IHost[] conns = (IHost[])SystemSortableSelection.getSortedObjects(sortableArray, new IHost[sortableArray.length]);
-
- sr.moveHosts(prevProfile.getName(),conns,-1);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemNewProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemNewProfileAction.java
deleted file mode 100644
index 746fb89d4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemNewProfileAction.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamView;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseWizardAction;
-import org.eclipse.rse.ui.wizards.SystemNewProfileWizard;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The action that displays the New Profile wizard
- */
-public class SystemNewProfileAction extends SystemBaseWizardAction {
-
- /**
- * Constructor for SystemNewProfileAction for "New -> Profile..."
- * @param parent the parent shell in which this action executes
- */
- public SystemNewProfileAction(Shell parent) {
- super(SystemResources.ACTION_NEWPROFILE_LABEL, SystemResources.ACTION_NEWPROFILE_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWPROFILE_ID), parent);
- setSelectionSensitive(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0003"); //$NON-NLS-1$
- }
-
- /**
- * Constructor for SystemNewProfileAction where you can choose between "New profile..." and "New -> Profile"
- * @param parent the parent shell in which this action executes
- * @param cascading if true then use the "New -> Profile" style, else use the "New profile..." style.
- */
- public SystemNewProfileAction(Shell parent, boolean cascading) {
- super(cascading ? SystemResources.ACTION_NEWPROFILE_LABEL : SystemResources.ACTION_NEW_PROFILE_LABEL, cascading ? SystemResources.ACTION_NEWPROFILE_TOOLTIP
- : SystemResources.ACTION_NEW_PROFILE_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWPROFILE_ID), parent);
- setSelectionSensitive(false);
- if (cascading)
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- else
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING);
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0003"); //$NON-NLS-1$
- }
-
- /**
- * Refresh the enabled state
- */
- public void refreshEnablement() {
- setEnabled(isEnabled());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.actions.SystemBaseAction#isEnabled()
- */
- public boolean isEnabled() {
- return true;
- /*
- * From the old javadoc:
- * We disable this action if it is a new workspace and the user has yet to create
- * their first connection, and hence rename their default profile.
- * @return true if the action is enabled
- *
- * defect 43428 was an early RSE defect whose fix prevented the creation of profiles until the first
- * connection was created. However, new default profiles are created when RSE is initially activated
- * so there is no need to inhibit profile creation.
- */
-// ISystemProfile defaultProfile = RSECorePlugin.getTheSystemProfileManager().getDefaultPrivateSystemProfile();
-// if (defaultProfile != null)
-// return false;
-// else
-// return true;
- }
-
- /**
- * @return a new Wizard object for creating a profile.
- */
- protected IWizard createWizard() {
- return new SystemNewProfileWizard();
- }
-
- /**
- * Typically, the wizard's performFinish method does the work required by
- * a successful finish of the wizard. However, often we also want to be
- * able to extract user-entered data from the wizard, by calling getters
- * in this action. To enable this, override this method to populate your
- * output instance variables from the completed wizard, which is passed
- * as a parameter. This is only called after successful completion of the
- * wizard.
- * @param wizard the wizard that was just completed
- */
- protected void postProcessWizard(IWizard wizard) {
- if (getViewer() instanceof SystemTeamView) {
- getViewer().refresh();
- }
-
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenExplorerPerspectiveAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenExplorerPerspectiveAction.java
deleted file mode 100644
index e5f7f86ab..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenExplorerPerspectiveAction.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * David McKnight (IBM) - [187342] Open in New Window expand failed error when not connected
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.model.ISystemPromptableObject;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.actions.OpenInNewWindowAction;
-
-
-/**
- * The action allows users to open a new Remote System Explorer perspective, anchored
- * by the currently selected resource.
- */
-public class SystemOpenExplorerPerspectiveAction
- extends SystemBaseAction
-
-{
- //private boolean replaceEnabled = true;
- private IWorkbenchWindow window;
-
- /**
- * Constructor
- */
- public SystemOpenExplorerPerspectiveAction(Shell parent, IWorkbenchWindow currentWorkbenchWindow)
- {
- super(SystemResources.ACTION_OPENEXPLORER_DIFFPERSP2_LABEL, SystemResources.ACTION_OPENEXPLORER_DIFFPERSP2_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PERSPECTIVE_ID),
- parent);
- this.window = currentWorkbenchWindow;
-
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPEN);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0016"); //$NON-NLS-1$
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We intercept to ensure only connections from the same profile are selected.
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- Object selected = selection.getFirstElement();
- if (selected instanceof ISystemFilterReference)
- {
- if ( ((ISystemFilterReference)selected).getReferencedFilter().isPromptable() )
- enable = false;
- }
- else if (selected instanceof ISystemPromptableObject)
- enable = false;
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see Action#run()
- */
- public void run()
- {
- final IAdaptable input = getPageInput();
- final ISubSystem ss = getSubSystem(input);
- if (ss!=null && !ss.isConnected()) {
- // Connect if the object's children will require a live connection. If the connect is made, then
- // the open window occurs as a result of the callback to connect.
- try
- {
- ss.connect(false,
- new IRSECallback() // call back for opening the window after the connect
- {
- public void done(IStatus status, Object object)
- {
- if (ss.isConnected()) // only open the window if we're connected
- {
- Display.getDefault().asyncExec(new Runnable()
- {
- public void run()
- {
- openWindow(input);
- }
- });
- }
-
- }
- });
- }
- catch (Exception e) {
- // ignore since connect failed (and don't show in the window)
- SystemBasePlugin.logError(e.getMessage(), e);
- }
- }
- else {
- openWindow(input);
- }
- }
-
- /**
- * Returns the associated subsystem if the object is remote, a filter or a subsystem
- * @param input the input object
- * @return
- */
- private ISubSystem getSubSystem(IAdaptable input)
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)input.getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null) {
- if ((input instanceof ISystemFilterReference)
- || input instanceof ISubSystem
- || adapter.isRemote(input)) // not sure if we'd ever have
- // a remote object when not connected
- {
- return adapter.getSubSystem(input);
- }
- }
- return null;
- }
-
-
- /**
- * Open the input object in a new window
- * @param input the input to the new window
- */
- protected void openWindow(IAdaptable input)
- {
- OpenInNewWindowAction workbenchOpenAction = // NEW FOR RELEASE 2
- new OpenInNewWindowAction(window,input);
- workbenchOpenAction.run();
- }
-
- /**
- * Sets the page input.
- *
- * @param input the page input
- */
- public void setPageInput(IAdaptable input)
- {
- }
- /**
- * Get the page input.
- * Will use explicitly set input if given, else deduces from selection
- */
- public IAdaptable getPageInput()
- {
- //if (pageInput != null) safer to always recalculate!
- // return pageInput;
- //else
- {
- Object firstSel = getFirstSelection();
- if ((firstSel != null) && (firstSel instanceof IAdaptable))
- return (IAdaptable)firstSel;
- else
- return null;
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenRSEPerspectiveAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenRSEPerspectiveAction.java
deleted file mode 100644
index f40be6180..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemOpenRSEPerspectiveAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers;
-
-
-/**
- * Open the RSE perspective (used in welcome.xml)
- */
-public class SystemOpenRSEPerspectiveAction extends Action {
-
-
- public SystemOpenRSEPerspectiveAction()
- {
- super();
- }
-
- /**
- * @see Action#run()
- */
- public void run()
- {
- SystemPerspectiveHelpers.openRSEPerspective();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java
deleted file mode 100644
index 1e63e4327..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceQualifyConnectionNamesAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemPreferenceChangeEvents;
-import org.eclipse.rse.internal.core.model.SystemPreferenceChangeEvent;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action is a shortcut to the preferences setting for showing connection names
- * qualified by profile name.
- */
-public class SystemPreferenceQualifyConnectionNamesAction extends SystemBaseAction
-
-{
- /**
- * Constructor
- */
- public SystemPreferenceQualifyConnectionNamesAction(Shell parent)
- {
- super(SystemResources.ACTION_QUALIFY_CONNECTION_NAMES_LABEL,SystemResources.ACTION_QUALIFY_CONNECTION_NAMES_TOOLTIP,
- parent);
- setSelectionSensitive(false);
- allowOnMultipleSelection(true);
- setChecked(RSEUIPlugin.getTheSystemRegistryUI().getQualifiedHostNames());
-
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0008"); //$NON-NLS-1$
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- boolean newState = isChecked();
- RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(newState);
- firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,
- !newState,newState); // defect 41794
- }
-
- /**
- * Fire a preference change event
- */
- private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue)
- {
- RSECorePlugin.getTheSystemRegistry().fireEvent(
- new SystemPreferenceChangeEvent(type,
- oldValue ? Boolean.TRUE : Boolean.FALSE,
- newValue ? Boolean.TRUE : Boolean.FALSE));
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceRestoreStateAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceRestoreStateAction.java
deleted file mode 100644
index 1614d0b3f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceRestoreStateAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemPreferenceChangeEvents;
-import org.eclipse.rse.internal.core.model.SystemPreferenceChangeEvent;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action is a shortcut to the preferences setting for restoring the RSE to its
- * previous state.
- */
-public class SystemPreferenceRestoreStateAction extends SystemBaseAction
-{
- //private ISystemRegistry sr = null;
-
- /**
- * Constructor
- */
- public SystemPreferenceRestoreStateAction(Shell parent)
- {
- super(SystemResources.ACTION_RESTORE_STATE_PREFERENCE_LABEL,SystemResources.ACTION_RESTORE_STATE_PREFERENCE_TOOLTIP, parent);
- setSelectionSensitive(false);
- allowOnMultipleSelection(true);
- //sr = RSECorePlugin.getTheSystemRegistry();
- setChecked(SystemPreferencesManager.getRememberState());
-
- setHelp(RSEUIPlugin.HELPPREFIX+"aprefres"); //$NON-NLS-1$
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- boolean newState = isChecked();
- SystemPreferencesManager.setRememberState(newState);
- firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_RESTORESTATE,
- !newState,newState);
- }
-
- /**
- * Fire a preference change event
- */
- private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue)
- {
- RSECorePlugin.getTheSystemRegistry().fireEvent(
- new SystemPreferenceChangeEvent(type,
- oldValue ? Boolean.TRUE : Boolean.FALSE,
- newValue ? Boolean.TRUE : Boolean.FALSE));
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceShowFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceShowFilterPoolsAction.java
deleted file mode 100644
index 357a29e2b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemPreferenceShowFilterPoolsAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemPreferenceChangeEvents;
-import org.eclipse.rse.internal.core.model.SystemPreferenceChangeEvent;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to decide whether or not to show filter pools in the Remote System Explorer.
- * It is a fastpath/convenience method for this option in the preferences page.
- */
-public class SystemPreferenceShowFilterPoolsAction extends SystemBaseAction
-
-{
-
- //private SystemRegistry sr = null;
- /**
- * Constructor
- */
- public SystemPreferenceShowFilterPoolsAction(Shell parent)
- {
- super(SystemResources.ACTION_PREFERENCE_SHOW_FILTERPOOLS_LABEL,SystemResources.ACTION_PREFERENCE_SHOW_FILTERPOOLS_TOOLTIP,
- parent);
- allowOnMultipleSelection(true);
- setChecked(SystemPreferencesManager.getShowFilterPools());
- setSelectionSensitive(false);
-
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0011"); //$NON-NLS-1$
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- boolean newState = isChecked();
- SystemPreferencesManager.setShowFilterPools(newState);
- firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS,
- !newState,newState); // defect 41794
- }
-
- /**
- * Fire a preference change event
- */
- private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue)
- {
- RSECorePlugin.getTheSystemRegistry().fireEvent(
- new SystemPreferenceChangeEvent(type,
- oldValue ? Boolean.TRUE : Boolean.FALSE,
- newValue ? Boolean.TRUE : Boolean.FALSE));
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameCopyAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameCopyAction.java
deleted file mode 100644
index 1a248a11d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameCopyAction.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.SystemCopyProfileDialog;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * A copy profile action. Will copy the profile, and all connections for the profile.
- * We must first prompt user for a new name for the copied profile.
- */
-public class SystemProfileNameCopyAction extends SystemBaseDialogAction
- implements IRunnableWithProgress
-{
- private ISystemProfile profile, newProfile;
- //private ISystemProfileManager mgr;
- private ISystemRegistry sr;
- private String oldName,newName;
- private boolean makeActive;
- private Exception runException = null;
-
- /**
- * Constructor for selection-sensitive popup menu for profiles in Team view.
- */
- public SystemProfileNameCopyAction(Shell shell)
- {
- super(SystemResources.ACTION_PROFILE_COPY_LABEL, SystemResources.ACTION_PROFILE_COPY_TOOLTIP,
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
- shell);
- //mgr = SystemProfileManager.getSystemProfileManager();
- sr = RSECorePlugin.getTheSystemRegistry();
- setSelectionSensitive(true);
- allowOnMultipleSelection(false);
- setHelp(RSEUIPlugin.HELPPREFIX+"actndupr"); //$NON-NLS-1$
- }
-
- /**
- * Set the profile
- */
- public void setProfile(ISystemProfile profile)
- {
- this.profile = profile;
- }
-
- /**
- * Override of parent
- * @see #run()
- */
- protected Dialog createDialog(Shell parent)
- {
- return new SystemCopyProfileDialog(parent, profile);
- }
-
- /**
- * Required by parent. We use it to return the new name
- */
- protected Object getDialogValue(Dialog dlg)
- {
- newName = null;
- SystemCopyProfileDialog rnmDlg = (SystemCopyProfileDialog)dlg;
- if (!rnmDlg.wasCancelled())
- {
- oldName = profile.getName();
- newName = rnmDlg.getNewName();
- makeActive = rnmDlg.getMakeActive();
- IRunnableContext runnableContext = getRunnableContext();
- try
- {
- runnableContext.run(false,false,this); // inthread, cancellable, IRunnableWithProgress
- if (makeActive && (newProfile!=null))
- sr.setSystemProfileActive(newProfile, true);
- }
- catch (java.lang.reflect.InvocationTargetException exc) // unexpected error
- {
- showOperationMessage(exc, getShell());
- //throw (Exception) exc.getTargetException();
- }
- catch (Exception exc)
- {
- showOperationMessage(exc, getShell());
- //throw exc;
- }
- }
- return newName;
- }
- /**
- * Get an IRunnable context to show progress in. If there is currently a dialog or wizard up with
- * a progress monitor in it, we will use this, else we will create a progress monitor dialog.
- */
- protected IRunnableContext getRunnableContext()
- {
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc == null)
- irc = new ProgressMonitorDialog(getShell());
- return irc;
- }
-
-
- // ----------------------------------
- // INTERNAL METHODS...
- // ----------------------------------
- /**
- * Method required by IRunnableWithProgress interface.
- * Allows execution of a long-running operation modally by via a thread.
- * In our case, it runs the copy operation with a visible progress monitor
- */
- public void run(IProgressMonitor monitor)
- throws java.lang.reflect.InvocationTargetException,
- java.lang.InterruptedException
- {
- String msg = getCopyingMessage(oldName,newName);
- runException = null;
-
- try
- {
- int steps = 0;
- IHost[] conns = sr.getHostsByProfile(profile);
- if ((conns != null) && (conns.length > 0))
- steps = conns.length;
- steps += 2; // for filterpools and subsystems
- monitor.beginTask(msg, steps);
- newProfile = sr.copySystemProfile(profile, newName,makeActive,monitor);
- monitor.done();
- }
- catch(java.lang.InterruptedException exc)
- {
- monitor.done();
- runException = exc;
- throw (java.lang.InterruptedException)runException;
- }
- catch(Exception exc)
- {
- monitor.done();
- runException = new java.lang.reflect.InvocationTargetException(exc);
- throw (java.lang.reflect.InvocationTargetException)runException;
- }
-
- }
-
-
- /**
- * Helper method to return the message "Copying &1 to &2..."
- */
- public static String getCopyingMessage(String oldName, String newName)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPY_PROGRESS);
- msg.makeSubstitution(oldName,newName);
- return msg.getLevelOneText();
- }
-
- /**
- * Helper method to show an error message resulting from the attempted operation.
- */
- protected void showOperationMessage(Exception exc, Shell shell)
- {
- if (exc instanceof java.lang.InterruptedException)
- showOperationCancelledMessage(shell);
- else if (exc instanceof java.lang.reflect.InvocationTargetException)
- showOperationErrorMessage(shell, ((java.lang.reflect.InvocationTargetException)exc).getTargetException());
- else
- showOperationErrorMessage(shell, exc);
- }
-
- /**
- * Show an error message when the operation fails.
- * Shows a common message by default.
- * Overridable.
- */
- protected void showOperationErrorMessage(Shell shell, Throwable exc)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED).makeSubstitution(exc.getMessage()));
- msgDlg.open();
- SystemBasePlugin.logError("Copy profile operation failed",exc); //$NON-NLS-1$
- }
- /**
- * Show an error message when the user cancels the operation.
- * Shows a common message by default.
- * Overridable.
- */
- protected void showOperationCancelledMessage(Shell shell)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELLED));
- msgDlg.open();
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameSelectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameSelectAction.java
deleted file mode 100644
index 9703421c1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemProfileNameSelectAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.core.model.SystemProfileManager;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * A selectable profile name action.
- */
-public class SystemProfileNameSelectAction extends SystemBaseAction
-{
- private ISystemProfile profile;
-
- /**
- * Constructor
- */
- public SystemProfileNameSelectAction(Shell parent, ISystemProfile profile)
- {
- super(profile.getName(),parent);
- this.profile = profile;
- ISystemProfileManager mgr = SystemProfileManager.getDefault();
- setChecked(mgr.isSystemProfileActive(profile.getName()));
- setSelectionSensitive(false);
-
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0004"); //$NON-NLS-1$
- }
-
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.setSystemProfileActive(profile, isChecked());
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStartAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStartAction.java
deleted file mode 100644
index 8110e6e4c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStartAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * This is the "Start" action that shows up under a remote server action
- * within the Remote Servers cascading menu.
- */
-public class SystemRemoteServerStartAction extends SystemBaseAction
-{
- private SystemCascadingRemoteServerBaseAction parentAction;
-
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- * @param parentAction The action that cascades into this action.
- */
- public SystemRemoteServerStartAction(Shell shell, SystemCascadingRemoteServerBaseAction parentAction)
- {
- super(SystemResources.ACTION_REMOTESERVER_START_LABEL,SystemResources.ACTION_REMOTESERVER_START_TOOLTIP, shell);
- this.parentAction = parentAction;
- allowOnMultipleSelection(false);
- //setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- setHelp(RSEUIPlugin.HELPPREFIX+"actnstsv"); //$NON-NLS-1$
- }
-
- /**
- * Called when this action is selection from the popup menu.
- * Calls {@link SystemCascadingRemoteServerBaseAction#startServer()} in the parent action.
- */
- public void run()
- {
- boolean ok = parentAction.startServer();
- setEnabled(!ok);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStopAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStopAction.java
deleted file mode 100644
index 04b6a33be..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRemoteServerStopAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * This is the "Stop" action that shows up under a remote server action
- * within the Remote Servers cascading menu.
- */
-public class SystemRemoteServerStopAction extends SystemBaseAction
-{
- private SystemCascadingRemoteServerBaseAction parentAction;
-
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- * @param parentAction The action that cascades into this action.
- */
- public SystemRemoteServerStopAction(Shell shell, SystemCascadingRemoteServerBaseAction parentAction)
- {
- super(SystemResources.ACTION_REMOTESERVER_STOP_LABEL,SystemResources.ACTION_REMOTESERVER_STOP_TOOLTIP, shell);
- this.parentAction = parentAction;
- allowOnMultipleSelection(false);
- //setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- setHelp(RSEUIPlugin.HELPPREFIX+"actnspsv"); //$NON-NLS-1$
- }
-
- /**
- * Called when this action is selection from the popup menu.
- * Calls {@link SystemCascadingRemoteServerBaseAction#stopServer()} in the parent action.
- */
- public void run()
- {
- boolean ok = parentAction.stopServer();
- setEnabled(!ok);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemResolveFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemResolveFilterStringAction.java
deleted file mode 100644
index 7bae8eabe..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemResolveFilterStringAction.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.dialogs.SystemResolveFilterStringDialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action for testing a given filter string by resolving it and showing the resolve results
- */
-public class SystemResolveFilterStringAction extends SystemTestFilterStringAction
-{
-
-
- /**
- * Constructor when input subsystem and filter string are known already
- */
- public SystemResolveFilterStringAction(Shell shell, ISubSystem subsystem, String filterString)
- {
- super(shell, subsystem, filterString);
- }
-
- /**
- * Constructor when input subsystem and filter string are not known already.
- * @see #setSubSystem(ISubSystem)
- * @see #setFilterString(String)
- */
- public SystemResolveFilterStringAction(Shell shell)
- {
- super(shell);
- }
-
-
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to create and return
- * the dialog that is displayed by the default run method
- * implementation.
- * <p>
- * If you override run with your own, then
- * simply implement this to return null as it won't be used.
- * @see #run()
- */
- protected Dialog createDialog(Shell shell)
- {
- return new SystemResolveFilterStringDialog(shell, subsystem, filterString);
- } // end createDialog()
-
- /**
- * Return selected object. If multiple objects are selected,
- * returns the first selected object.
- */
- public Object getSelectedObject()
- {
- return getValue();
- }
-
-} // end class SystemResolveFilterStringAction
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRunAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRunAction.java
deleted file mode 100644
index fbc786162..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemRunAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemViewRunnableObject;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action is for any object that wants a "Run" action in their popup menu.
- * The object must support the ISystemViewRunnableObject interface.
- */
-public class SystemRunAction extends SystemBaseAction
-
-{
-
- /**
- * Constructor.
- */
- public SystemRunAction(Shell shell)
- {
- this(SystemResources.ACTION_RUN_LABEL, SystemResources.ACTION_RUN_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_RUN_ID),
- shell);
- }
-
-
- /**
- * Constructor.
- * @param label
- * @param tooltip
- * @param image the image.
- * @param shell the parent shell.
- */
- public SystemRunAction(String label, String tooltip, ImageDescriptor image, Shell shell)
- {
- super(label, tooltip, image, shell);
- init();
- }
-
- /**
- * Initialize.
- */
- protected void init() {
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPEN);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0100"); //$NON-NLS-1$
- }
-
-
- /**
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- Object selectedObject = getFirstSelection();
- if ((selectedObject == null) || !(selectedObject instanceof ISystemViewRunnableObject))
- enable = false;
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- Object selectedObject = getFirstSelection();
- if ((selectedObject == null) || !(selectedObject instanceof ISystemViewRunnableObject))
- return;
- ISystemViewRunnableObject runnable = (ISystemViewRunnableObject)selectedObject;
- runnable.run(getShell());
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSeparatorAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSeparatorAction.java
deleted file mode 100644
index a07fe470d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSeparatorAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Dummy action representing a separator in menus.
- */
-public class SystemSeparatorAction extends SystemBaseAction
-{
- private boolean realAction;
-
- /**
- * Constructor for SystemSeparatorAction when you intend to subclass
- */
- public SystemSeparatorAction(Shell parent)
- {
- super("_separator_",(ImageDescriptor)null,parent); //$NON-NLS-1$
- realAction = true;
- }
- /**
- * Constructor for SystemSeparatorAction when you just want the separator
- */
- public SystemSeparatorAction()
- {
- super("_separator_",(ImageDescriptor)null,null); //$NON-NLS-1$
- realAction = false;
- }
-
- public Separator getSeparator()
- {
- return new Separator();
- }
-
- /**
- * Return true if this is both a separator and a real action, false if this is only
- * a separator
- */
- public boolean isRealAction()
- {
- return realAction;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInMonitorAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInMonitorAction.java
deleted file mode 100644
index 844047dd2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInMonitorAction.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.monitor.SystemMonitorUI;
-import org.eclipse.rse.internal.ui.view.monitor.SystemMonitorViewPart;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * This is the default action for showing a remote object in a table
- */
-public class SystemShowInMonitorAction extends SystemBaseAction
-{
- private Object _selected;
-
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- */
- public SystemShowInMonitorAction(Shell parent)
- {
- super(SystemResources.ACTION_MONITOR_LABEL,
- SystemResources.ACTION_MONITOR_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SHOW_MONITOR_ID),
- parent);
- setAvailableOffline(true);
- }
-
- /**
- * Called when this action is selected from the popup menu.
- */
- public void run()
- {
- SystemMonitorViewPart viewPart = null;
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try
- {
- viewPart = (SystemMonitorViewPart) page.showView(SystemMonitorUI.MONITOR_VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
- }
- catch (PartInitException e)
- {
- return;
- }
- catch (Exception e)
- {
- return;
- }
-
- viewPart.addItemToMonitor((IAdaptable) _selected);
- page.activate(viewPart);
-
- }
-
- /**
- * Called when the selection changes. The selection is checked to
- * make sure this action can be performed on the selected object.
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = false;
- Iterator e = selection.iterator();
- Object selected = e.next();
-
- if (selected != null && selected instanceof IAdaptable)
- {
- ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class);
- if (va.hasChildren((IAdaptable)selected))
- {
- _selected = selected;
- enable = true;
- }
- }
-
- return enable;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInTableAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInTableAction.java
deleted file mode 100644
index b62ccd8e6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowInTableAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemTableViewPart;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * This is the default action for showing a remote object in a table
- */
-public class SystemShowInTableAction extends SystemBaseAction
-{
- private Object _selected;
-
- /**
- * Constructor.
- * @param shell Shell of parent window, used as the parent for the dialog.
- * Can be null, but be sure to call setParent before the action is used (ie, run).
- */
- public SystemShowInTableAction(Shell parent)
- {
- super(SystemResources.ACTION_TABLE_LABEL,
- SystemResources.ACTION_TABLE_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SHOW_TABLE_ID),
- parent);
- setAvailableOffline(true);
- }
-
- /**
- * Called when this action is selected from the popup menu.
- */
- public void run()
- {
- SystemTableViewPart viewPart = null;
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try
- {
- viewPart = (SystemTableViewPart) page.showView("org.eclipse.rse.ui.view.systemTableView", null, IWorkbenchPage.VIEW_CREATE); //$NON-NLS-1$
- }
- catch (PartInitException e)
- {
- return;
- }
- catch (Exception e)
- {
- return;
- }
-
- viewPart.setInput((IAdaptable) _selected);
- page.activate(viewPart);
-
- }
-
- /**
- * Called when the selection changes. The selection is checked to
- * make sure this action can be performed on the selected object.
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = false;
- Iterator e = selection.iterator();
- Object selected = e.next();
-
- if (selected != null && selected instanceof IAdaptable)
- {
- ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) selected).getAdapter(ISystemViewElementAdapter.class);
- if (va.hasChildren((IAdaptable)selected))
- {
- _selected = selected;
- enable = true;
- }
- }
-
- return enable;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowPreferencesPageAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowPreferencesPageAction.java
deleted file mode 100644
index 395adf4a3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemShowPreferencesPageAction.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [185552] Remove remoteSystemsViewPreferencesActions extension point
- * Kevin Doyle (IBM) - [186769] Enable Contributions to Drop Down menu of Remote Systems view -> Preferences
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog;
-
-/**
- * This action will launch the Preferences dialog, but only rooted at a given
- * preference page (it will include its children underneath), including the
- * child pages registered under that page ("category").
- * <p>
- * @deprecated this will be moved to use the command/handler extension point.
- */
-public class SystemShowPreferencesPageAction extends SystemBaseAction implements IViewActionDelegate
-{
-
- private PreferenceManager preferenceManager;
- private String[] preferencePageIDs;
- private String preferencePageCategory;
-
- /**
- * Constructor.
- * We are instantiated inside {@link RSEUIPlugin#getShowPreferencePageActions()}
- * for each menu shortcut to show a particular preference page.
- */
- public SystemShowPreferencesPageAction()
- {
- super("temp label", null); //$NON-NLS-1$
- }
-
- /**
- * Set ID of the preference root page to show.
- * @param preferencePageID The ID of the preference page root to show. All child nodes will also be shown.
- */
- public void setPreferencePageID(String preferencePageID)
- {
- setPreferencePageID(new String[] {preferencePageID});
- }
- /**
- * Set IDs of the preference root pages to show.
- * @param preferencePageIDs The IDs of the preference page roots to show. All child nodes will also be shown.
- */
- public void setPreferencePageID(String[] preferencePageIDs)
- {
- allowOnMultipleSelection(false);
- setSelectionSensitive(false);
- this.preferencePageIDs = preferencePageIDs;
- }
- /**
- * Set the category of the pages to be shown. This only needs to be called
- * for non-root pages. Note that the ID to give here is not of the immediate
- * parent, but that of the root parent. It tells us which root subtree to
- * search for the given page(s).
- */
- public void setPreferencePageCategory(String preferencePageCategory)
- {
- this.preferencePageCategory = preferencePageCategory;
- }
-
- /**
- * @see IViewActionDelegate#init(IViewPart)
- */
- public void init(IViewPart view)
- {
- setShell(view.getSite().getShell());
- }
-
-
-
- /**
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action)
- {
- run();
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection)
- {
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- // Bring up the preferences page
- /*
- PreferenceManager prefMgr = new PreferenceManager();
- prefMgr.addToRoot(new PreferenceNode("tempid", new RemoteSystemsPreferencePage()));
- PreferenceDialog dialog = new PreferenceDialog(shell, prefMgr);
- dialog.open();
- */
- PreferenceManager pm = getPreferenceManager();
-
- if (pm != null)
- {
- shell = RSEUIPlugin.getTheSystemRegistryUI().getShell();
- PreferenceDialog d = new WorkbenchPreferenceDialog(shell, pm);
- d.create();
- // TODO - hack to make this work in 3.1
- String id = PlatformUI.PLUGIN_ID + ".preference_dialog_context"; //$NON-NLS-1$
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(d.getShell(), id);
- d.open();
- }
- }
- /*
- * Get the preference manager.
- */
- public PreferenceManager getPreferenceManager()
- {
- if (preferenceManager == null)
- {
- preferenceManager = new PreferenceManager('/');
-
- //Get the pages from the registry
- //PreferencePageRegistryReader registryReader = new PreferencePageRegistryReader(PlatformUI.getWorkbench());
-
- //List pageContributions = registryReader.getPreferenceContributions(Platform.getExtensionRegistry());
-
- PreferenceManager workbenchMgr = PlatformUI.getWorkbench().getPreferenceManager();
-
- List pageContributions = workbenchMgr.getElements(PreferenceManager.POST_ORDER);
-
-
-
- //Add the contributions to the manager
- Iterator iter = pageContributions.iterator();
- while (iter.hasNext())
- {
- IPreferenceNode prefNode = (IPreferenceNode) iter.next();
- //System.out.println("prefNode.getId() == "+prefNode.getId());
- //System.out.println(" getLabelText() == "+prefNode.getLabelText());
- boolean match = false;
- String prefNodeID = prefNode.getId();
- if (preferencePageCategory == null)
- {
- match = testForMatch(prefNodeID);
- }
- else if (prefNodeID.equals(preferencePageCategory))
- {
- //System.out.println("Made it here");
- prefNode = searchForSubPage(prefNode, prefNodeID);
- if (prefNode != null)
- match = true;
- }
- if (match)
- preferenceManager.addToRoot(prefNode);
- }
-
- }
- return preferenceManager;
- }
-
- private IPreferenceNode searchForSubPage(IPreferenceNode parent, String prefNodeID)
- {
- IPreferenceNode match = null;
-
- IPreferenceNode[] subNodes = parent.getSubNodes();
- if (subNodes!=null)
- for (int idx=0; (match==null) && (idx<subNodes.length); idx++)
- {
- if (testForMatch(subNodes[idx].getId()))
- match = subNodes[idx];
- else
- match = searchForSubPage(subNodes[idx], prefNodeID);
- }
-
- return match;
- }
-
- private boolean testForMatch(String prefNodeID)
- {
- boolean match = false;
- for (int idx=0; !match && (idx<preferencePageIDs.length); idx++)
- {
- if (prefNodeID.equals(preferencePageIDs[idx]))
- match = true;
- }
- return match;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemStringPromptAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemStringPromptAction.java
deleted file mode 100644
index deaabc8de..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemStringPromptAction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * This is a default action for prompting for a string.
- * It puts up a simple dialog with an entry field. You specify the button/menuitem
- * strings, and the title and prompt on the resulting dialog.
- * You can also optionally specify an input validator that is called to verify the
- * contents of the entry field.
- */
-public class SystemStringPromptAction extends SystemBaseDialogAction
-{
-
- private String title, prompt;
- private ISystemValidator inputValidator;
-
- /**
- * @param rb Resource bundle where to find following keys
- * @param key Key used as prefix in resource bundle to get:
- * <sl>
- * <li>button/menuitem label -> appends ".label" to key
- * <li>button/menuitem tooltip -> appends ".tooltip" to key
- * <li>button/menuitem description on status line -> appends ".description" to key
- * <li>title of generic prompt dialog box displayed -> appends ".title"
- * <li>prompt text in generic prompt dialog box displayed -> appends ".prompt"
- * </sl>
- * @param parent Shell of parent window
- *
- * @deprecated use fields from resource class directly now
- */
- public SystemStringPromptAction(String label, String tooltip, String title, String prompt, Shell parent)
- {
- super(label, tooltip, null, parent); // null => no image
- this.title = title;
- this.prompt = prompt;
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_OPEN);
- }
-
-
- /**
- * Set validator to use to check validity of input
- * @param text validator
- */
- public void setValidator(ISystemValidator inputValidator)
- {
- this.inputValidator = inputValidator;
- }
-
- /**
- * We use the default inherited actionPerformed method,
- * which calls this method to create our dialog.
- */
- public Dialog createDialog(Shell parent)
- {
- InputDialog dlg= new InputDialog(parent, title, prompt,null,inputValidator);
- //dlg.getShell().setSize(300, 200); // ? right thing to do ?
- dlg.setBlockOnOpen(true); // modal
- return dlg;
- }
-
- /**
- * We use the default inherited actionPerformed method,
- * which calls this method after the dialog is closed in
- * order to retrieve the dialog's data. This is then
- * placed in this object's value property and can be
- * retrieved publicly via getValue().
- */
- protected Object getDialogValue(Dialog dlg)
- {
- String value = ((InputDialog)dlg).getValue();
- if (value != null)
- value = value.trim();
- return value;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManager.java
deleted file mode 100644
index cfe34b63c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManager.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * For cascading menus, we need our own menu subclass so we can intercept
- * the state-setting methods of our frameworks, and foreword those onto the
- * sub-menu actions.
- * <p>
- * The state-setting methods including setShell, setSelection and setValue.
- */
-public class SystemSubMenuManager
- extends MenuManager
-{
- protected String toolTipText;
- protected ImageDescriptor image = null;
- protected Shell shell = null;
- protected Viewer viewer = null;
- protected boolean deferPopulation;
- protected boolean traceSelections = false;
- protected String traceTarget;
- protected ISelection selection;
- protected String label;
- protected SystemBaseSubMenuAction parentCascadingAction;
-
- /**
- * Constructor for SystemSubMenuManager
- */
- public SystemSubMenuManager(SystemBaseSubMenuAction parentAction)
- {
- super();
- this.parentCascadingAction = parentAction;
- }
- /**
- * Constructor for SystemSubMenuManager
- */
- public SystemSubMenuManager(SystemBaseSubMenuAction parentAction, String text)
- {
- super(text);
- this.label = text;
- this.parentCascadingAction = parentAction;
- }
- /**
- * Constructor for SystemSubMenuManager
- */
- public SystemSubMenuManager(SystemBaseSubMenuAction parentAction, String text, String id)
- {
- super(text, id);
- this.label = text;
- this.parentCascadingAction = parentAction;
- }
- /**
- * Constructor for SystemSubMenuManager
- */
- public SystemSubMenuManager(SystemBaseSubMenuAction parentAction, String text, String id, ImageDescriptor image)
- {
- super(text, id);
- this.label = text;
- this.image = image;
- this.parentCascadingAction = parentAction;
- }
-
- /**
- * Return the parent cascading menu action that created this.
- */
- public SystemBaseSubMenuAction getParentCascadingAction()
- {
- return parentCascadingAction;
- }
-
- /**
- * Set the tooltip text when this is used for in a cascading menu.
- * @see org.eclipse.rse.ui.actions.SystemBaseSubMenuAction
- */
- public void setToolTipText(String tip)
- {
- this.toolTipText = tip;
- }
- /**
- * Get the tooltip text when this is used for in a cascading menu
- */
- public String getToolTipText()
- {
- return toolTipText;
- }
-
- /**
- * Return the label for this submenu
- */
- public String getLabel()
- {
- return label;
- }
-
- // ------------------------
- // ISYSTEMACTION METHODS...
- // ------------------------
- /**
- * An optimization for performance reasons that allows all inputs to be set in one call.
- * This is called by SystemView's fillContextMenu method.
- */
- public void setInputs(Shell shell, Viewer v, ISelection selection)
- {
- if (traceSelections)
- issueTraceMessage(" INSIDE SETINPUTS FOR SUBMENUMGR FOR '"+label+"'"); //$NON-NLS-1$ //$NON-NLS-2$
- this.shell = shell;
- this.viewer = v;
- this.selection = selection;
- if (parentCascadingAction != null)
- parentCascadingAction.setInputsFromSubMenuManager(shell, v, selection);
- cascadeAllInputs();
- }
-
-
- /**
- * Sets the parent shell for this action. Usually context dependent.
- * We cascade this down to all of the actions added to this submenu.
- */
- public void setShell(Shell shell)
- {
- this.shell = shell;
- IContributionItem[] items = getItems();
- for (int idx=0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) &&
- (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
- item.setShell(shell);
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
- item.setShell(shell);
- }
- }
- if (traceSelections)
- {
- issueTraceMessage("*** INSIDE SETSHELL FOR SUBMENUMGR "+label+". #ITEMS = "+items.length); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- }
-
- /**
- * This is called by the framework to set the selection input, just prior to showing the popup menu.
- * We cascade this down to all of the actions added to this submenu.
- */
- public void setSelection(ISelection selection)
- {
- this.selection = selection;
- IContributionItem[] items = getItems();
- for (int idx=0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) &&
- (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
- item.setSelection(selection);
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
- item.setSelection(selection);
- }
- }
- if (traceSelections)
- {
- issueTraceMessage("*** INSIDE SETSELECTION FOR SUBMENUMGR"+label+". #ITEMS = "+items.length); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- }
- /**
- * Set the Viewer that called this action. It is good practice for viewers to call this
- * so actions can directly access them if needed.
- */
- public void setViewer(Viewer v)
- {
- this.viewer = v;
- IContributionItem[] items = getItems();
- for (int idx=0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) &&
- (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
- item.setViewer(viewer);
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
- item.setViewer(viewer);
- }
- }
- }
-
- /**
- * Get the Viewer that called this action. Not guaranteed to be set,
- * depends if that viewer called setViewer or not. SystemView does.
- */
- public Viewer getViewer()
- {
- return viewer;
- }
- /**
- * Get the Shell that hosts this action. Not guaranteed to be set,
- */
- public Shell getShell()
- {
- return shell;
- }
- /**
- * Get the Selection
- */
- public IStructuredSelection getSelection()
- {
- return (IStructuredSelection)selection;
- }
-
- /**
- * @see ContributionManager#add(IAction)
- */
-
- // add(): solve problem that cascaded menu items were not receiving their
- // setSelection() call, due to them only being constructed on the
- // cascade's MenuAboutToShow(), after the setSelections have run.
-
- // THE QUESTION IS, IF WE DO THIS HERE WHEN ITEMS ARE ADDED TO THIS SUBMENU,
- // IS IT REDUNDANT TO ALSO DO IT WHEN SETINPUTS IS CALLED?
-
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- */
- public void appendToGroup(String groupName, IAction action)
- {
- super.appendToGroup(groupName, action);
- if (action instanceof ISystemAction)
- cascadeAllInputs((ISystemAction)action);
- }
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- */
- public void appendToGroup(String groupName, IContributionItem item)
- {
- super.appendToGroup(groupName, item);
- if (item instanceof SystemSubMenuManager)
- cascadeAllInputs((SystemSubMenuManager)item);
- }
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- * THIS WAS ONLY CATCHING ACTIONS, NOT NESTED SUBMENUS. THE SUPER OF THIS
- * METHOD CALLS ADD(new ActionContributionItem(action)) SO WE NOW INTERCEPT
- * THERE INSTEAD, AS THAT IS WHAT IS CALLED FOR MULTI-CASCADING MENUS
- public void add(IAction action)
- {
- super.add(action);
- if (action instanceof ISystemAction)
- cascadeAllInputs((ISystemAction)action);
- }*/
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- */
- public void add(IContributionItem item)
- {
- super.add(item);
- if (item instanceof ActionContributionItem)
- {
- IAction action = ((ActionContributionItem)item).getAction();
- if (action instanceof ISystemAction)
- cascadeAllInputs((ISystemAction)action);
- }
- else if (item instanceof SystemSubMenuManager)
- cascadeAllInputs((SystemSubMenuManager)item);
- }
-
- /**
- * Cascade in one shot all input state inputs to all actions
- */
- protected void cascadeAllInputs()
- {
- //super.menuAboutToShow(ourSubMenu);
- IContributionItem[] items = getItems();
- if (traceSelections)
- {
- issueTraceMessage("INSIDE CASCADEALLINPUTS FOR SUBMENUMGR FOR "+label+". NBR ITEMS = "+items.length); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- for (int idx=0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) &&
- (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
- if (!item.isDummy())
- cascadeAllInputs(item);
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
- cascadeAllInputs(item);
- }
- }
-
- }
- /**
- * Cascade in one shot all input state inputs to one action
- */
- protected void cascadeAllInputs(ISystemAction action)
- {
- if (action.isDummy())
- return; // waste of time
- if (shell != null)
- action.setShell(shell);
- if (viewer != null)
- action.setViewer(viewer);
- if (selection != null)
- action.setSelection(selection);
- }
- /**
- * Cascade in one shot all input state inputs to one submenu
- */
- protected void cascadeAllInputs(SystemSubMenuManager submenu)
- {
- if (shell != null)
- submenu.setShell(shell);
- if (viewer != null)
- submenu.setViewer(viewer);
- if (selection != null)
- submenu.setSelection(selection);
- }
- // ------------------------
- // HELPER METHODS...
- // ------------------------
- /**
- * Turn on tracing for selections, shell and viewer to watch as it is set
- */
- public void setTracing(boolean tracing)
- {
- traceSelections = tracing;
- }
- /**
- * Turn on tracing for selections, shell and viewer to watch as it is set,
- * scoped to a particular class name (will use indexOf('xxx') to match).
- */
- public void setTracing(String tracingClassTarget)
- {
- traceSelections = (tracingClassTarget != null);
- traceTarget = tracingClassTarget;
- }
- /**
- * Turn on tracing for selections, shell and viewer to watch as it is set,
- * scoped to a particular class name (will use indexOf('xxx') to match).
- */
- public void setTracing(boolean tracing, String tracingClassTarget)
- {
- traceSelections = tracing;
- traceTarget = tracingClassTarget;
- }
-
- /**
- * Issue trace message
- */
- protected void issueTraceMessage(String msg)
- {
- if (traceSelections)
- {
- String className = this.getClass().getName();
- if ((traceTarget==null) || (className.indexOf(traceTarget)>=0))
- {
- className = className.substring(className.lastIndexOf('.'));
- SystemBasePlugin.logInfo(className+": "+msg); //$NON-NLS-1$
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManagerForTesting.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManagerForTesting.java
deleted file mode 100644
index 335b8f13a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSubMenuManagerForTesting.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * For cascading menus, we need our own menu subclass so we can intercept
- * the state-setting methods our frameworks, and foreword those onto the
- * sub-menu actions.
- * <p>
- * The state-setting methods including setShell, setSelection and setValue.
- * <p>
- * We often have trouble tracking down when the shell, selection and viewer is
- * not properly set for cascading actions. For these cases, we can use this
- * override of the SystemSubMenuManager to trace what happens.
- */
-public class SystemSubMenuManagerForTesting
- extends SystemSubMenuManager
- //implements ISelectionChangedListener
- //implements ISystemAction
-{
- private String prefix = ""; //$NON-NLS-1$
-
- /**
- * Constructor
- */
- public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction)
- {
- super(parentAction);
- }
- /**
- * Constructor
- */
- public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text)
- {
- super(parentAction, text);
- System.out.println("SUBMENUMGR CTOR " + text); //$NON-NLS-1$
- }
- /**
- * Constructor
- */
- public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text, String id)
- {
- super(parentAction, text, id);
- System.out.println("SUBMENUMGR CTOR " + text); //$NON-NLS-1$
- }
- /**
- * Constructor
- */
- public SystemSubMenuManagerForTesting(SystemBaseSubMenuAction parentAction, String text, String id, ImageDescriptor image)
- {
- super(parentAction, text, id, image);
- }
-
-
- /**
- * Override of parent so we can trace it....
- */
- public void setInputs(Shell shell, Viewer v, ISelection selection)
- {
- System.out.println(" INSIDE SETINPUTS FOR SUBMENUMGR '"+label+"': selection = "+selection); //$NON-NLS-1$ //$NON-NLS-2$
- super.setInputs(shell, v, selection);
- }
-
-
-
-
- // add(): solve problem that cascaded menu items were not receiving their
- // setSelection() call, due to them only being constructed on the
- // cascade's MenuAboutToShow(), after the setSelections have run.
-
- // THE QUESTION IS, IF WE DO THIS HERE WHEN ITEMS ARE ADDED TO THIS SUBMENU,
- // IS IT REDUNDANT TO ALSO DO IT WHEN SETINPUTS IS CALLED?
-
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- */
- public void appendToGroup(String groupName, IAction action)
- {
- System.out.println("INSIDE APPENDTOGROUP OF ISYSTEMACTION FOR SUBMENUMGR FOR '"+label+"'"); //$NON-NLS-1$ //$NON-NLS-2$
- prefix = " "; //$NON-NLS-1$
- super.appendToGroup(groupName, action);
- prefix = ""; //$NON-NLS-1$
- }
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- */
- public void appendToGroup(String groupName, IContributionItem item)
- {
- System.out.println("INSIDE APPENDTOGROUP OF SYSTEMSUBMENUMGR FOR SUBMENUMGR FOR '"+label+"'"); //$NON-NLS-1$ //$NON-NLS-2$
- prefix = " "; //$NON-NLS-1$
- super.appendToGroup(groupName, item);
- prefix = ""; //$NON-NLS-1$
- }
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- * THIS WAS ONLY CATCHING ACTIONS, NOT NESTED SUBMENUS. THE SUPER OF THIS
- * METHOD CALLS ADD(new ActionContributionItem(action)) SO WE NOW INTERCEPT
- * THERE INSTEAD, AS THAT IS WHAT IS CALLED FOR MULTI-CASCADING MENUS
- public void add(IAction action)
- {
- super.add(action);
- if (action instanceof ISystemAction)
- cascadeAllInputs((ISystemAction)action);
- }*/
- /**
- * Intercept so we can cascade the selection, viewer and shell down
- */
- public void add(IContributionItem item)
- {
- prefix = " "; //$NON-NLS-1$
- if (item instanceof ActionContributionItem)
- {
- IAction action = ((ActionContributionItem)item).getAction();
- if (action instanceof ISystemAction)
- System.out.println("INSIDE ADD OF ISYSTEMACTION(action="+action.getText()+") FOR THIS MNUMGR: "+label); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else if (item instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager submenu = (SystemSubMenuManager)item;
- System.out.println("INSIDE ADD OF SUBMENUMGR(submenu="+submenu.getLabel()+") FOR THIS MNUMGR: "+label); //$NON-NLS-1$ //$NON-NLS-2$
- }
- super.add(item);
- prefix = ""; //$NON-NLS-1$
- }
-
- /**
- * Cascade in one shot all input state inputs to all actions
- */
- protected void cascadeAllInputs()
- {
- //super.menuAboutToShow(ourSubMenu);
- IContributionItem[] items = getItems();
- System.out.println(prefix+"INSIDE CASCADEALLINPUTS TO ALL ITEMS FOR SUBMENUMGR FOR "+label+". NBR ITEMS = "+items.length); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(prefix+"...shell = "+shell+", viewer = "+viewer+", selection = "+selection); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- String oldPrefix = prefix;
- prefix += " "; //$NON-NLS-1$
- super.cascadeAllInputs();
- prefix = oldPrefix;
- }
- /**
- * Cascade in one shot all input state inputs to one action
- */
- protected void cascadeAllInputs(ISystemAction action)
- {
- System.out.println(prefix+"INSIDE CASCADEALLINPUTS TO ISYSTEMACTION(action="+action.getText()+") FOR THIS MNUMGR: "+label); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println(prefix+"...shell = "+shell+", viewer = "+viewer+", selection = "+selection); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- super.cascadeAllInputs(action);
- }
- /**
- * Cascade in one shot all input state inputs to one submenu
- */
- protected void cascadeAllInputs(SystemSubMenuManager submenu)
- {
- System.out.println("INSIDE CASCADEALLINPUTS TO SUBMENUMGR(submenu="+submenu.getLabel()+") FOR THIS MNUMGR: "+label); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("...shell = "+shell+", viewer = "+viewer+", selection = "+selection); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- super.cascadeAllInputs(submenu);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTeamReloadAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTeamReloadAction.java
deleted file mode 100644
index 970cb1f81..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTeamReloadAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.SystemResourceListener;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to refresh the entire Remote System Explorer tree view,
- * by reloading it from disk. This is to be done after the user does a synchronization
- * with the repository.
- */
-public class SystemTeamReloadAction extends SystemBaseAction
-
-{
-
- //private SystemProfile prevProfile = null;
-
- /**
- * Constructor
- */
- public SystemTeamReloadAction(Shell parent)
- {
- super(SystemResources.ACTION_TEAM_RELOAD_LABEL,SystemResources.ACTION_TEAM_RELOAD_TOOLTIP,
- parent);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
- //setSelectionSensitive(false);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0009"); //$NON-NLS-1$
- }
-
- /**
- * Selection has been changed. Decide to enable or not.
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = SystemResourceListener.changesPending();
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action to run.
- */
- public void run()
- {
- //SystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- SystemMessage confirmMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONFIRM_RELOADRSE);
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), confirmMsg);
- boolean ok = msgDlg.openQuestionNoException();
- if (ok)
- {
- SystemResourceListener.reloadRSE();
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTestFilterStringAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTestFilterStringAction.java
deleted file mode 100644
index e3f37647e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemTestFilterStringAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.SystemTestFilterStringDialog;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action for testing a given filter string by resolving it and showing the resolve results
- */
-public class SystemTestFilterStringAction extends SystemBaseDialogAction
-
-{
-
- protected ISubSystem subsystem;
- protected String filterString;
-
- /**
- * Constructor when input subsystem and filter string are known already
- */
- public SystemTestFilterStringAction(Shell shell, ISubSystem subsystem, String filterString)
- {
- super(SystemResources.ACTION_TESTFILTERSTRING_LABEL, SystemResources.ACTION_TESTFILTERSTRING_TOOLTIP, null,
- shell);
- allowOnMultipleSelection(false);
- setSubSystem(subsystem);
- setFilterString(filterString);
- }
- /**
- * Constructor when input subsystem and filter string are not known already.
- * @see #setSubSystem(ISubSystem)
- * @see #setFilterString(String)
- */
- public SystemTestFilterStringAction(Shell shell)
- {
- this(shell, null, null);
- }
-
- /**
- * Set the subsystem within the context of which this filter string is to be tested.
- */
- public void setSubSystem(ISubSystem subsystem)
- {
- this.subsystem = subsystem;
- }
-
- /**
- * Set the filter string to test
- */
- public void setFilterString(String filterString)
- {
- this.filterString = filterString;
- }
-
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to create and return
- * the dialog that is displayed by the default run method
- * implementation.
- * <p>
- * If you override run with your own, then
- * simply implement this to return null as it won't be used.
- * @see #run()
- */
- protected Dialog createDialog(Shell shell)
- {
- return new SystemTestFilterStringDialog(shell, subsystem, filterString);
- }
-
- /**
- * Required by parent. We just return null.
- */
- protected Object getDialogValue(Dialog dlg)
- {
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToAllAction.java
deleted file mode 100644
index bc7187090..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToAllAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * When we support Expand-To menu items to expand a remote item via subsetting criteria,
- * we should also support an Expand-To->All action. This is it.
- */
-public class SystemViewExpandToAllAction extends SystemViewExpandToBaseAction
-{
-
-
-
- /**
- * Constructor for SystemViewExpandToAllAction.
- * @param rb
- * @param prefix
- * @param image
- * @param parent
- */
- public SystemViewExpandToAllAction(Shell parent)
- {
- super(SystemResources.ACTION_EXPAND_ALL_LABEL, SystemResources.ACTION_EXPAND_ALL_TOOLTIP,null, parent);
- }
-
- /**
- * @see org.eclipse.rse.internal.ui.actions.SystemViewExpandToBaseAction#getFilterString(Object)
- */
- protected String getFilterString(Object selectedObject)
- {
- return null;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToBaseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToBaseAction.java
deleted file mode 100644
index d714ff286..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemViewExpandToBaseAction.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.internal.ui.view.SystemView;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Base class for Expand To actions on a container
- */
-public abstract class SystemViewExpandToBaseAction extends SystemBaseAction
-{
-
-
-
- /**
- * Constructor.
- */
- public SystemViewExpandToBaseAction(String label, String tooltip, ImageDescriptor image, Shell parent)
- {
- super(label, tooltip, image, parent);
- allowOnMultipleSelection(false);
- setContextMenuGroup(org.eclipse.rse.ui.ISystemContextMenuConstants.GROUP_EXPANDTO);
- setChecked(false); // will reset once we know the selection.
- }
-
- /**
- * Second and easiest opportunity to decide if the action should be enabled or not based
- * on the current selection. Called by default implementation of updateSelection, once for
- * each item in the selection. If any call to this returns false, the action is disabled.
- * The default implementation returns true.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- SystemView sv = getSystemView();
- if (sv == null)
- return false;
- String currentFilter = sv.getExpandToFilter(selectedObject);
- String thisFilter = getFilterString(selectedObject);
- if (currentFilter != null)
- {
- if ((thisFilter!=null) && currentFilter.equals(thisFilter))
- setChecked(true);
- }
- else if (thisFilter == null) // I assume this is only the case for Expand To->All.
- setChecked(true);
- return true;
- }
-
- /**
- * Actually do the work
- */
- public void run()
- {
- Object element = getFirstSelection();
- if (element != null)
- {
- SystemView view = (SystemView)getCurrentTreeView();
- view.expandTo(getFilterString(element));
- }
- }
-
- /**
- * Overridable extension point to get the fully resolved filter string at the time
- * action is run.
- */
- protected abstract String getFilterString(Object selectedObject);
-
- /**
- * Return the current SystemView or null if the current viewer is not a system view
- */
- protected SystemView getSystemView()
- {
- ISystemTree tree = getCurrentTreeView();
- if ((tree instanceof SystemView) && (((SystemView)tree).getSystemViewPart() != null))
- return (SystemView)tree;
- else
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java
deleted file mode 100644
index f624d1b8f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
- * David McKnight (IBM) - [251026] Work Offline requires being selected twice to turn on Offline Mode
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.CommonMessages;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Action for switching RSE Connections offline
- *
- * @author yantzi
- */
-public class SystemWorkOfflineAction extends SystemBaseAction
-{
- /**
- * Constructor
- *
- * @param shell
- */
- public SystemWorkOfflineAction(Shell shell) {
- super(SystemResources.RESID_OFFLINE_WORKOFFLINE_LABEL, SystemResources.RESID_OFFLINE_WORKOFFLINE_TOOLTIP, shell);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CONNECTION);
- setHelp(RSEUIPlugin.HELPPREFIX+"wofa0000"); //$NON-NLS-1$
- }
-
- /**
- * Override of parent. Called when testing if action should be enabled base on current
- * selection. We check the selected object is one of our subsystems, and if we are
- * currently connected.
- */
- public boolean checkObjectType(Object obj)
- {
- if (obj instanceof IHost)
- return true;
- else
- return false;
- }
-
- /**
- * Called when this action is selection from the popup menu.
- */
- public void run()
- {
- final IHost conn = (IHost)getFirstSelection();
- final ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- if (conn.isOffline())
- {
- // offline going online
- setChecked(false);
- sr.setHostOffline(conn, false);
- }
- else
- {
- // these need to be set before calling disconnect so the iSeires subsystems know not
- // to collapse
- sr.setHostOffline(conn, true);
- setChecked(true);
-
- // online going offline, disconnect all subsystems
- final Display display = Display.getCurrent();
- String jobName = NLS.bind(CommonMessages.MSG_DISCONNECT_PROGRESS, conn.getName());
- Job disconnectJob = new Job(jobName)
- {
- public IStatus run(IProgressMonitor monitor){
- ISubSystem[] subsystems = sr.getSubSystems(conn);
- if (subsystems != null && subsystems.length > 0){
- boolean cancelled = false;
- // disconnect each connector service associated with the host
- for (int i = 0; i < subsystems.length && !cancelled; i++){
-
- final ISubSystem subSystem = subsystems[i];
-
- if(subSystem.getSubSystemConfiguration().supportsSubSystemConnect()){
- if (subSystem.isConnected()){
- // should always have a connector service
- IConnectorService cs = subSystem.getConnectorService();
- if (cs.isConnected()){
- try {
- cs.disconnect(monitor);
- }
- catch (Exception e){
- SystemBasePlugin.logError(e.getMessage());
- }
-
- // failed to disconnect?
- if (cs.isConnected()){
- cancelled = true;
- }
- else {
- cs.reset();
- display.asyncExec(new Runnable(){
- public void run(){
- // this will take care of updating all subsystems
- sr.connectedStatusChange(subSystem, false, true, false);
- }
- });
- }
- }
- }
- }
- if (monitor.isCanceled()){
- cancelled = true;
- }
- }
-
- if (cancelled){ // either monitor got cancelled or disconnect failed
- setChecked(false);
- sr.setHostOffline(conn, false);
- return Status.CANCEL_STATUS;
- }
- }
- return Status.OK_STATUS;
- }
-
- };
-
- disconnectJob.schedule();
- }
- }
-
-
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- if (super.updateSelection(selection))
- {
- setChecked(((IHost) selection.getFirstElement()).isOffline());
- return true;
- }
-
- return false;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkWithProfilesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkWithProfilesAction.java
deleted file mode 100644
index c8cc645bb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkWithProfilesAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.actions;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPart;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action shows in the local toolbar of the Remote Systems View, and
- * users can select it to give the Team view focus.
- */
-public class SystemWorkWithProfilesAction extends SystemBaseAction
-
-{
- //private ISystemRegistry sr = null;
-
- /**
- * Constructor
- */
- public SystemWorkWithProfilesAction(Shell parent)
- {
- super(SystemResources.ACTION_WORKWITH_PROFILES_LABEL, SystemResources.ACTION_WORKWITH_PROFILES_TOOLTIP, parent);
- setSelectionSensitive(false);
- allowOnMultipleSelection(true);
- //sr = RSECorePlugin.getTheSystemRegistry();
- setHelp(RSEUIPlugin.HELPPREFIX+"actnwwpr"); //$NON-NLS-1$
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- SystemPerspectiveHelpers.showView(SystemTeamViewPart.ID);
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/CopyRunnable.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/CopyRunnable.java
deleted file mode 100644
index bac7df7da..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/CopyRunnable.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rupen Mardirossian (IBM) - [210693] Created class to run SystemCopyDialog for enhancement defect.
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-
-import java.util.List;
-
-public class CopyRunnable implements Runnable
-{
- private boolean _ok;
- private List _existingNames;
- private SystemCopyDialog dlg;
-
- public CopyRunnable(List existing)
- {
- _existingNames = existing;
- }
-
- public void run() {
- dlg = new SystemCopyDialog(null, _existingNames);
- dlg.open();
- if (!dlg.wasCancelled())
- _ok = true;
- else
- _ok = false;
- }
- public boolean getOk()
- {
- return _ok;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemControlEnableState.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemControlEnableState.java
deleted file mode 100644
index 5bf4f2206..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemControlEnableState.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
-import org.eclipse.rse.internal.ui.view.SystemViewForm;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * Helper class to save the enable/disable state of a control
- * including all its descendent controls.
- */
-public class SystemControlEnableState
-{
-
-
-
- /**
- * List of exception controls (element type: <code>Control</code>);
- * <code>null</code> if none.
- */
- private List exceptions = null;
-
- /**
- * List of saved states (element type: <code>ItemState</code>).
- */
- private List states;
-
- /**
- * Internal class for recording the enable/disable state of a
- * single control.
- */
- private class ItemState
- {
- protected Control item;
- protected boolean state;
- public ItemState(Control item, boolean state)
- {
- this.item = item;
- this.state = state;
- }
- public void restore()
- {
- if (item != null)
- item.setEnabled(state);
- }
- }
-
- /**
- * Creates a new object and saves in it the current enable/disable
- * state of the given control and its descendents; the controls
- * that are saved are also disabled.
- *
- * @param w the control
- */
- protected SystemControlEnableState(Control w)
- {
- this(w, null);
- }
- /**
- * Creates a new object and saves in it the current enable/disable
- * state of the given control and its descendents except for the
- * given list of exception cases; the controls that are saved
- * are also disabled.
- *
- * @param w the control
- * @param exceptions the list of controls to not disable
- * (element type: <code>Control</code>), or <code>null</code> if none
- */
- protected SystemControlEnableState(Control w, List exceptions)
- {
- super();
- states = new ArrayList();
- this.exceptions = exceptions;
- readStateForAndDisable(w);
- }
- /**
- * Saves the current enable/disable state of the given control
- * and its descendents in the returned object; the controls
- * are all disabled.
- *
- * @param w the control
- * @return an object capturing the enable/disable state
- */
- public static SystemControlEnableState disable(Control w)
- {
- return new SystemControlEnableState(w);
- }
- /**
- * Saves the current enable/disable state of the given control
- * and its descendents in the returned object except for the
- * given list of exception cases; the controls that are saved
- * are also disabled.
- *
- * @param w the control
- * @param exceptions the list of controls to not disable
- * (element type: <code>Control</code>)
- * @return an object capturing the enable/disable state
- */
- public static SystemControlEnableState disable(Control w, List exceptions)
- {
- return new SystemControlEnableState(w, exceptions);
- }
- /**
- * Recursively reads the enable/disable state for the given window
- * and disables all controls.
- */
- private void readStateForAndDisable(Control w)
- {
- if ((exceptions != null && exceptions.contains(w)))
- return;
-
- if ((w instanceof Composite) && !(w instanceof SystemViewForm) && !(w instanceof SystemPropertySheetForm))
- {
- Composite c = (Composite) w;
- Control[] children = c.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- readStateForAndDisable(children[i]);
- }
- }
- // XXX: Workaround for 1G2Q8SS: ITPUI:Linux - Combo box is not enabled in "File->New->Solution"
- states.add(new ItemState(w, w.getEnabled()));
- w.setEnabled(false);
- }
- /**
- * Restores the window enable state saved in this object.
- */
- public void restore()
- {
- int size = states.size();
- for (int i = 0; i < size; i++)
- {
- ((ItemState) states.get(i)).restore();
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyDialog.java
deleted file mode 100644
index 7dc13c0bf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyDialog.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rupen Mardirossian (IBM) - [210693] Created Dialog for enhancement defect
- ********************************************************************************/
-
-
-package org.eclipse.rse.internal.ui.dialogs;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.SystemCopyTableProvider;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-/**
- * Dialog for confirming overwriting of resources when copy collision occurs.
- *
- * This dialog is a mirror copy of the SystemDeleteDialog with a few changes
- *
- */
-
-public class SystemCopyDialog extends SystemPromptDialog
-{
- private String verbiage;
- private SystemCopyTableProvider sctp;
- private Table table;
- private TableViewer tableViewer;
- private GridData tableData;
- private List collisions;
-
- // column layout
- private ColumnLayoutData columnLayouts[] =
- {
- new ColumnPixelData(19, false),
- new ColumnWeightData(150,150,true)
- };
-
- // column headers
- private String columnHeaders[] = {
- "", //$NON-NLS-1$
- SystemResources.RESID_COLLISION_COPY_COLHDG_OLDNAME
- };
- /**
- * Constructor when you have your list of files and would like to use default title.
- */
- public SystemCopyDialog(Shell shell, List files)
- {
- this(shell, SystemResources.RESID_COPY_TITLE, files);
- }
- /**
- * Constructor when you have your own title and list of files.
- */
- public SystemCopyDialog(Shell shell, String title, List files)
- {
- super(shell, title);
- setOkButtonLabel(SystemResources.BUTTON_OVERWRITE_ALL);
- setOkButtonToolTipText(SystemResources.BUTTON_OVERWRITE_ALL_TOOLTIP);
- setCancelButtonLabel(SystemResources.BUTTON_CANCEL_ALL);
- setCancelButtonToolTipText(SystemResources.BUTTON_CANCEL_ALL_TOOLTIP);
- collisions=files;
- }
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 1;
- Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- if (verbiage != null)
- SystemWidgetHelpers.createVerbiage(composite, verbiage, nbrColumns, false, 200);
- else
- SystemWidgetHelpers.createVerbiage(composite, SystemResources.RESID_COLLISION_COPY_VERBIAGE, nbrColumns, false, 200);
-
- // TABLE
- tableViewer = createTableViewer(composite, nbrColumns);
- createColumns();
-
- sctp = new SystemCopyTableProvider();
-
- int width = tableData.widthHint;
- int nbrRows = Math.min(collisions.size(),8);
- int rowHeight = table.getItemHeight() + table.getGridLineWidth();
- int sbHeight = table.getHorizontalBar().getSize().y;
- int height = (nbrRows * rowHeight) + sbHeight;
-
- tableData.heightHint = height;
- table.setLayoutData(tableData);
- table.setSize(width, height);
-
- tableViewer.setLabelProvider(sctp);
- tableViewer.setContentProvider(sctp);
-
- tableViewer.setInput(collisions);
-
- return composite;
- }
- /**
- * Creates and returns TableViewer
- */
- private TableViewer createTableViewer(Composite parent, int nbrColumns)
- {
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION);
- table.setLinesVisible(true);
- tableViewer = new TableViewer(table);
- tableData = new GridData();
- tableData.horizontalAlignment = GridData.FILL;
- tableData.grabExcessHorizontalSpace = true;
- tableData.widthHint = 350;
- tableData.heightHint = 30;
- tableData.verticalAlignment = GridData.CENTER;
- tableData.grabExcessVerticalSpace = true;
- tableData.horizontalSpan = nbrColumns;
- table.setLayoutData(tableData);
- return tableViewer;
- }
-
- protected Control getInitialFocusControl()
- {
- return null;
- }
-
-
- private void createColumns()
- {
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
- for (int i = 0; i < columnHeaders.length; i++)
- {
- layout.addColumnData(columnLayouts[i]);
- TableColumn tc = new TableColumn(table, SWT.NONE,i);
- tc.setResizable(columnLayouts[i].resizable);
- tc.setText(columnHeaders[i]);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyProfileDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyProfileDialog.java
deleted file mode 100644
index 245d0f062..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyProfileDialog.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFactory;
-import org.eclipse.rse.ui.validators.ValidatorProfileName;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Dialog for copying a system profile.
- */
-public class SystemCopyProfileDialog extends SystemPromptDialog
-{
- private Text newName;
- private Button makeActiveCB;
- private String newNameString, inputName;
- private boolean makeActive = false;
- private SystemMessage errorMessage;
- private ISystemValidator nameValidator;
- private boolean initialized = false;
- private ISystemProfile profile;
-
- /**
- * Constructor when profile not already known
- * @param shell The parent window hosting this dialog
- */
- public SystemCopyProfileDialog(Shell shell)
- {
- this(shell, null);
- }
- /**
- * Constructor when profile known
- * @param shell The parent window hosting this dialog
- * @param profile The profile to be copied
- */
- public SystemCopyProfileDialog(Shell shell, ISystemProfile profile)
- {
- super(shell, SystemResources.RESID_COPY_PROFILE_TITLE);
- this.profile = profile;
- if (profile != null)
- {
- setInputObject(profile);
- }
- nameValidator = ValidatorFactory.getProfileNameValidator((String)null);
- //pack();
- setHelp(RSEUIPlugin.HELPPREFIX+"drnp0000"); //$NON-NLS-1$
- }
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- super.createMessageLine(c);
- //form.setMessageLine(msgLine);
- return fMessageLine;
- }
-
-
- /**
- * Return widget to set focus to initially
- */
- protected Control getInitialFocusControl()
- {
- return newName;
- }
-
- /**
- * Set the name validator
- */
- public void setNameValidator(ISystemValidator nv)
- {
- nameValidator = nv;
- }
-
- /**
- * Create widgets, and populate given composite with them
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // ENTRY FIELD
- newName = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null,
- SystemResources.RESID_COPY_PROFILE_PROMPT_LABEL, SystemResources.RESID_COPY_PROFILE_PROMPT_TOOLTIP);
- newName.setTextLimit(ValidatorProfileName.MAX_PROFILENAME_LENGTH); // defect 41816
- // Make active
- makeActiveCB = SystemWidgetHelpers.createCheckBox(
- composite_prompts, nbrColumns, null, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_LABEL, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP);
-
- // SET HELP CONTEXT IDS...
- //SystemWidgetHelpers.setHelp(newName, RSEUIPlugin.HELPPREFIX+"drnp0002", RSEUIPlugin.HELPPREFIX+"drnp0000");
- SystemWidgetHelpers.setHelp(newName, RSEUIPlugin.HELPPREFIX+"drnp0002"); //$NON-NLS-1$
- //SystemWidgetHelpers.setHelp(makeActiveCB, RSEUIPlugin.HELPPREFIX+"drnp0003", RSEUIPlugin.HELPPREFIX+"drnp0000");
- SystemWidgetHelpers.setHelp(makeActiveCB, RSEUIPlugin.HELPPREFIX+"drnp0003"); //$NON-NLS-1$
-
- initialize();
-
- // add keystroke listeners...
- newName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateNameInput();
- }
- }
- );
-
- return composite_prompts;
- }
-
-
- /**
- * Override of parent. Must pass selected object onto the form for initializing fields.
- * Called by SystemDialogAction's default run() method after dialog instantiated.
- */
- public void setInputObject(Object inputObject)
- {
- //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject + ", "+inputObject.getClass().getName());
- super.setInputObject(inputObject);
- if (inputObject instanceof SystemSimpleContentElement)
- {
- SystemSimpleContentElement element = (SystemSimpleContentElement)inputObject;
- inputName = element.getName();
- }
- else if (inputObject instanceof ISelection)
- {
- SystemSimpleContentElement element = (SystemSimpleContentElement)(((IStructuredSelection)inputObject).getFirstElement());
- inputName = element.getName();
- }
- else if (inputObject instanceof ISystemProfile)
- inputName = profile.getName();
- initialize();
- }
-
- /**
- * Initialize input fields from input
- */
- protected void initialize()
- {
- if (!initialized && (newName!=null) && (inputName!=null))
- {
- initialized = true;
- newName.setText(inputName);
- newName.selectAll();
- if (makeActiveCB != null)
- makeActiveCB.setSelection(true);
- setPageComplete(false);
- }
- }
- /**
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- newNameString = newName.getText().trim();
- boolean closeDialog = verify();
- if (closeDialog)
- {
- if (makeActiveCB != null)
- makeActive = makeActiveCB.getSelection();
- setOutputObject(newNameString);
- }
- return closeDialog;
- }
- /**
- * Verifies all input.
- * @return true if there are no errors in the user input
- */
- public boolean verify()
- {
- clearErrorMessage();
- errorMessage = validateNameInput();
- if (errorMessage != null)
- newName.setFocus();
- return (errorMessage == null);
- }
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setNameValidator(ISystemValidator)
- */
- protected SystemMessage validateNameInput()
- {
- errorMessage = nameValidator.validate(newName.getText());
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- else
- clearErrorMessage();
- setPageComplete();
- return errorMessage;
- }
-
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = false;
- if (errorMessage == null)
- {
- String theNewName = newName.getText().trim();
- pageComplete = (theNewName.length() > 0) && !(theNewName.equalsIgnoreCase(inputName));
- }
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
-
- /**
- * Returns the user-entered new name
- */
- public String getNewName()
- {
- return newNameString;
- }
- /**
- * Returns the make-active checkbox state
- */
- public boolean getMakeActive()
- {
- return makeActive;
- }
-
-
- /**
- * Returns the user-entered new name as an array for convenience to ISystemRenameTarget hosts.
- */
- public String[] getNewNameArray()
- {
- String[] newNames = new String[1];
- newNames[0] = newNameString;
- return newNames;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableProvider.java
deleted file mode 100644
index 0fb79f0f0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableProvider.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rupen Mardirossian (IBM) - [210682] Created for SystemCopyDialog
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-/**
- * This class is the table provider class for the SystemCopyDialog
- */
-public class SystemCopyTableProvider implements ITableLabelProvider, IStructuredContentProvider
-{
-
- static final int COLUMN_IMAGE = 0;
- static final int COLUMN_NAME = 1;
- protected Map imageTable = new Hashtable(20);
- protected Object[] children = null;
-
- /**
- * Constructor for SystemCopyTableProvider
- */
- public SystemCopyTableProvider()
- {
- super();
- }
-
- private SystemCopyTableRow getTableRow(Object element)
- {
- return (SystemCopyTableRow)element;
- }
-
- private Image getImageFromDescriptor(ImageDescriptor descriptor)
- {
- if (descriptor == null)
- return null;
- //obtain the cached image corresponding to the descriptor
- Image image = (Image) imageTable.get(descriptor);
- if (image == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- //System.out.println("...image = " + image);
- return image;
- }
-
- /**
- * @see ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int column)
- {
- if (column == COLUMN_IMAGE)
- return getImageFromDescriptor(getTableRow(element).getImageDescriptor());
- else
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int column)
- {
- String text = ""; //$NON-NLS-1$
- if (column == COLUMN_NAME)
- text = getTableRow(element).getName();
- return text;
- }
-
- /**
- * @see IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener)
- {
- }
-
- /**
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose()
- {
- // The following we got from WorkbenchLabelProvider
- if (imageTable != null)
- {
- Collection imageValues = imageTable.values();
- if (imageValues!=null)
- {
- Iterator images = imageValues.iterator();
- if (images!=null)
- while (images.hasNext())
- ((Image)images.next()).dispose();
- imageTable = null;
- }
- }
- }
-
- /**
- * @see IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property)
- {
- return true;
- }
-
- /**
- * @see IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener)
- {
- }
-
- /**
- * Return rows. Input must be an IStructuredSelection.
- */
- public Object[] getElements(Object inputElement)
- {
- if (children == null)
- {
- List list = (List)inputElement;
- children = new SystemCopyTableRow[list.size()];
- for(int i=0;i<list.size();i++)
- {
- children[i] = new SystemCopyTableRow(list.get(i), i);
- }
- }
- return children;
- }
-
- /**
- * Return the 0-based row number of the given element.
- */
- public int getRowNumber(SystemCopyTableRow row)
- {
- return row.getRowNumber();
- }
-
- /**
- *
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableRow.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableRow.java
deleted file mode 100644
index 88156a5f8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemCopyTableRow.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Rupen Mardirossian (IBM) - [210682] created for SystemCopyDialog
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.ISystemTypedObject;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-
-/**
- * Represents one row in the table in the SystemCopyDialog dialog.
- */
-public class SystemCopyTableRow
-{
-
- private Object element;
- private String name;
- private String type;
- private ImageDescriptor imageDescriptor;
- private ISystemViewElementAdapter adapter;
- private ISystemRemoteElementAdapter remoteAdapter;
- private int rowNbr = 0;
-
- public SystemCopyTableRow(Object element, int rowNbr)
- {
- if (element instanceof SystemSimpleContentElement)
- element = ((SystemSimpleContentElement)element).getData();
- this.element = element;
- this.adapter = getViewAdapter(element);
- this.remoteAdapter = getRemoteAdapter(element);
- this.rowNbr = rowNbr;
- //this.oldName = getAdapter(element).getText(element);
- if (adapter != null)
- this.name = adapter.getName(element);
- else
- {
- if (element instanceof ISystemTypedObject)
- this.name = ((ISystemTypedObject)element).getName();
- else if (element instanceof IResource)
- this.name = ((IResource)element).getName();
- }
- ISystemViewElementAdapter typeAdapter = adapter;
- Object typeElement = element;
- if (typeElement instanceof ISystemFilterPoolReference)
- {
- typeElement = ((ISystemFilterPoolReference)typeElement).getReferencedFilterPool();
- typeAdapter = getViewAdapter(typeElement);
- }
- if (typeAdapter != null)
- this.type = typeAdapter.getType(typeElement);
- else
- {
- if (element instanceof ISystemTypedObject)
- this.type = ((ISystemTypedObject)element).getType();
- else if (element instanceof IResource)
- {
- if ((element instanceof IFolder) || (element instanceof IProject))
- this.type = SystemViewResources.RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE;
- else
- this.type = SystemViewResources.RESID_PROPERTY_FILE_TYPE_FILE_VALUE;
- }
- else
- this.type = element.getClass().getName();
- }
- if (adapter != null)
- this.imageDescriptor = adapter.getImageDescriptor(element);
- else if (element instanceof ISystemTypedObject)
- this.imageDescriptor = ((ISystemTypedObject)element).getImageDescriptor();
- else if (element instanceof IFolder)
- this.imageDescriptor = //PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID);
- else if (element instanceof IFile)
- this.imageDescriptor = RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry().getImageDescriptor(name);
- }
-
- /**
- * Return the name of the item to be copy
- * @return display name of the item.
- */
- public String getName()
- {
- return name;
- }
- /**
- * Return the resource type of the item to be copy
- * @return resource type of the item
- */
- public String getType()
- {
- return type;
- }
- /**
- * Return the 0-based row number of this item
- * @return 0-based row number
- */
- public int getRowNumber()
- {
- return rowNbr;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- */
- public ImageDescriptor getImageDescriptor()
- {
- return imageDescriptor;
- }
-
- /**
- * Get the input object this row represents
- */
- public Object getElement()
- {
- return element;
- }
- /**
- * Get the input object adapter for the input object this row represents
- */
- public ISystemViewElementAdapter getViewAdapter()
- {
- return adapter;
- }
- /**
- * Get the input object remote adapter for the input object this row represents
- */
- public ISystemRemoteElementAdapter getRemoteAdapter()
- {
- return remoteAdapter;
- }
- /**
- * Return true if this is a remote object
- */
- public boolean isRemote()
- {
- return (remoteAdapter != null);
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
- public String toString()
- {
- return name;
- }
-}
-
-
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java
deleted file mode 100644
index 5b38f40ba..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteDialog.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-/**
- * Dialog for confirming resource deletion.
- * <p>
- * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction}
- * action. It asks the user to confirm the deletion of the input selection.
- * <p>If the input objects do not adapt to {@link org.eclipse.rse.ui.view.ISystemViewElementAdapter} or
- * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, then they should implement the
- * interface {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject} so that their type can be
- * displayed in this delete confirmation dialog.
- *
- * @see org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction
- */
-public class SystemDeleteDialog extends SystemPromptDialog
- implements ISelectionChangedListener
-{
- private String warningMessage, warningTip;
- private String promptLabel;
- private SystemDeleteTableProvider sdtp;
- //private Label prompt;
- private Table table;
- private TableViewer tableViewer;
- private GridData tableData;
-
- // column headers
- private String columnHeaders[] = {
- "", //$NON-NLS-1$
- SystemResources.RESID_DELETE_COLHDG_OLDNAME,
- SystemResources.RESID_DELETE_COLHDG_TYPE
- };
-
- // column layout
- private ColumnLayoutData columnLayouts[] =
- {
- new ColumnPixelData(19, false),
- new ColumnWeightData(150,150,true),
- new ColumnWeightData(120,120,true)
- };
-
- // give each column a property value to identify it
- private static String[] tableColumnProperties =
- {
- ISystemPropertyConstants.P_OK,
- IBasicPropertyConstants.P_TEXT,
- ISystemPropertyConstants.P_TYPE,
- };
-
- /**
- * Constructor for SystemUpdateConnectionDialog
- */
- public SystemDeleteDialog(Shell shell)
- {
- super(shell, SystemResources.RESID_DELETE_TITLE);
- super.setOkButtonLabel(SystemResources.RESID_DELETE_BUTTON);
- setHelp(RSEUIPlugin.HELPPREFIX+"ddlt0000"); //$NON-NLS-1$
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- /*ISystemMessageLine msgLine =*/ super.createMessageLine(c);
- return fMessageLine;
- }
-
- /**
- * Specify a warning message to show at the top of the dialog
- */
- public void setWarningMessage(String msg, String tip)
- {
- this.warningMessage = msg;
- this.warningTip = tip;
- }
-
- /**
- * Specify the text to show for the label prompt. The default is
- * "Delete selected resources?"
- */
- public void setPromptLabel(String text)
- {
- this.promptLabel = text;
- }
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return tableViewer.getControl();
- }
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 2;
- Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // PROMPT
- if (promptLabel == null) {
- Object input = getInputObject();
-
- if (input instanceof IStructuredSelection) {
- int size = ((IStructuredSelection)input).size();
-
- if (size > 1) {
- /*prompt =*/ SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT, nbrColumns);
- }
- else {
- /*prompt =*/ SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT_SINGLE, nbrColumns);
- }
- }
- // should never get here
- else {
- /*prompt =*/ SystemWidgetHelpers.createLabel(composite, SystemResources.RESID_DELETE_PROMPT, nbrColumns);
- }
- }
- else {
- /*prompt =*/ SystemWidgetHelpers.createVerbiage(composite, promptLabel, nbrColumns, false, 200);
- }
-
- // WARNING
- if (warningMessage != null)
- {
- // filler line
- SystemWidgetHelpers.createLabel(composite, "", nbrColumns); //$NON-NLS-1$
- // create image
- Image image = getShell().getDisplay().getSystemImage(SWT.ICON_WARNING);
- Label imageLabel = null;
- if (image != null)
- {
- imageLabel = new Label(composite, 0);
- image.setBackground(imageLabel.getBackground());
- imageLabel.setImage(image);
- imageLabel.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER |
- GridData.VERTICAL_ALIGN_BEGINNING));
- }
- Label warningLabel = SystemWidgetHelpers.createLabel(composite, warningMessage);
- if (warningTip != null)
- {
- warningLabel.setToolTipText(warningTip);
- if (imageLabel!=null) {
- imageLabel.setToolTipText(warningTip);
- }
- }
- // filler line
- SystemWidgetHelpers.createLabel(composite, "", nbrColumns); //$NON-NLS-1$
- }
-
- // TABLE
- tableViewer = createTableViewer(composite, nbrColumns);
- createColumns();
- tableViewer.setColumnProperties(tableColumnProperties);
-
- sdtp = new SystemDeleteTableProvider();
-
- int width = tableData.widthHint;
- int nbrRows = Math.min(getRows().length,8);
- int rowHeight = table.getItemHeight() + table.getGridLineWidth();
- int sbHeight = table.getHorizontalBar().getSize().y;
- int height = (nbrRows * rowHeight) + sbHeight;
-
- tableData.heightHint = height;
- table.setLayoutData(tableData);
- table.setSize(width, height);
-
- tableViewer.setLabelProvider(sdtp);
- tableViewer.setContentProvider(sdtp);
-
- Object input = getInputObject();
- tableViewer.setInput(input);
-
- return composite;
- }
-
- private TableViewer createTableViewer(Composite parent, int nbrColumns)
- {
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.HIDE_SELECTION);
- table.setLinesVisible(true);
- tableViewer = new TableViewer(table);
- tableData = new GridData();
- tableData.horizontalAlignment = GridData.FILL;
- tableData.grabExcessHorizontalSpace = true;
- tableData.widthHint = 350;
- tableData.heightHint = 30;
- tableData.verticalAlignment = GridData.CENTER;
- tableData.grabExcessVerticalSpace = true;
- tableData.horizontalSpan = nbrColumns;
- table.setLayoutData(tableData);
- return tableViewer;
- }
-
- private void createColumns()
- {
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
- for (int i = 0; i < columnHeaders.length; i++)
- {
- layout.addColumnData(columnLayouts[i]);
- TableColumn tc = new TableColumn(table, SWT.NONE,i);
- tc.setResizable(columnLayouts[i].resizable);
- tc.setText(columnHeaders[i]);
- }
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- }
-
- /**
- * Override of parent. Must pass selected object onto the form for initializing fields.
- * Called by SystemDialogAction's default run() method after dialog instantiated.
- */
- public void setInputObject(Object inputObject)
- {
- super.setInputObject(inputObject);
- }
-
- /**
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- return true;
- }
-
- /**
- * Returns the rows of deletable items.
- */
- public SystemDeleteTableRow[] getRows()
- {
- return (SystemDeleteTableRow[])sdtp.getElements(getInputObject());
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java
deleted file mode 100644
index 90822e9ca..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableProvider.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-/**
- * This class is the table provider class for the delete dialog
- */
-public class SystemDeleteTableProvider implements ITableLabelProvider, IStructuredContentProvider
-{
-
- static final int COLUMN_IMAGE = 0;
- static final int COLUMN_NAME = 1;
- static final int COLUMN_TYPE = 2;
- protected Map imageTable = new Hashtable(20);
- protected Object[] children = null;
-
- /**
- * Constructor for SystemDeleteTableProvider
- */
- public SystemDeleteTableProvider()
- {
- super();
- }
-
- private SystemDeleteTableRow getTableRow(Object element)
- {
- return (SystemDeleteTableRow)element;
- }
-
- private Image getImageFromDescriptor(ImageDescriptor descriptor)
- {
- if (descriptor == null)
- return null;
- //obtain the cached image corresponding to the descriptor
- Image image = (Image) imageTable.get(descriptor);
- if (image == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- //System.out.println("...image = " + image);
- return image;
- }
-
- /**
- * @see ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int column)
- {
- if (column == COLUMN_IMAGE)
- return getImageFromDescriptor(getTableRow(element).getImageDescriptor());
- else
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int column)
- {
- String text = ""; //$NON-NLS-1$
- if (column == COLUMN_NAME)
- text = getTableRow(element).getName();
- else if (column == COLUMN_TYPE)
- text = getTableRow(element).getType();
- //System.out.println("INSIDE GETCOLUMNTEXT: " + column + ", " + text + ", " + getTableRow(element));
- return text;
- }
-
- /**
- * @see IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener)
- {
- }
-
- /**
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose()
- {
- // The following we got from WorkbenchLabelProvider
- if (imageTable != null)
- {
- Collection imageValues = imageTable.values();
- if (imageValues!=null)
- {
- Iterator images = imageValues.iterator();
- if (images!=null)
- while (images.hasNext())
- ((Image)images.next()).dispose();
- imageTable = null;
- }
- }
- }
-
- /**
- * @see IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property)
- {
- return true;
- }
-
- /**
- * @see IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener)
- {
- }
-
- /**
- * Return rows. Input must be an IStructuredSelection.
- */
- public Object[] getElements(Object inputElement)
- {
- if (children == null)
- {
- IStructuredSelection iss = (IStructuredSelection)inputElement;
- children = new SystemDeleteTableRow[iss.size()];
- Iterator i = iss.iterator();
- int idx = 0;
- while (i.hasNext())
- {
- children[idx] = new SystemDeleteTableRow(i.next(), idx);
- idx++;
- }
- }
- return children;
- }
-
- /**
- * Return the 0-based row number of the given element.
- */
- public int getRowNumber(SystemDeleteTableRow row)
- {
- return row.getRowNumber();
- }
-
- /**
- *
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableRow.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableRow.java
deleted file mode 100644
index b0cde89c1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemDeleteTableRow.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.ISystemTypedObject;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-
-
-/**
- * Represents one row in the table in the SystemDeleteDialog dialog.
- */
-public class SystemDeleteTableRow
-{
-
- private Object element;
- private String name;
- private String type;
- private ImageDescriptor imageDescriptor;
- private ISystemViewElementAdapter adapter;
- private ISystemRemoteElementAdapter remoteAdapter;
- private int rowNbr = 0;
-
- public SystemDeleteTableRow(Object element, int rowNbr)
- {
- if (element instanceof SystemSimpleContentElement)
- element = ((SystemSimpleContentElement)element).getData();
- this.element = element;
- this.adapter = getViewAdapter(element);
- this.remoteAdapter = getRemoteAdapter(element);
- this.rowNbr = rowNbr;
- //this.oldName = getAdapter(element).getText(element);
- if (adapter != null)
- this.name = adapter.getName(element);
- else
- {
- if (element instanceof ISystemTypedObject)
- this.name = ((ISystemTypedObject)element).getName();
- else if (element instanceof IResource)
- this.name = ((IResource)element).getName();
- }
- ISystemViewElementAdapter typeAdapter = adapter;
- Object typeElement = element;
- if (typeElement instanceof ISystemFilterPoolReference)
- {
- typeElement = ((ISystemFilterPoolReference)typeElement).getReferencedFilterPool();
- typeAdapter = getViewAdapter(typeElement);
- }
- if (typeAdapter != null)
- this.type = typeAdapter.getType(typeElement);
- else
- {
- if (element instanceof ISystemTypedObject)
- this.type = ((ISystemTypedObject)element).getType();
- else if (element instanceof IResource)
- {
- if ((element instanceof IFolder) || (element instanceof IProject))
- this.type = SystemViewResources.RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE;
- else
- this.type = SystemViewResources.RESID_PROPERTY_FILE_TYPE_FILE_VALUE;
- }
- else
- this.type = element.getClass().getName();
- }
- if (adapter != null)
- this.imageDescriptor = adapter.getImageDescriptor(element);
- else if (element instanceof ISystemTypedObject)
- this.imageDescriptor = ((ISystemTypedObject)element).getImageDescriptor();
- else if (element instanceof IFolder)
- this.imageDescriptor = //PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID);
- else if (element instanceof IFile)
- this.imageDescriptor = RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry().getImageDescriptor(name);
- }
-
- /**
- * Return the name of the item to be deleted
- * @return display name of the item.
- */
- public String getName()
- {
- return name;
- }
- /**
- * Return the resource type of the item to be deleted
- * @return resource type of the item
- */
- public String getType()
- {
- return type;
- }
- /**
- * Return the 0-based row number of this item
- * @return 0-based row number
- */
- public int getRowNumber()
- {
- return rowNbr;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- */
- public ImageDescriptor getImageDescriptor()
- {
- return imageDescriptor;
- }
-
- /**
- * Get the input object this row represents
- */
- public Object getElement()
- {
- return element;
- }
- /**
- * Get the input object adapter for the input object this row represents
- */
- public ISystemViewElementAdapter getViewAdapter()
- {
- return adapter;
- }
- /**
- * Get the input object remote adapter for the input object this row represents
- */
- public ISystemRemoteElementAdapter getRemoteAdapter()
- {
- return remoteAdapter;
- }
- /**
- * Return true if this is a remote object
- */
- public boolean isRemote()
- {
- return (remoteAdapter != null);
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
- public String toString()
- {
- return name;
- }
-
-
- /* THESE CAUSE GRIEF IF TWO OBJECTS WITH SAME NAME ARE SHOWN
- public boolean equals(Object o)
- {
- if (o instanceof SystemRenameTableRow)
- return ((SystemRenameTableRow)o).getOldName().equalsIgnoreCase(getOldName());
- else if (o instanceof SystemDeleteTableRow)
- return ((SystemDeleteTableRow)o).getOldName().equalsIgnoreCase(getOldName());
- else if (o instanceof String)
- return ((String)o).equalsIgnoreCase(getOldName());
- else
- return super.equals(o);
- }
- public int hashCode()
- {
- return getOldName().hashCode();
- }
- */
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java
deleted file mode 100644
index d5af9af26..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameDialog.java
+++ /dev/null
@@ -1,696 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- * David McKnight (IBM) - [242714] Esc on Multiple Rename Dialog doesn't close the dialog
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ICellEditorListener;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ISystemValidatorUniqueString;
-import org.eclipse.rse.ui.validators.ValidatorConnectionName;
-import org.eclipse.rse.ui.validators.ValidatorUniqueString;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Dialog for renaming multiple resources.
- * <p>
- * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction}
- * action.
- * <p>
- * To use this dialog, you must call setInputObject with a StructuredSelection of the objects to be renamed.
- * If those objects adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
- * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, the dialog will offer built-in error checking.
- * <p>
- * If the input objects do not adapt to org.eclipse.rse.ui.view.ISystemRemoteElementAdapter or ISystemViewElementAdapter, then you
- * should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
- * specify a validator that is called to verify the typed new name is valid. Further, to show the type value
- * of the input objects, they should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
- * <p>
- * This dialog does not do the actual renames. Rather, it will return an array of the user-typed new names. These
- * are queriable via {@link #getNewNames()}, after testing that {@link #wasCancelled()} is false. The array entries
- * will match the input order.
- *
- * @see org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction
- */
-public class SystemRenameDialog extends SystemPromptDialog
- implements
- ISelectionChangedListener,
- TraverseListener,
- ICellEditorListener, Runnable, FocusListener
-{
-
- private SystemMessage errorMessage;
- private TextCellEditor cellEditor;
- private int currRow = 0;
- private GridData tableData = null;
- private boolean ignoreSelection = false;
- private Hashtable uniqueNameValidatorPerParent = new Hashtable();
-
- private String verbiage;
-
- private SystemRenameTableProvider srtp;
- private Table table;
- private TableViewer tableViewer;
- private static final int COLUMN_NEWNAME = SystemRenameTableProvider.COLUMN_NEWNAME;
- private String columnHeaders[] = {
- "",SystemResources.RESID_RENAME_COLHDG_OLDNAME, //$NON-NLS-1$
- SystemResources.RESID_RENAME_COLHDG_NEWNAME,
- SystemResources.RESID_RENAME_COLHDG_TYPE
- };
- private ColumnLayoutData columnLayouts[] =
- {
- new ColumnPixelData(19, false),
- new ColumnWeightData(125,125,true),
- new ColumnWeightData(150,150,true),
- new ColumnWeightData(120,120,true)
- };
- // give each column a property value to identify it
- private static String[] tableColumnProperties =
- {
- ISystemPropertyConstants.P_ERROR,
- IBasicPropertyConstants.P_TEXT,
- ISystemPropertyConstants.P_NEWNAME,
- ISystemPropertyConstants.P_TYPE,
- };
- // inner class to support cell editing
- private ICellModifier cellModifier = new ICellModifier()
- {
- public Object getValue(Object element, String property)
- {
- SystemRenameTableRow row = (SystemRenameTableRow)element;
- String value = ""; //$NON-NLS-1$
- if (property.equals(IBasicPropertyConstants.P_TEXT))
- value = row.getName();
- else
- value = row.getNewName();
- //System.out.println("inside getvalue: " + row + "; " + property + " = " + value);
- return value;
- }
-
- public boolean canModify(Object element, String property)
- {
- boolean modifiable = property.equals(ISystemPropertyConstants.P_NEWNAME);
- if (modifiable)
- {
- if ((cellEditor != null) && (cellEditor.getControl() != null))
- {
- SystemRenameTableRow row = (SystemRenameTableRow)element;
- int limit = row.getNameLengthLimit();
- if (limit == -1)
- limit = 1000;
- ((Text)cellEditor.getControl()).setTextLimit(limit);
- }
- }
- return modifiable;
- }
- /**
- * Modifies a marker as a result of a successfully completed direct editing.
- */
- public void modify(Object element, String property, Object value)
- {
- SystemRenameTableRow row = (SystemRenameTableRow)(((TableItem)element).getData());
- //System.out.println("inside modify: " + row+"; "+property+", "+value);
- if (property.equals(ISystemPropertyConstants.P_NEWNAME))
- {
- row.setNewName((String)value);
- tableViewer.update(row, null);
- }
- }
- };
-
-
- /**
- * Constructor for SystemRenameDialog
- */
- public SystemRenameDialog(Shell shell)
- {
- this(shell, SystemResources.RESID_RENAME_TITLE);
- }
- /**
- * Constructor when you have your own title
- */
- public SystemRenameDialog(Shell shell, String title)
- {
- super(shell, title);
-
- //pack();
- setHelp(RSEUIPlugin.HELPPREFIX+"drnm0000"); //$NON-NLS-1$
- }
- /**
- * Set the verbiage to show above the table. The default is "Enter new name for each resource"
- */
- public void setVerbiage(String verbiage)
- {
- this.verbiage = verbiage;
- }
- /**
- * Set the validator for the new name,as supplied by the adaptor for name checking.
- * Overrides the default which is to query it from the object's adapter.
- */
- public void setNameValidator(ISystemValidator nameValidator)
- {
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- return fMessageLine;
- }
-
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- SystemRenameTableRow[] rows = getRows();
- tableViewer.setSelection(new StructuredSelection(rows[0]),true);
- tableViewer.editElement(rows[0], COLUMN_NEWNAME);
- return null;
- }
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 1;
- Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- if (verbiage != null)
- SystemWidgetHelpers.createVerbiage(composite, verbiage, nbrColumns, false, 200);
- else
- SystemWidgetHelpers.createVerbiage(composite, SystemResources.RESID_RENAME_VERBIAGE, nbrColumns, false, 200);
-
- table = createTable(composite);
- tableViewer = new TableViewer(table);
- createColumns();
- tableViewer.setColumnProperties(tableColumnProperties);
- tableViewer.setCellModifier(cellModifier);
- CellEditor editors[] = new CellEditor[columnHeaders.length];
- cellEditor = new TextCellEditor(table);
- cellEditor.addListener(this);
- editors[COLUMN_NEWNAME] = cellEditor;
- tableViewer.setCellEditors(editors);
- cellEditor.getControl().addTraverseListener(this);
- //System.out.println("CELL EDITOR CONTROL: " + cellEditor.getControl());
-
- srtp = new SystemRenameTableProvider();
- int width = tableData.widthHint;
- int nbrRows = Math.min(getRows().length,8);
- int rowHeight = table.getItemHeight() + table.getGridLineWidth();
- int sbHeight = table.getHorizontalBar().getSize().y;
- int height = (nbrRows * rowHeight) + sbHeight;
- //System.out.println("#rows = "+nbrRows+", sbHeight = " + sbHeight+", totalHeight="+height);
- tableData.heightHint = height;
- table.setLayoutData(tableData);
- table.setSize(width, height);
- tableViewer.setLabelProvider(srtp);
- tableViewer.setContentProvider(srtp);
- //System.out.println("Input Object: "+getInputObject());
- tableViewer.setInput(getInputObject());
-
- tableViewer.addSelectionChangedListener(this);
- tableViewer.getTable().addFocusListener(this);
-
- // test if we need a unique name validator
- Shell shell = getShell();
- Display display = shell.getDisplay();
- if (display != null)
- display.asyncExec(this);
- else
- run();
-
- return composite;
- }
-
-
- private Table createTable(Composite parent)
- {
- //table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER);
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- table.setLinesVisible(true);
- tableData = new GridData();
- tableData.horizontalAlignment = GridData.FILL;
- tableData.grabExcessHorizontalSpace = true;
- tableData.widthHint = 450;
- tableData.heightHint= 30;
- tableData.verticalAlignment = GridData.CENTER;
- tableData.grabExcessVerticalSpace = true;
- table.setLayoutData(tableData);
-
- //table.addTraverseListener(this);
- //getShell().addTraverseListener(this);
-
-
- return table;
- }
- private void createColumns()
- {
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
- for (int i = 0; i < columnHeaders.length; i++)
- {
- layout.addColumnData(columnLayouts[i]);
- TableColumn tc = new TableColumn(table, SWT.NONE,i);
- tc.setResizable(columnLayouts[i].resizable);
- tc.setText(columnHeaders[i]);
- //tc.addSelectionListener(headerListener);
- }
- }
- public void selectionChanged(SelectionChangedEvent event)
- {
- //System.out.println("Selection changed. ignoreSelection? "+ignoreSelection);
- if (ignoreSelection)
- return;
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection.isEmpty())
- {
- currRow = -1;
- return;
- }
- SystemRenameTableRow selectedRow = (SystemRenameTableRow)selection.getFirstElement();
- int rowIdx = srtp.getRowNumber(selectedRow);
- if (rowIdx == currRow)
- return;
- currRow = rowIdx;
- tableViewer.editElement(getRows()[rowIdx], COLUMN_NEWNAME);
- }
- /**
- * Override of parent. Must pass selected object onto the form for initializing fields.
- * Called by SystemDialogAction's default run() method after dialog instantiated.
- */
- public void setInputObject(Object inputObject)
- {
- //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject);
- super.setInputObject(inputObject);
- }
-
- /**
- * Called when user presses OK button.
- * This does not do the actual renames, but rather updates the new name array.
- * You need to query this via {@link #getNewNames()}, after ensuring the dialog was not
- * cancelled by calling {@link #wasCancelled()}.
- */
- protected boolean processOK()
- {
- // the following is for defect 41565 where the changed name is not used when enter pressed after typing
- if ((currRow >=0) && (currRow <= (getRows().length - 1)))
- {
- String newName = ((Text)cellEditor.getControl()).getText();
- //System.out.println("Testing. newName = "+newName);
- getRows()[currRow].setNewName(newName);
- }
- //else
- // System.out.println("currRow = "+currRow);
-
- boolean closeDialog = verify();
- if (closeDialog)
- {
- }
- return closeDialog;
- }
- /**
- * Verifies all input.
- * @return true if there are no errors in the user input
- */
- public boolean verify()
- {
- SystemMessage errMsg = null;
- SystemMessage firstErrMsg = null;
- SystemRenameTableRow firstErrRow = null;
- clearErrorMessage();
- SystemRenameTableRow[] rows = getRows();
- Vector newNames = new Vector();
- // first, clear pending errors...
- for (int idx=0; (idx<rows.length); idx++)
- rows[idx].setErrorMessage(null);
- // check 1: all entries have a new name, and the new name is unique for this list.
- for (int idx=0; (firstErrMsg==null) && (idx<rows.length); idx++)
- //for (int idx=0; (idx<rows.length); idx++)
- {
- errMsg = null;
- String oldName = rows[idx].getName();
- String newName = rows[idx].getNewName();
- String canonicalNewName = rows[idx].getCanonicalNewName(); // defect 42145
- //if (oldName.equalsIgnoreCase(newName)) // does not consider case for linux or unix or quoted names on iseries
- if (rows[idx].newNameEqualsOldName())
- errMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_RENAME_OLDEQUALSNEW).makeSubstitution(oldName);
- //errMsg = SystemMessage.sub(RSEUIPlugin.getString(MSG_VALIDATE_RENAME_OLDEQUALSNEW),SystemMessage.MSG_SUB1,newName);
- //else if (newNames.contains(newName)) defect 42145
- else if (newNames.contains(canonicalNewName))
- errMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_RENAME_NOTUNIQUE).makeSubstitution(newName);
- //errMsg = SystemMessage.sub(RSEUIPlugin.getString(MSG_VALIDATE_RENAME_NOTUNIQUE),SystemMessage.MSG_SUB1,newName);
- else
- {
- ISystemValidator nameValidator = rows[idx].getNameValidator();
- if (nameValidator != null)
- errMsg = nameValidator.validate(newName);
- if (errMsg == null)
- {
- ValidatorUniqueString vun = rows[idx].getUniqueNameValidator();
- if (vun != null)
- errMsg = vun.validate(newName);
- }
- if ((errMsg == null) && (rows[idx].getElement() instanceof IHost))
- {
- boolean ok = ValidatorConnectionName.validateNameNotInUse(newName, getShell());
- if (!ok)
- errMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELLED);
- }
-
- }
- if (errMsg == null)
- {
- //newNames.addElement(newName);
- newNames.addElement(canonicalNewName); // defect 42145
- }
- if (errMsg != null)
- {
- firstErrMsg = errMsg;
- firstErrRow = rows[idx];
- }
- rows[idx].setErrorMessage(errMsg); // todo: convert to handle SystemMessage object
- }
- if (firstErrMsg != null)
- {
- setErrorMessage(firstErrMsg);
- tableViewer.update(rows,null);
- tableViewer.setSelection(new StructuredSelection(firstErrRow),true);
- tableViewer.editElement(firstErrRow,COLUMN_NEWNAME);
- }
- return (firstErrMsg == null);
- }
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setNameValidator(ISystemValidator)
- */
- protected SystemMessage validateNameInput()
- {
- errorMessage= null;
- if (errorMessage == null)
- clearErrorMessage();
- else
- setErrorMessage(errorMessage);
- setPageComplete();
- return errorMessage;
- }
-
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = false;
- if (errorMessage == null)
- pageComplete = true;
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
-
- /**
- * Required by TraverseListener.
- * We want to know when the tab key is pressed so we can give edit focus to the next name
- */
- public void keyTraversed(TraverseEvent e)
- {
- int detail = e.detail;
- //System.out.println("in keyTraversed: " + keycode + ", " + detail + ", " + doit);
- e.doit = false;
- ignoreSelection = true;
-
-
- //System.out.println("...Key pressed. currRow = "+currRow);
-
- // DEFECT 41807 STATED USERS SHOULD BE ALLOWED TO TAB TO THE BUTTONS
- if (detail == SWT.TRAVERSE_TAB_NEXT)
- {
- if (currRow != getRows().length-1)
- {
- ++currRow;
- //System.out.println("...D TAB pressed. currRow = "+currRow);
- //tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
- tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
- }
- else
- {
- tableViewer.editElement(getRows()[0], COLUMN_NEWNAME);
- currRow = 0;
- e.doit = true;
- }
- }
- else if (detail == SWT.TRAVERSE_TAB_PREVIOUS)
- {
- if (currRow != 0)
- {
- if (currRow > 0)
- --currRow;
- else
- currRow = 0;
- //System.out.println("...D BACKTAB pressed. currRow = "+currRow);
- //tableViewer.setSelection(new StructuredSelection(getRows()[currRow]),true);
- tableViewer.editElement(getRows()[currRow], COLUMN_NEWNAME);
- }
- else
- {
- tableViewer.editElement(getRows()[getRows().length-1], COLUMN_NEWNAME);
- currRow = getRows().length-1;
- e.doit = true;
- }
- }
- else if (detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- else
- e.doit = true;
- ignoreSelection = false;
- }
-
- /**
- * Returns the rows of rename items.
- */
- public SystemRenameTableRow[] getRows()
- {
- return (SystemRenameTableRow[])srtp.getElements(getInputObject());
- }
-
- /**
- * Returns an array of the new names.
- */
- public String[] getNewNames()
- {
- SystemRenameTableRow[] rows = getRows();
- String[] names = new String[rows.length];
- for (int idx=0; idx<rows.length; idx++)
- names[idx] = rows[idx].getNewName();
- return names;
- }
-
- // CELL EDITOR METHODS
- public void applyEditorValue()
- {
- //System.out.println("CELLEDITOR: INSIDE APPLYEDITORVALUE");
- }
- public void cancelEditor()
- {
- //System.out.println("CELLEDITOR: INSIDE CANCELEDITOR");
- }
- public void editorValueChanged(boolean oldValidState,boolean newValidState)
- {
- //System.out.println("CELLEDITOR: INSIDE EDITORVALUECHANGED: "+oldValidState+","+newValidState);
- }
-
- /**
- * Runnable method
- */
- public void run()
- {
- SystemRenameTableRow[] rows = getRows();
- ValidatorUniqueString uniqueNameValidator = null;
- Object inputElement = null;
- ISystemValidator nameValidator = null;
- for (int idx=0; idx<rows.length; idx++)
- {
- nameValidator = rows[idx].getNameValidator();
- inputElement = rows[idx].getElement();
- uniqueNameValidator = setUniqueNameValidator(inputElement, nameValidator);
- rows[idx].setUniqueNameValidator(uniqueNameValidator);
- }
- }
-
- /**
- * Given an input element and externally-suppplied name validator for it, determine if we
- * need to augment that validator with one that will check for uniqueness, and if so
- * create and register that uniqueness validator
- */
- protected ValidatorUniqueString setUniqueNameValidator(Object inputElement, ISystemValidator nameValidator)
- {
- ValidatorUniqueString uniqueNameValidator = null;
- ISystemRemoteElementAdapter ra = getRemoteAdapter(inputElement);
- boolean debug = false;
- String parentName = null;
- if (ra != null)
- parentName = ra.getAbsoluteParentName(inputElement);
- if ((ra != null) && (parentName != null))
- {
- uniqueNameValidator = (ValidatorUniqueString)uniqueNameValidatorPerParent.get(parentName);
- if (uniqueNameValidator != null)
- {
- if (debug)
- System.out.println("Existing name list found for parent " + parentName); //$NON-NLS-1$
- return uniqueNameValidator;
- }
- else if (debug)
- System.out.println("No existing name list found for parent " + parentName); //$NON-NLS-1$
- }
- if ((ra != null) && (parentName != null))
- {
- String[] names = null;
- boolean caseSensitive = ra.getSubSystem(inputElement).getSubSystemConfiguration().isCaseSensitive();
- boolean needUniqueNameValidator = !(nameValidator instanceof ISystemValidatorUniqueString);
- if (!needUniqueNameValidator)
- {
- String[] existingNames = ((ISystemValidatorUniqueString)nameValidator).getExistingNamesList();
- needUniqueNameValidator = ((existingNames == null) || (existingNames.length==0));
- }
- if (needUniqueNameValidator)
- {
- // Set the busy cursor to all shells.
- super.setBusyCursor(true);
- try {
- names = ra.getRemoteParentNamesInUse(inputElement, null);
- } catch (Exception exc) {SystemBasePlugin.logError("Exception getting parent's child names in rename dialog",exc);} //$NON-NLS-1$
- if ((names != null) && (names.length>0))
- {
- uniqueNameValidator = new ValidatorUniqueString(names,caseSensitive);
- uniqueNameValidator.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- uniqueNameValidatorPerParent.put(parentName, uniqueNameValidator);
- if (debug)
- {
- System.out.println("Name validator set. Names = "); //$NON-NLS-1$
- for (int idx=0; idx<names.length; idx++)
- System.out.println("..."+idx+": "+names[idx]); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- // Restore cursor
- super.setBusyCursor(false);
- }
- }
- return uniqueNameValidator;
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- if (!(o instanceof IAdaptable))
- return (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class);
- return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
- }
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
- */
- public void focusGained(FocusEvent e)
- {
- /*
- IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
- if (selection.isEmpty())
- {
- currRow = -1;
- return;
- }
- SystemRenameTableRow selectedRow = (SystemRenameTableRow)selection.getFirstElement();
- int rowIdx = srtp.getRowNumber(selectedRow);
- if (rowIdx == currRow)
- return;
- currRow = rowIdx;
- tableViewer.editElement(getRows()[rowIdx], COLUMN_NEWNAME);
- */
- //System.out.println("Focus gained");
- }
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost(FocusEvent e)
- {
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableProvider.java
deleted file mode 100644
index f9a448caf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableProvider.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.graphics.Image;
-
-/**
- *
- */
-public class SystemRenameTableProvider implements ITableLabelProvider, IStructuredContentProvider
-{
- static final int COLUMN_ERROR = 0;
- static final int COLUMN_OLDNAME = 1;
- static final int COLUMN_NEWNAME = 2;
- static final int COLUMN_TYPE = 3;
- private Map imageTable = new Hashtable(20);
- private Object[] children = null;
- private ISystemValidator inputValidator = null;
-
- /**
- * Constructor for SystemRenameTableProvider
- */
- public SystemRenameTableProvider()
- {
- super();
- }
-
- /**
- * Set the validator for the new name,as supplied by the adaptor for name checking.
- * Overrides the default which is to query it from the object's adapter.
- */
- public void setNameValidator(ISystemValidator nameValidator)
- {
- inputValidator = nameValidator;
- }
-
- private SystemRenameTableRow getTableRow(Object element)
- {
- return (SystemRenameTableRow)element;
- }
-
- private Image getImageFromDescriptor(ImageDescriptor descriptor)
- {
- if (descriptor == null)
- return null;
- //obtain the cached image corresponding to the descriptor
- Image image = (Image) imageTable.get(descriptor);
- if (image == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- //System.out.println("...image = " + image);
- return image;
- }
-
- /**
- * @see ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int column)
- {
- if (column == COLUMN_ERROR)
- {
- SystemRenameTableRow row = getTableRow(element);
- if (row.getError())
- {
- Image errorImage = JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
- //RSEUIPlugin.getDefault().getImage(ISystemConstants.ICON_SYSTEM_ERROR_ID);
- return errorImage;
- }
- else
- return null;
- }
- else if (column == COLUMN_OLDNAME)
- return getImageFromDescriptor(getTableRow(element).getImageDescriptor());
- else
- return null;
- }
-
- /**
- * @see ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int column)
- {
- String text = ""; //$NON-NLS-1$
- if (column == COLUMN_OLDNAME)
- text = getTableRow(element).getName();
- else if (column == COLUMN_NEWNAME)
- text = getTableRow(element).getNewName();
- else if (column == COLUMN_TYPE)
- text = getTableRow(element).getType();
- //System.out.println("INSIDE GETCOLUMNTEXT: " + column + ", " + text + ", " + getTableRow(element));
- return text;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener)
- {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
- */
- public void dispose()
- {
- // The following we got from WorkbenchLabelProvider
- if (imageTable != null)
- {
- Collection imageValues = imageTable.values();
- if (imageValues!=null)
- {
- Iterator images = imageValues.iterator();
- if (images!=null)
- while (images.hasNext())
- ((Image)images.next()).dispose();
- imageTable = null;
- }
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property)
- {
- return true;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener)
- {
- }
-
- /**
- * Return rows. Input must be an IStructuredSelection.
- */
- public Object[] getElements(Object inputElement)
- {
- if (children == null)
- {
- IStructuredSelection iss = (IStructuredSelection)inputElement;
- children = new SystemRenameTableRow[iss.size()];
- Iterator i = iss.iterator();
- int idx = 0;
- while (i.hasNext())
- {
- children[idx] = new SystemRenameTableRow(i.next(),idx);
- if (inputValidator != null)
- ((SystemRenameTableRow)children[idx]).setNameValidator(inputValidator);
- idx++;
- }
- }
- return children;
- }
-
- /**
- *
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
-
-
- }
-
- /**
- * Return the 0-based row number of the given element.
- */
- public int getRowNumber(SystemRenameTableRow row)
- {
- int matchRow = row.getRowNumber();
- /*
- int matchRow = -1;
- boolean match = false;
- for (int idx=0; !match && (matchRow<children.length); idx++)
- {
- //match = children[idx].equals(row);
- match = (children[idx] == row);
- if (match)
- matchRow = idx;
- }
- */
- //System.out.println("getRowNumber for "+row+": "+matchRow);
- return matchRow;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableRow.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableRow.java
deleted file mode 100644
index a0e0fc9a2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemRenameTableRow.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [226143] [api][breaking] Make RSE rename/delete dialogs internal
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorUniqueString;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-
-
-
-/**
- * Represents one row in the table in the SystemRenameDialog dialog.
- */
-public class SystemRenameTableRow extends SystemDeleteTableRow
-{
- private String newName;
- private SystemMessage errorMsg = null;
- private ISystemValidator inputValidator = null;
- private ValidatorUniqueString inputUniqueNameValidator = null;
- private Object parent;
- private int nameLengthLimit = -1;
-
- /**
- * Constructor
- * @param element that is being displayed in the tree, and which the
- * user selected the rename action. This represents a single item.
- */
- public SystemRenameTableRow(Object element, int rowNbr)
- {
- super(element,rowNbr);
- this.newName = getName();
- this.inputValidator = getViewAdapter(element).getNameValidator(element);
- if (inputValidator != null) {
- nameLengthLimit = inputValidator.getMaximumNameLength();
- }
- }
-
- /**
- * Set the new name for this element. Called by the CellModifier
- * for the rename dialog.
- */
- public void setNewName(String name)
- {
- //System.out.println("Inside setNewName: from " + newName + ", to " + name);
- if (name != null)
- {
- if (isRemote()) // defect 43173
- newName = trimTrailing(name); // defect 43041
- else
- newName = name.trim();
- }
- else
- newName = null;
- }
-
- /**
- * Trim leading blanks
- */
- public static String trimTrailing(String text)
- {
- return ("."+text).trim().substring(1); //$NON-NLS-1$
- }
-
- /**
- * Return the new name for this element, as set by setNewName
- */
- public String getNewName()
- {
- return newName;
- }
-
- /**
- * Get the parent of this remote object that is being renamed
- */
- public Object getParent()
- {
- return parent;
- }
-
- /**
- * Set the parent of this remote object that is being renamed
- */
- public void setParent(Object parent)
- {
- this.parent = parent;
- }
-
- /**
- * Get the canonical name of this row. Sometimes, the name alone is not enough to do uniqueness
- * checking on. For example, two connections or filter pools can have the same name if they are
- * in different profiles. Two iSeries QSYS objects can have the same name if their object types
- * are different.
- * <p>
- * This method returns a name that can be used for uniqueness checking because it is qualified
- * sufficiently to make it unique.
- * <p>
- * Defers to the object's adapter
- */
- public String getCanonicalNewName()
- {
- // this is all for defect 42145
- Object element = super.getElement();
- ISystemViewElementAdapter adapter = super.getViewAdapter();
- String cName = newName;
- if (adapter != null)
- cName = adapter.getCanonicalNewName(element, newName);
- else
- cName = newName;
- //System.out.println("Inside getCanonicalNewName: newName: " + newName + ", canonical: " + cName);
- return cName;
- }
- /**
- * Compares the given new name to this row's current name, taking into consideration case if appropriate.
- * Defers to the object's adapter
- */
- public boolean newNameEqualsOldName()
- {
- Object element = super.getElement();
- ISystemViewElementAdapter adapter = super.getViewAdapter();
- if (adapter != null)
- return adapter.namesAreEqual(element, newName);
- else
- return getName().equals(newName);
- }
-
- /**
- * Return the name length limit, if available via the name validator supplied by the adapter.
- * Returns -1 if not available.
- */
- public int getNameLengthLimit()
- {
- return nameLengthLimit;
- }
-
- /**
- * Set the validator for the new name,as supplied by the adaptor for name checking.
- * Overrides the default which is to query it from the object's adapter.
- */
- public void setNameValidator(ISystemValidator nameValidator)
- {
- inputValidator = nameValidator;
- }
-
- /**
- * Set the uniqueness validator for the new name,as supplied by the remote adaptor.
- */
- public void setUniqueNameValidator(ValidatorUniqueString uniqueNameValidator)
- {
- inputUniqueNameValidator = uniqueNameValidator;
- }
-
- /**
- * Return the validator for the new name,as supplied by the adaptor for
- * this element type.
- * <p>
- * By default queries it from the object's adapter, unless setNameValidator has been
- * called.
- */
- public ISystemValidator getNameValidator()
- {
- return inputValidator;
- }
-
- /**
- * Return the uniqueness validator for the new name,as supplied by the call to setUniqueNameValidator
- */
- public ValidatorUniqueString getUniqueNameValidator()
- {
- return inputUniqueNameValidator;
- }
-
- /**
- * Return true if this row is currently in error
- */
- public boolean getError()
- {
- return errorMsg != null;
- }
- /**
- * Return text of error if this row is currently in error
- */
- public SystemMessage getErrorMessage()
- {
- return errorMsg;
- }
- /**
- * Set error message for this row.
- * Pass null to clear it.
- */
- public void setErrorMessage(SystemMessage errorMsg)
- {
- this.errorMsg = errorMsg;
- }
-
- public String toString()
- {
- return getNewName();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemResolveFilterStringDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemResolveFilterStringDialog.java
deleted file mode 100644
index f7af4d6c8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemResolveFilterStringDialog.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemResolveFilterStringAPIProviderImpl;
-import org.eclipse.rse.internal.ui.view.SystemViewForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Dialog for testing a filter string. Typically called from a create/update filter string dialog.
- * <p>
- * Caller must supply the subsystem which owns this existing or potential filter string.
- * <p>
- * This dialog contains a dropdown for selecting connections to use in the test. Only connections which
- * contain subsystems with the same parent factory as the given subsystem factory are shown.
- *
- */
-public class SystemResolveFilterStringDialog extends SystemTestFilterStringDialog
-{
-
- /**
- * Constructor
- * @param shell The shell to hang the dialog off of
- * @param subsystem The contextual subsystem that owns this filter string
- * @param filterString The filter string that is to be tested.
- */
- public SystemResolveFilterStringDialog(Shell shell, ISubSystem subsystem, String filterString)
- {
- super(shell, subsystem, filterString);
- setShowOkButton(true);
- }
-
- /**
- * Constructor when unique title desired
- * @param shell The shell to hang the dialog off of
- * @param title The title to give the dialog
- * @param subsystem The contextual subsystem that owns this filter string
- * @param filterString The filter string that is to be tested.
- */
- public SystemResolveFilterStringDialog(Shell shell, String title, ISubSystem subsystem, String filterString)
- {
- super(shell, title, subsystem, filterString);
- setShowOkButton(true);
- }
-
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int gridColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);
-
- // connection selection combo
- connectionCombo = SystemWidgetHelpers.createConnectionCombo(composite_prompts, null, null, subsystem.getSubSystemConfiguration(),
- null, null, subsystem.getHost(), gridColumns, false);
-
- // Composite promptComposite = composite_prompts;
- Composite promptComposite = connectionCombo;
- prompt = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
- promptValue = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
-
- promptValue.setToolTipText(filterString); // Since the dialog is not resizable, this is the way to show the whole string
-
- String label = filterString;
-
- if ( label.length() > 30)
- label = label.substring(0,30) + " ..."; // Use ... to show that not entire string is displayed //$NON-NLS-1$
- promptValue.setText(label);
-
- GridData data = new GridData();
- data.widthHint = 200;
- promptValue.setLayoutData(data);
-
- // Tree viewer
- inputProvider = new SystemResolveFilterStringAPIProviderImpl(subsystem, filterString);
- tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, true, getMessageLine(), gridColumns, 1);
-
- // add selection listeners
- //tree.addSelectionChangedListener(this);
- connectionCombo.addSelectionListener(this);
-
- return composite_prompts;
- } // end createInner()
-
-
-} // end class SystemResolveFilterStringDialog
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemTestFilterStringDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemTestFilterStringDialog.java
deleted file mode 100644
index b3c481c23..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemTestFilterStringDialog.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemTestFilterStringAPIProviderImpl;
-import org.eclipse.rse.internal.ui.view.SystemViewForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.widgets.SystemHostCombo;
-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.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Dialog for testing a filter string. Typically called from a create/update filter string dialog.
- * <p>
- * Caller must supply the subsystem which owns this existing or potential filter string.
- * <p>
- * This dialog contains a dropdown for selecting connections to use in the test. Only connections which
- * contain subsystems with the same parent factory as the given subsystem factory are shown.
- *
- */
-public class SystemTestFilterStringDialog
- extends SystemPromptDialog
- implements ISelectionChangedListener, SelectionListener
-{
- protected ISubSystem subsystem = null;
- protected ISystemRegistry sr = null;
- protected String subsystemConfigurationId = null;
- protected String filterString = null;
- protected SystemTestFilterStringAPIProviderImpl inputProvider = null;
- // GUI widgets
- protected Label prompt, promptValue;
- protected SystemViewForm tree;
- protected SystemHostCombo connectionCombo;
-
- /**
- * Constructor
- * @param shell The shell to hang the dialog off of
- * @param subsystem The contextual subsystem that owns this filter string
- * @param filterString The filter string that is to be tested.
- */
- public SystemTestFilterStringDialog(Shell shell, ISubSystem subsystem, String filterString)
- {
- this(shell, SystemResources.RESID_TESTFILTERSTRING_TITLE, subsystem, filterString);
- }
- /**
- * Constructor when unique title desired
- * @param shell The shell to hang the dialog off of
- * @param title The title to give the dialog
- * @param subsystem The contextual subsystem that owns this filter string
- * @param filterString The filter string that is to be tested.
- */
- public SystemTestFilterStringDialog(Shell shell, String title, ISubSystem subsystem, String filterString)
- {
- super(shell, title);
- setCancelButtonLabel(SystemResources.BUTTON_CLOSE);
- setShowOkButton(false);
- setBlockOnOpen(true); // always modal
- this.subsystem = subsystem;
- this.filterString = filterString;
- this.subsystemConfigurationId = subsystem.getSubSystemConfiguration().getId();
- sr = RSECorePlugin.getTheSystemRegistry();
- setNeedsProgressMonitor(true);
- //pack();
- }
-
- // ------------------
- // PUBLIC METHODS...
- // ------------------
- // ------------------
- // PRIVATE METHODS...
- // ------------------
- /**
- * Private method.
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- //return tree.getTreeControl();
- return connectionCombo.getCombo();
- }
-
- /**
- * Private method.
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int gridColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, gridColumns);
-
- // connection selection combo
- connectionCombo = SystemWidgetHelpers.createConnectionCombo(composite_prompts, null, null, subsystem.getSubSystemConfiguration(),
- null, null, subsystem.getHost(), gridColumns, false);
-
- // filter string prompt
- // Composite promptComposite = composite_prompts;
- Composite promptComposite = connectionCombo;
- prompt = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
- promptValue = SystemWidgetHelpers.createLabel(promptComposite, SystemResources.RESID_TESTFILTERSTRING_PROMPT_LABEL, SystemResources.RESID_TESTFILTERSTRING_PROMPT_TOOLTIP);
-
- promptValue.setToolTipText(filterString); // Since the dialog is not resizable, this is the way to show the whole string
-
- // Make sure the label width is not longer than the window width
- // Otherwise the combo box dropdown arrow above it will be pushed beyond the window and invisible
- //promptValue.setText(filterString);
-
- String label = filterString;
-
- if ( label.length() > 30)
- label = label.substring(0,30) + " ..."; // Use ... to show that not entire string is displayed //$NON-NLS-1$
- promptValue.setText( label);
-
- //Point point = promptValue.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- //GridData data = new GridData();
- //data.widthHint = point.x < 230 ? point.x : 230;
- GridData data = new GridData();
- data.widthHint = 200;
- promptValue.setLayoutData(data);
-
- // TREE
- inputProvider = new SystemTestFilterStringAPIProviderImpl(subsystem, filterString);
- tree = new SystemViewForm(getShell(), composite_prompts, SWT.NULL, inputProvider, false, getMessageLine(), gridColumns, 1);
-
- // add selection listeners
- //tree.addSelectionChangedListener(this);
- connectionCombo.addSelectionListener(this);
-
- return composite_prompts;
- }
-
- /**
- * Override of parent. Must pass selected object onto the form for initializing fields.
- * Called by SystemDialogAction's default run() method after dialog instantiated.
- */
- public void setInputObject(Object inputObject)
- {
- super.setInputObject(inputObject);
- }
-
- /**
- * When re-using this dialog between runs, call this to reset its contents.
- * Assumption: original input subsystem factory Id doesn't change between runs
- */
- public void reset(ISubSystem subsystem, String filterString)
- {
- this.subsystem = subsystem;
- this.filterString = filterString;
- //this.subsystemConfigurationId = subsystem.getParentSubSystemConfiguration().getId();
- inputProvider.setSubSystem(subsystem);
- inputProvider.setFilterString(filterString);
- tree.reset(inputProvider);
- }
-
- /**
- * ISelectionChangedListener interface method
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- }
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
- public void widgetSelected(SelectionEvent event)
- {
-
- //if (src == connectionCombo.getCombo())
- {
- //System.out.println("connection changed");
- IHost newConnection = connectionCombo.getHost();
- ISubSystem newSubSystem = null;
- ISubSystemConfiguration config = sr.getSubSystemConfiguration(subsystemConfigurationId);
- if (config!=null) {
- ISubSystem[] newSubSystems = config.getSubSystems(newConnection, true);
- if (newSubSystems != null && newSubSystems.length > 0) {
- newSubSystem = newSubSystems[0];
- subsystemConfigurationId = subsystem.getSubSystemConfiguration().getId();
- }
- }
- inputProvider.setSubSystem(newSubSystem);
- tree.reset(inputProvider);
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java
deleted file mode 100644
index 5f7ef3aff..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [240414] NPE in SystemHistoryCombo
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.dialogs;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ArmEvent;
-import org.eclipse.swt.events.ArmListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-
-
-
-/**
- * A dialog that allows the user to manipulate the history associated with
- * a widget.
- * <p>
- * The history strings are shown in a simple list, and the user can delete
- * items from the list or re-order items in the list.
- */
-public class SystemWorkWithHistoryDialog extends SystemPromptDialog implements Listener, ArmListener
-{
- private String[] historyInput;
- private String[] historyOutput;
- private String[] defaultHistory;
- //private Label verbiage;
- private List historyList;
- private Button rmvButton, clearButton, mupButton, mdnButton;
- private Group group;
- protected Menu popupMenu;
- protected MenuItem clearMI, rmvMI, mupMI, mdnMI;
-
-
- /**
- * Constructor for SystemWorkWithHistoryDialog
- */
- public SystemWorkWithHistoryDialog(Shell shell, String[] history)
- {
- super(shell, SystemResources.RESID_WORKWITHHISTORY_TITLE);
- historyInput = history;
-
- //pack();
- setHelp(RSEUIPlugin.HELPPREFIX+"dwwh0000"); //$NON-NLS-1$
- setInitialOKButtonEnabledState(false); //d41471
- }
-
- /**
- * Set the items to default the history to. These are sacred and can't be
- * deleted in this dialog.
- */
- public void setDefaultHistory(String[] items)
- {
- this.defaultHistory = items; // pc41439
- }
- /**
- * Return true if the given string is among the default history items
- */
- private boolean inDefaultHistory(String toTest) // pc41439
- {
- boolean inDefault = false;
- if (defaultHistory != null)
- for (int idx=0; !inDefault && (idx<defaultHistory.length); idx++)
- if (defaultHistory[idx].equals(toTest))
- inDefault = true;
- return inDefault;
- }
- /**
- * Return true any of the currently selected strings are among the default history items
- */
- private boolean selectedInDefaultHistory() /// pc41439
- {
- boolean inDefault = false;
- if (defaultHistory != null)
- {
- String[] currSelection = historyList.getSelection();
- if (currSelection != null)
- for (int idx=0; !inDefault && (idx<currSelection.length); idx++)
- inDefault = inDefaultHistory(currSelection[idx]);
- }
- return inDefault;
- }
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return historyList;
- }
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 2;
- Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // verbiage
- /*verbiage =*/ SystemWidgetHelpers.createLabel(composite,SystemResources.RESID_WORKWITHHISTORY_VERBIAGE, nbrColumns);
-
- // History list
- init(composite, nbrColumns);
-
- return composite;
- }
- /**
- * Create and initialize labeled group
- */
- protected Group init(Composite parent, int nbrColumns)
- {
- group = SystemWidgetHelpers.createGroupComposite(parent,nbrColumns,SystemResources.RESID_WORKWITHHISTORY_PROMPT);
- //((GridData)group.getLayoutData()).horizontalSpan =horizontalSpan;
- //((GridData)group.getLayoutData()).verticalSpan =verticalSpan;
- // CREATE THE LIST BOX
- historyList = SystemWidgetHelpers.createListBox(group,null,null,false);
- ((GridData)historyList.getLayoutData()).widthHint = 200;
- //((GridData)list.getLayoutData()).horizontalSpan = listboxspan;
- //((GridData)list.getLayoutData()).heightHint = SWT.DEFAULT;
- //((GridData)list.getLayoutData()).heightHint = buttonHeight * maxButtonsHigh;
- ((GridData)group.getLayoutData()).grabExcessVerticalSpace = true;
-
- popupMenu = new Menu(historyList);
-
- Composite rightHandSide = SystemWidgetHelpers.createComposite(group,1);
- clearButton = createPushButton(rightHandSide,SystemResources.ACTION_HISTORY_CLEAR_LABEL, SystemResources.ACTION_HISTORY_CLEAR_TOOLTIP);
- rmvButton = createPushButton(rightHandSide,SystemResources.ACTION_HISTORY_DELETE_LABEL, SystemResources.ACTION_HISTORY_DELETE_TOOLTIP);
- mupButton = createPushButton(rightHandSide,SystemResources.ACTION_HISTORY_MOVEUP_LABEL, SystemResources.ACTION_HISTORY_MOVEUP_TOOLTIP);
- mdnButton = createPushButton(rightHandSide,SystemResources.ACTION_HISTORY_MOVEDOWN_LABEL, SystemResources.ACTION_HISTORY_MOVEDOWN_LABEL);
-
- clearMI = createMenuItem(SystemResources.ACTION_HISTORY_CLEAR_LABEL, SystemResources.ACTION_HISTORY_CLEAR_TOOLTIP);
- rmvMI = createMenuItem(SystemResources.ACTION_HISTORY_DELETE_LABEL, SystemResources.ACTION_HISTORY_DELETE_TOOLTIP);
- mupMI = createMenuItem(SystemResources.ACTION_HISTORY_MOVEUP_LABEL, SystemResources.ACTION_HISTORY_MOVEUP_TOOLTIP);
- mdnMI = createMenuItem(SystemResources.ACTION_HISTORY_MOVEDOWN_LABEL, SystemResources.ACTION_HISTORY_MOVEDOWN_TOOLTIP);
-
- historyList.setMenu(popupMenu);
- if (historyInput != null)
- historyList.setItems(historyInput);
-
- clearButton.setEnabled((historyInput!=null) && (historyInput.length>0));
- rmvButton.setEnabled(false);
- mupButton.setEnabled(false);
- mdnButton.setEnabled(false);
- clearMI.setEnabled((historyInput!=null) && (historyInput.length>0));
- rmvMI.setEnabled(false);
- mupMI.setEnabled(false);
- mdnMI.setEnabled(false);
-
- // add selection listeners...
- historyList.addSelectionListener(
- new SelectionListener()
- {
- public void widgetDefaultSelected(SelectionEvent e)
- {
- //processRemoveButton(); // equate to selecting Remove...
- okButton.setEnabled(true); //d41471
- enableDisableAllActions();
- }
- public void widgetSelected(SelectionEvent e)
- {
- okButton.setEnabled(true); //d41471
- enableDisableAllActions();
- }
- }
- );
- return group;
- } // end init common
- /**
- * Helper method for a separator menu item
- */
- protected MenuItem addSeparator(Menu parent)
- {
- MenuItem mi = new MenuItem(parent,SWT.SEPARATOR);
- return mi;
- }
- /**
- * Helper method for creating cascading menu item
- */
- protected MenuItem createMenuItem(String label, String description)
- {
- MenuItem mi = new MenuItem(popupMenu,SWT.NULL);
- mi.setText(label);
- mi.setData(description);
- mi.addArmListener(this);
- mi.addListener(SWT.Selection, this);
- return mi;
- }
- /**
- * Helper method for creating a pushbutton with tooltip text.
- * This method takes resolved label and tooltip values
- */
- protected Button createPushButton(Composite c, String label, String tooltip)
- {
- Button button = SystemWidgetHelpers.createPushButton(c, this, label, tooltip);
- return button;
- }
- /**
- * Helper method to enable/disable all actions (buttons, menuitems)
- * based on current selections in list or current text contents.
- */
- private void enableDisableAllActions()
- {
- boolean itemSelected = (historyList.getSelectionCount() > 0);
- boolean defaultItemSelected = itemSelected && selectedInDefaultHistory();
- // Remove action
- rmvButton.setEnabled(itemSelected && !defaultItemSelected);
- rmvMI.setEnabled(itemSelected && !defaultItemSelected);
- // Move Up action
- mupButton.setEnabled(itemSelected && !historyList.isSelected(0));
- mupMI.setEnabled(mupButton.isEnabled());
- // Move Down action
- mdnButton.setEnabled(itemSelected && !historyList.isSelected((historyList.getItemCount())-1));
- mupMI.setEnabled(mdnButton.isEnabled());
-
- int emptyListCount = 0;
- if (defaultHistory != null)
- emptyListCount = defaultHistory.length;
- clearButton.setEnabled(historyList.getItemCount() > emptyListCount);
- }
-
- protected boolean processOK()
- {
- historyOutput = historyList.getItems();
- return true;
- }
-
- // --------------------------------- //
- // METHODS FOR INTERFACES...
- // --------------------------------- //
- /**
- * Handles events generated by controls on this page.
- */
- public void handleEvent(Event e)
- {
- //get widget that generates the event
- clearMessage();
- Widget source = e.widget;
- if ((source == clearButton) ||
- (source == clearMI))
- {
- historyList.removeAll();
- if (defaultHistory != null)
- historyList.setItems(defaultHistory); // pc41439
- okButton.setEnabled(true); //d41471
- enableDisableAllActions(); //d41421
- }
- else if ((source == rmvButton) ||
- (source == rmvMI))
- {
- int seld[] = historyList.getSelectionIndices();
- if (seld.length > 0)
- {
- historyList.remove(seld);
- enableDisableAllActions(); //d41421
- }
- }
- else if ((source == mupButton) ||
- (source == mupMI))
- {
- int oldIndex = historyList.getSelectionIndex();
- if (oldIndex > 0)
- {
- String seldObj = historyList.getSelection()[0];
- historyList.remove(oldIndex);
- historyList.add(seldObj,oldIndex-1);
- historyList.select(oldIndex-1);
- historyList.showSelection();
- enableDisableAllActions(); //d41421
- }
- }
- else if ((source == mdnButton) ||
- (source == mdnMI))
- {
- int oldIndex = historyList.getSelectionIndex();
- if ((oldIndex >= 0) && (oldIndex < (historyList.getItemCount()-1)))
- {
- String seldObj = historyList.getSelection()[0];
- historyList.remove(oldIndex);
- historyList.add(seldObj,oldIndex+1);
- //historyList.select(oldIndex+1);
- // historyList.showSelection();
- historyList.select(oldIndex+2); //d41427 To get around eclipse bug which does
- historyList.showSelection(); //d41427 not show the selected one as expected.
- historyList.select(oldIndex+1); //d41427 Need to advance one more to show it
- enableDisableAllActions(); //d41421
- }
- }
-
- }
- /**
- * Called by system when menu item is "armed" or in select state.
- * We use this to show the menu item description.
- */
- public void widgetArmed(ArmEvent e)
- {
- clearMessage();
- Widget w = e.widget;
- if (w instanceof MenuItem)
- {
- MenuItem mi = (MenuItem)w;
- String desc = (String)mi.getData();
- setMessage(desc);
- }
- }
-
- // -----------------------
- // CALLER QUERY METHODS...
- // -----------------------
-
- /**
- * Return the updated history
- */
- public String[] getHistory()
- {
- return historyOutput;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterPoolManagerUIProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterPoolManagerUIProvider.java
deleted file mode 100644
index 74e0deb4a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterPoolManagerUIProvider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-
-public interface SystemFilterPoolManagerUIProvider
-{
- public ISystemFilterPoolManager[] getFilterPoolManagers();
- public SystemSimpleContentElement getTreeModel();
- public SystemSimpleContentElement getTreeModelPreSelection(SystemSimpleContentElement root);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterWorkWithFilterPoolsTreeViewer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterWorkWithFilterPoolsTreeViewer.java
deleted file mode 100644
index d943cd29f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/SystemFilterWorkWithFilterPoolsTreeViewer.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWorkWithFilterPoolsDialog;
-import org.eclipse.rse.internal.ui.view.SystemView;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-
-
-/**
- * This subclass of the standard JFace tree viewer is used to
- * show a tree view of filter pools within filterpool managers,
- * for a work-with experience.
- */
-public class SystemFilterWorkWithFilterPoolsTreeViewer
- extends TreeViewer
- implements IMenuListener
-{
-
- private SystemFilterWorkWithFilterPoolsDialog caller;
- private Shell shell;
- private IAction[] contextMenuActions;
- private MenuManager menuMgr;
-
- /**
- * Constructor for SystemFilterWorkWithFilterPoolsTreeViewer
- */
- public SystemFilterWorkWithFilterPoolsTreeViewer(Shell shell, SystemFilterWorkWithFilterPoolsDialog caller, Composite arg0)
- {
- super(arg0, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); // DKM - putting style here to avoid SWT.BORDER (defect 168972)
-
- init(shell, caller);
- }
-
- /**
- * Constructor for SystemFilterWorkWithFilterPoolsTreeViewer
- */
- public SystemFilterWorkWithFilterPoolsTreeViewer(Shell shell, SystemFilterWorkWithFilterPoolsDialog caller, Composite arg0, int arg1)
- {
- super(arg0, arg1);
- init(shell, caller);
- }
-
- /**
- * Constructor for SystemFilterWorkWithFilterPoolsTreeViewer
- */
- public SystemFilterWorkWithFilterPoolsTreeViewer(Shell shell,
- SystemFilterWorkWithFilterPoolsDialog caller,
- Tree tree)
- {
- super(tree);
- init(shell, caller);
- }
-
- /**
- * Initialize
- */
- public void init(Shell shell, SystemFilterWorkWithFilterPoolsDialog caller)
- {
- this.caller = caller;
- this.shell = shell;
- // -----------------------------
- // Enable right-click popup menu
- // -----------------------------
- menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(this);
- Menu menu = menuMgr.createContextMenu(getTree());
- getTree().setMenu(menu);
- }
-
- /**
- * Set the context menu actions to show in the popup
- */
- public void setContextMenuActions(IAction[] actions)
- {
- this.contextMenuActions = actions;
- }
-
- /**
- * Override of refresh from parent
- */
- public void refresh()
- {
- if (!caller.refreshTree())
- super.refresh();
- //super.refresh();
- }
-
- /**
- * Called when the context menu is about to open.
- */
- public void menuAboutToShow(IMenuManager menu)
- {
- ISystemAction ourAction = null;
- if (contextMenuActions != null)
- {
- //SystemMenuManager ourMenu = createStandardGroups(menu);
- SystemView.createStandardGroups(menu);
- SystemMenuManager ourMenu = new SystemMenuManager(menu);
- for (int idx=0; idx<contextMenuActions.length; idx++)
- {
- if (contextMenuActions[idx] instanceof ISystemAction)
- {
- ourAction = (ISystemAction)contextMenuActions[idx];
- ourMenu.add(ISystemContextMenuConstants.GROUP_REORGANIZE, ourAction);
-
- if (ourAction instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager)ourAction;
- item.setShell(shell);
- item.setSelection(getSelection());
- }
- }
- else
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, ourAction);
- }
- }
- }
-
- /*
- * Creates the Systems plugin standard groups in a context menu.
- *
- public SystemMenuManager createStandardGroups(IMenuManager menu)
- {
- if (menu.isEmpty())
- {
- // simply sets partitions in the menu, into which actions can be directed.
- // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW)); // new->
- //menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO)); // goto into, go->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPANDTO)); // expand TO->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH)); // open with->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN)); // open xxx
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_SHOW)); // show->type hierarchy, in-navigator
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD)); // build, rebuild, refresh
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE)); // update, change
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); // rename,move,copy,delete,bookmark,refactoring
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); // move up, move down
- //menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE)); // getters/setters, etc. Typically in editor
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH)); // search
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION)); // user or BP/ISV additions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_STARTSERVER)); // start/stop remote server actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT)); // get or put actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS)); // actions queried from adapters
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_VIEWER_SETUP)); // ? Probably View->by xxx, yyy
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES)); // Properties
- }
- return new SystemMenuManager(menu);
- }*/
-
- /**
- * Private helper method to add an Action to a given menu.
- * To give the action the opportunity to grey out, we call selectionChanged, but
- * only if the action implements ISelectionChangedListener
- */
- protected void menuAdd(MenuManager menu, IAction action)
- {
- if (action instanceof ISelectionChangedListener)
- ((ISelectionChangedListener)action).selectionChanged(new SelectionChangedEvent(this,getSelection()));
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java
deleted file mode 100644
index 104db8500..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizard.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters.dialogs;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.validators.ValidatorFolderName;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
-
-
-/**
- * Wizard for creating a new system filter pool.
- */
-public class SystemFilterNewFilterPoolWizard
- extends AbstractSystemWizard
- implements SystemFilterPoolWizardInterface
-{
- protected SystemFilterNewFilterPoolWizardMainPageInterface mainPage;
- protected ValidatorFolderName usv;
- protected SystemFilterPoolDialogOutputs output;
- protected SystemFilterAbstractFilterPoolAction caller;
- protected ISystemFilterPoolManager[] mgrs;
-
- /**
- * Constructor that uses a default title and image
- */
- public SystemFilterNewFilterPoolWizard()
- {
- this(SystemResources.RESID_NEWFILTERPOOL_TITLE,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLWIZARD_ID));
- }
- /**
- * Constructor
- * @param label The title for this wizard
- * @param image The image for this wizard
- */
- public SystemFilterNewFilterPoolWizard(String title, ImageDescriptor image)
- {
- super(title, image);
- }
-
- /**
- * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
- * plugin ID.
- */
- public void setHelpContextId(String id)
- {
- super.setHelp(id);
- }
-
- /**
- * Creates the wizard pages.
- * This method is an override from the parent Wizard class.
- */
- public void addPages()
- {
- try {
- mainPage = createMainPage();
- addPage((WizardPage)mainPage);
- //super.addPages();
- } catch (Exception exc)
- {
- System.out.println("Unexpected error in addPages of NewFilterPoolWizard: "+exc.getMessage() + ", " + exc.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
-
- /**
- * Creates the wizard's main page.
- */
- protected SystemFilterNewFilterPoolWizardMainPageInterface createMainPage()
- {
- mainPage = new SystemFilterNewFilterPoolWizardDefaultMainPage(this,
- caller.getDialogTitle(), caller.getDialogPrompt());
- mgrs = caller.getFilterPoolManagers();
- if (mgrs != null)
- {
- mainPage.setFilterPoolManagers(mgrs);
- mainPage.setFilterPoolManagerNameSelectionIndex(caller.getFilterPoolManagerNameSelectionIndex());
- }
- return mainPage;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- if (mainPage.performFinish())
- {
- output = mainPage.getFilterPoolDialogOutputs();
- String mgrName = output.filterPoolManagerName;
- ISystemFilterPoolManager mgr = null;
- try
- {
- if (mgrName != null)
- {
- for (int idx=0; (mgr==null)&&(idx<mgrs.length); idx++)
- if (mgrs[idx].getName().equalsIgnoreCase(mgrName))
- mgr = mgrs[idx];
- }
- if (mgr == null)
- {
- System.out.println("Unexpected problem in performFinish of filter pool wizard: no match for selected profile name " + mgrName); //$NON-NLS-1$
- return false;
- }
- String poolName = mainPage.getPoolName();
- output.newPool = createFilterPool(mgr, poolName);
- }
- catch (Exception exc)
- {
- //RSEUIPlugin.logError("Error in performFinish of filter pool wizard!", exc);
- //System.out.println("Error in performFinish of filter pool wizard!");
- //exc.printStackTrace();
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_OCCURRED);
- msg.makeSubstitution(exc);
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), msg);
- msgDlg.openWithDetails();
- return false;
- }
- return (output.newPool != null);
- }
- return false;
- }
-
-
- /**
- * Process the create new filter pool request, after user presses OK on the dialog.
- * By default, asks the selected manager to create the new pool of the given name.
- */
- protected ISystemFilterPool createFilterPool(ISystemFilterPoolManager selectedManager, String poolName)
- throws Exception
- {
- ISystemFilterPool newFilterPool = null;
- if (selectedManager != null)
- //try {
- newFilterPool = selectedManager.createSystemFilterPool(poolName, true);
- //} catch (Exception exc)
- //{
- //System.out.println("Unexpected error in createFilterPool of NewFilterPoolWizard: "+exc.getMessage() + ", " + exc.getClass().getName());
- //}
- return newFilterPool;
- }
-
- /**
- * Return an object containing user-specified information pertinent to filter pool actions
- */
- public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs()
- {
- return output;
- }
-
- /**
- * Allow base action to pass instance of itself for callback to get info
- */
- public void setFilterPoolDialogActionCaller(SystemFilterAbstractFilterPoolAction caller)
- {
- this.caller = caller;
- }
-
- /**
- * Allow wizard pages to get this.
- */
- public SystemFilterAbstractFilterPoolAction getFilterPoolDialogActionCaller()
- {
- return caller;
- }
-
-} // end class
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java
deleted file mode 100644
index bcabb50f5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardDefaultMainPage.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters.dialogs;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Default main page of the "New Filter Pool" wizard.
- * This page asks for the name of the connection pool.
- * Also allows user to select from a list of filter pool managers
- * to put the filter pool into.
- */
-
-public class SystemFilterNewFilterPoolWizardDefaultMainPage
- extends AbstractSystemWizardPage
- implements SystemFilterNewFilterPoolWizardMainPageInterface, Listener, SelectionListener
-{
- protected Label labelName, labelMgr;
- protected Text textName;
- protected Combo mgrCombo;
- protected int mgrSelection = 0;
- protected String[] mgrNames = null;
- protected ISystemValidator[] validatorsByManager = null;
- protected SystemFilterAbstractFilterPoolAction parentWizardAction = null;
-
- /**
- * Constructor.
- */
- public SystemFilterNewFilterPoolWizardDefaultMainPage(Wizard wizard,
- String title,
- String description)
- {
- super(wizard, "NewFilterPool", title, description); //$NON-NLS-1$
- this.parentWizardAction = ((SystemFilterNewFilterPoolWizard)wizard).getFilterPoolDialogActionCaller();
- }
-
- /**
- * Call this to specify a validator for the pool name. It will be called per keystroke.
- * Only call this if you do not call setFilterPoolManagers!
- */
- public void setNameValidator(ISystemValidator v)
- {
- validatorsByManager = new ISystemValidator[1];
- validatorsByManager[0] = v;
- }
- /**
- * Even if you call setFilterPoolManagers and you really want your own validators,
- * then call this. Otherwise, FolderNameValidator will be called for you.
- * The input must be an array of validators that is the same length as the array
- * of filter pool managers. Call this AFTER setFilterPoolManagers!
- */
- public void setNameValidators(ISystemValidator[] v)
- {
- validatorsByManager = v;
- }
-
- /**
- * Call this to specify the list of filter pool managers to allow the user to select from.
- * Either call this or override getFilterPoolManagerNames, or leave null and this prompt will
- * not show.
- */
- public void setFilterPoolManagers(ISystemFilterPoolManager[] mgrs) {
- mgrNames = new String[mgrs.length];
- validatorsByManager = new ISystemValidator[mgrNames.length];
- for (int idx = 0; idx < mgrs.length; idx++) {
- ISystemFilterPoolManager manager = mgrs[idx];
- mgrNames[idx] = manager.getName();
- ISystemValidator iiv = new ValidatorFilterPoolName(manager.getSystemFilterPoolNames());
- validatorsByManager[idx] = iiv;
- }
- }
- /**
- * Returns array of manager names to show in combo box.
- */
- protected String[] getFilterPoolManagerNames()
- {
- return mgrNames;
- }
- /**
- * Set the zero-based index of the manager name to preselect.
- * The default is zero.
- * Either call this or override getFilterPoolManagerNameSelectionIndex.
- */
- public void setFilterPoolManagerNameSelectionIndex(int index)
- {
- this.mgrSelection = index;
- //System.out.println("inside setFilterPoolManagerNameSelectionIndex in main page: " + index);
- }
- /**
- * Returns the zero-based index of the manager name to preselect.
- * Returns what was set in setFilterPoolManagerNameSelectionIndex by default.
- */
- protected int getFilterPoolManagerNameSelectionIndex()
- {
- return mgrSelection;
- }
-
- /**
- * Retrieve the pool name entry field prompt text.
- * By default, uses what we set in setPoolNamePromptText,
- * or uses a supplied default if that is null.
- */
- protected String getPoolNamePromptText()
- {
- String namePromptText = parentWizardAction.getDialogFilterPoolNamePrompt();
- return (namePromptText==null) ? SystemResources.RESID_FILTERPOOLNAME_LABEL : namePromptText;
- }
- /**
- * Retrieve the pool name entry field tooltip text.
- * By default, uses what we set in setPoolNameToolTip,
- * or uses a supplied default if that is null.
- */
- protected String getPoolNameToolTip()
- {
- String nameTip = parentWizardAction.getDialogFilterPoolNameTip();
- return (nameTip==null) ? SystemResources.RESID_FILTERPOOLNAME_TIP : nameTip;
- }
- /**
- * Retrieve the pool manager combo prompt text.
- * By default, uses what we set in setPoolManagerPromptText,
- * or uses a supplied default if that is null.
- */
- protected String getPoolManagerPromptText()
- {
- String mgrPromptText = parentWizardAction.getDialogFilterPoolManagerNamePrompt();
- return (mgrPromptText == null) ? SystemResources.RESID_FILTERPOOLMANAGERNAME_LABEL : mgrPromptText;
- }
- /**
- * Retrieve the pool manager combo field tooltip text.
- * By default, uses what we set in setPoolManagerToolTip,
- * or uses a supplied default if that is null.
- */
- protected String getPoolManagerToolTip()
- {
- String mgrTip = parentWizardAction.getDialogFilterPoolManagerNameTip();
- return (mgrTip == null) ? SystemResources.RESID_FILTERPOOLMANAGERNAME_TIP : mgrTip;
- }
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- * @param parent The parent composite
- */
- public Control createContents(Composite parent)
- {
- // top level composite
- Composite composite = new Composite(parent,SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(
- composite, 2);
-
- // POOLNAME PROMPT
- labelName = SystemWidgetHelpers.createLabel(composite_prompts, getPoolNamePromptText());
- textName = SystemWidgetHelpers.createTextField(
- composite_prompts,this);
- String tip = getPoolNameToolTip();
- if (tip != null)
- textName.setToolTipText(tip);
-
- // POOL MANAGER PROMPT
- String[] mgrs = getFilterPoolManagerNames();
- if (mgrs != null)
- {
- labelMgr = SystemWidgetHelpers.createLabel(composite_prompts, getPoolManagerPromptText());
- mgrCombo = SystemWidgetHelpers.createReadonlyCombo(composite_prompts,this);
- tip = getPoolManagerToolTip();
- if (tip != null)
- mgrCombo.setToolTipText(tip);
- mgrCombo.setItems(mgrs);
- //System.out.println("inside createContents in main page. Selecting " + mgrSelection);
- mgrCombo.select(mgrSelection);
- setPoolNameTextLimit(mgrSelection);
- }
-
- textName.setFocus();
-
- // add keystroke listeners...
- textName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateNameInput();
- }
- }
- );
- if (mgrCombo != null)
- mgrCombo.addSelectionListener(this);
-
- setPageComplete(false);
- return composite;
- }
-
- /**
- * Return control to recieve initial focus
- */
- public Control getInitialFocusControl()
- {
- return textName;
- }
-
- // --------------------------------- //
- // METHODS FOR LISTENER INTERFACE...
- // --------------------------------- //
- /**
- * Combo selection listener method
- */
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
- /**
- * Combo selection listener method
- */
- public void widgetSelected(SelectionEvent event)
- {
- Object src = event.getSource();
- if (src == mgrCombo)
- {
- setPoolNameTextLimit(mgrCombo.getSelectionIndex());
- }
- }
- /**
- * Handles events generated by controls on this page.
- */
- public void handleEvent(Event e)
- {
- }
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- SystemMessage errMsg = null;
- Control controlInError = null;
- clearErrorMessage();
- errMsg = validateNameInput();
- if (errMsg != null)
- controlInError = textName;
- if (errMsg != null && controlInError != null)
- controlInError.setFocus();
- return (errMsg == null);
- }
-
- // ---------------------------------------------
- // METHODS FOR VERIFYING INPUT PER KEYSTROKE ...
- // ---------------------------------------------
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setNameValidator(ISystemValidator)
- */
- protected SystemMessage validateNameInput()
- {
- int mgrIndex = 0;
- if (mgrCombo != null)
- mgrIndex = mgrCombo.getSelectionIndex();
- if (mgrIndex < 0)
- mgrIndex = 0;
- ISystemValidator iiv = validatorsByManager[mgrIndex];
- SystemMessage errorMessage= null;
- if (iiv != null)
- errorMessage= iiv.validate(textName.getText());
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- else
- clearErrorMessage();
- setPageComplete(errorMessage == null);
- return errorMessage;
- }
-
- /**
- * Set the name length for the filter pool based on the
- * currently selected manager
- */
- protected void setPoolNameTextLimit(int mgrIndex)
- {
- if (mgrIndex < 0)
- return;
- ISystemValidator iiv = validatorsByManager[mgrIndex];
- if (iiv != null)
- {
- int limit = -1;
-
- limit = iiv.getMaximumNameLength();
- if (limit == -1)
- limit = ValidatorFilterPoolName.MAX_FILTERPOOLNAME_LENGTH; // default is 50
- textName.setTextLimit(limit);
- }
- }
-
- // --------------------------------- //
- // METHODS FOR EXTRACTING USER DATA ...
- // --------------------------------- //
- /**
- * Return user-entered pool name.
- * Call this after finish ends successfully.
- */
- public String getPoolName()
- {
- return textName.getText().trim();
- }
- /**
- * Return user-selected pool manager name.
- * Call this after finish ends successfully.
- */
- public String getPoolManagerName()
- {
- if (mgrCombo!=null)
- return mgrCombo.getText();
- else
- return null;
- }
-
- /**
- * Return an object containing user-specified information pertinent to filter pool actions
- */
- public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs()
- {
- SystemFilterPoolDialogOutputs output = new SystemFilterPoolDialogOutputs();
- output.filterPoolName = getPoolName();
- output.filterPoolManagerName = getPoolManagerName();
- return output;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java
deleted file mode 100644
index ba5b0007c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterNewFilterPoolWizardMainPageInterface.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters.dialogs;
-
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.wizards.ISystemWizardPage;
-
-
-
-/**
- * Interface for new Filter wizard main page classes
- */
-public interface SystemFilterNewFilterPoolWizardMainPageInterface extends ISystemWizardPage
-{
- /**
- * Call this to specify a validator for the pool name. It will be called per keystroke.
- * Only call this if you do not call setFilterPoolManagers!
- */
- public void setNameValidator(ISystemValidator v);
- /**
- * Even if you call setFilterPoolManagers and you really want your own validators,
- * then call this. Otherwise, FolderNameValidator will be called for you.
- * The input must be an array of validators that is the same length as the array
- * of filter pool managers. Call this AFTER setFilterPoolManagers!
- */
- public void setNameValidators(ISystemValidator[] v);
- /**
- * Call this to specify the list of filter pool managers to allow the user to select from.
- * Either call this or override getFilterPoolManagerNames, or leave null and this prompt will
- * not show.
- */
- public void setFilterPoolManagers(ISystemFilterPoolManager[] mgrs);
- /**
- * Set the zero-based index of the manager name to preselect.
- * The default is zero.
- * Either call this or override getFilterPoolManagerNameSelectionIndex.
- */
- public void setFilterPoolManagerNameSelectionIndex(int index);
-
- /**
- * Return user-entered pool name.
- * Call this after finish ends successfully.
- */
- public String getPoolName();
- /**
- * Return user-selected pool manager name.
- * Call this after finish ends successfully.
- */
- public String getPoolManagerName();
- /**
- * Return an object containing user-specified information pertinent to filter pool actions
- */
- public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterPoolWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterPoolWizardDialog.java
deleted file mode 100644
index c974271c8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterPoolWizardDialog.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters.dialogs;
-import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Extends WizardDialog to support ability to pass data in from the
- * common wizard action class, and get data out.
- * This is deferred to the actual wizard, which in turn defers to the wizard's first page.
- */
-public class SystemFilterPoolWizardDialog
- extends SystemWizardDialog
- implements SystemFilterPoolDialogInterface
-{
- // all ctors are from parent...
- /**
- * Constructor
- */
- public SystemFilterPoolWizardDialog(Shell shell, SystemFilterPoolWizardInterface wizard)
- {
- super(shell, wizard);
- }
- /**
- * Constructor two. Use when you have an input object at instantiation time.
- */
- public SystemFilterPoolWizardDialog(Shell shell, SystemFilterPoolWizardInterface wizard, Object inputObject)
- {
- super(shell,wizard,inputObject);
- }
-
- /**
- * Return wrapped filter pool wizard
- */
- public SystemFilterPoolWizardInterface getFilterPoolWizard()
- {
- return (SystemFilterPoolWizardInterface)getWizard();
- }
-
- /**
- * Return an object containing user-specified information pertinent to filter pool actions
- */
- public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs()
- {
- return getFilterPoolWizard().getFilterPoolDialogOutputs();
- }
-
- /**
- * Allow base action to pass instance of itself for callback to get info
- */
- public void setFilterPoolDialogActionCaller(SystemFilterAbstractFilterPoolAction caller)
- {
- getFilterPoolWizard().setFilterPoolDialogActionCaller(caller);
- }
-
- /**
- * Set the help context id for this wizard
- */
- public void setHelpContextId(String id)
- {
- super.setHelp(id);
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWizardDialog.java
deleted file mode 100644
index d575bda88..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWizardDialog.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters.dialogs;
-import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterAction;
-import org.eclipse.rse.ui.filters.dialogs.ISystemFilterWizard;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogInterface;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogOutputs;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Extends WizardDialog to support ability to pass data in from the
- * common wizard action class, and get data out.
- * This is deferred to the actual wizard, which in turn defers to the wizard's first page.
- */
-public class SystemFilterWizardDialog
- extends SystemWizardDialog
- implements SystemFilterDialogInterface
-{
-
- // all ctors are from parent...
- /**
- * Constructor
- */
- public SystemFilterWizardDialog(Shell shell, ISystemFilterWizard wizard)
- {
- super(shell, wizard);
- }
- /**
- * Constructor two. Use when you have an input object at instantiation time.
- */
- public SystemFilterWizardDialog(Shell shell, ISystemFilterWizard wizard, Object inputObject)
- {
- super(shell,wizard,inputObject);
- }
-
- /**
- * Return wrapped filter wizard
- */
- public ISystemFilterWizard getFilterWizard()
- {
- return (ISystemFilterWizard)getWizard();
- }
-
- /**
- * Return an object containing user-specified information pertinent to filter actions
- */
- public SystemFilterDialogOutputs getFilterDialogOutputs()
- {
- return getFilterWizard().getFilterDialogOutputs();
- }
-
- /**
- * Allow base action to pass instance of itself for callback to get info
- */
- public void setFilterDialogActionCaller(SystemFilterAbstractFilterAction caller)
- {
- getFilterWizard().setFilterDialogActionCaller(caller);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java
deleted file mode 100644
index a07205344..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemFilterWorkWithFilterPoolsDialog.java
+++ /dev/null
@@ -1,662 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [197036] fixed delete filter pool bug found during testing of this bug
- * see also bug 194260 regarding deleting filter pools
- * David Dykstal (IBM) - [194268] fixed initial selection and new action selection
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters.dialogs;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterCopyFilterPoolAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterMoveFilterPoolAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterNewFilterPoolAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterWorkWithFilterPoolsRefreshAllAction;
-import org.eclipse.rse.internal.ui.filters.SystemFilterPoolManagerUIProvider;
-import org.eclipse.rse.internal.ui.filters.SystemFilterWorkWithFilterPoolsTreeViewer;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemDeleteTarget;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemRenameTarget;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogOutputs;
-import org.eclipse.rse.ui.filters.SystemFilterUIHelpers;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * Dialog for working with filter pools.
- */
-public class SystemFilterWorkWithFilterPoolsDialog
- extends SystemPromptDialog
- implements
- ISelectionChangedListener,
- ISystemDeleteTarget, ISystemRenameTarget,
- SystemFilterPoolDialogInterface
- //,ISystemResourceChangeListener
-{
- class DeleteFilterPoolAction extends SystemCommonDeleteAction {
- public DeleteFilterPoolAction(Shell parent, ISystemDeleteTarget deleteTarget) {
- super(parent, deleteTarget);
- }
- protected Object getDialogValue(Dialog dlg) {
- doDelete(null);
- return null;
- }
- }
-
- private String promptString;
- //private Label prompt;
- private SystemFilterWorkWithFilterPoolsTreeViewer tree;
- private ToolBar toolbar = null;
- private ToolBarManager toolbarMgr = null;
- private SystemSimpleContentProvider provider = new SystemSimpleContentProvider();
- private SystemSimpleContentElement filterPoolContent;
- private SystemSimpleContentElement preSelectedRoot = null;
- private ISystemFilterPoolManager[] filterPoolManagers;
- private SystemFilterPoolManagerUIProvider caller = null;
- private boolean initializing = false;
-
- //private ActionContributionItem newActionItem, deleteActionItem, renameActionItem;
- private SystemFilterWorkWithFilterPoolsRefreshAllAction refreshAction = null;
- private SystemFilterNewFilterPoolAction newAction = null;
- private DeleteFilterPoolAction dltAction = null;
- //private SystemCommonDeleteAction dltAction = null;
- //private SystemSimpleRenameAction rnmAction = null;
- private SystemCommonRenameAction rnmAction = null;
- private SystemFilterCopyFilterPoolAction cpyAction = null;
- private SystemFilterMoveFilterPoolAction movAction = null;
- private IAction[] contextMenuActions = null;
-
-
- /**
- * Constructor
- */
- public SystemFilterWorkWithFilterPoolsDialog(Shell shell, String title, String prompt,
- SystemFilterPoolManagerUIProvider caller)
- //SystemFilterPoolManager[] filterPoolManagers,
- //SystemSimpleContentElement filterPoolContent)
- {
- super(shell, title);
- this.caller = caller;
- promptString = prompt;
- this.filterPoolContent = caller.getTreeModel();
- this.filterPoolManagers = caller.getFilterPoolManagers();
- this.preSelectedRoot = caller.getTreeModelPreSelection(filterPoolContent);
- setCancelButtonLabel(SystemResources.BUTTON_CLOSE);
- setShowOkButton(false);
- //pack();
- }
-
- /**
- * Set the root to preselect
- */
- public void setRootToPreselect(SystemSimpleContentElement preSelectedRoot)
- {
- this.preSelectedRoot = preSelectedRoot;
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- /*ISystemMessageLine msgLine =*/ super.createMessageLine(c);
- return fMessageLine;
- }
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return tree.getControl();
- }
-
- /**
- * Set the pool name validator for the rename action.
- * The work-with dialog automatically calls setExistingNamesList on it for each selection.
- */
- public void setFilterPoolNameValidator(ValidatorFilterPoolName pnv)
- {
- }
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- //System.out.println("INSIDE CREATEINNER");
- /*
- // top level composite
- Composite composite = new Composite(parent,SWT.NONE);
- composite.setLayout(new GridLayout());
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- composite.setLayoutData(data);
- */
-
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 1);
-
- // PROMPT
- /*prompt =*/ SystemWidgetHelpers.createLabel(composite_prompts, promptString);
-
- // TOOLBAR
- createToolBar(composite_prompts);
-
- // WORK-WITH TREE
- initializing = true;
- tree = new SystemFilterWorkWithFilterPoolsTreeViewer(getShell(), this, new Tree(composite_prompts, SWT.SINGLE | SWT.BORDER));
- GridData treeData = new GridData();
- treeData.horizontalAlignment = GridData.FILL;
- treeData.grabExcessHorizontalSpace = true;
- treeData.widthHint = 300;
- treeData.heightHint= 300;
- treeData.verticalAlignment = GridData.CENTER;
- treeData.grabExcessVerticalSpace = true;
- tree.getTree().setLayoutData(treeData);
-
- tree.setContentProvider(provider);
- tree.setLabelProvider(provider);
-
- // populate tree
- if (filterPoolContent != null)
- {
- filterPoolContent.setData(tree); // so actions can refresh our tree
- tree.setInput(filterPoolContent);
- }
-
- if (preSelectedRoot != null)
- tree.setSelection(new StructuredSelection(preSelectedRoot), true);
-
- // expand and pre-check
- tree.expandAll();
- tree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
-
- // add selection listener to tree
- tree.addSelectionChangedListener(this);
-
- // populate toolbar
- populateToolBar(getShell(), tree);
-
- initializing = false;
-
- return composite_prompts;
- }
-
- /**
- * Callback from tree when refresh is done
- */
- public boolean refreshTree()
- {
- if (initializing)
- return false;
- this.filterPoolContent = caller.getTreeModel();
- this.filterPoolManagers = caller.getFilterPoolManagers();
- this.preSelectedRoot = caller.getTreeModelPreSelection(filterPoolContent);
- filterPoolContent.setData(tree); // so actions can refresh our tree
- tree.setInput(filterPoolContent); // hmm, hope we don't go into a loop!
- //System.out.println("in refreshTree");
- return true;
- }
-
- /**
- * Create the toolbar displayed at the top of the dialog
- */
- protected void createToolBar(Composite parent)
- {
- toolbar = new ToolBar(parent, SWT.FLAT | SWT.WRAP);
- toolbarMgr = new ToolBarManager(toolbar);
- }
- /**
- * Populate the toolbar displayed at the top of the dialog
- */
- protected void populateToolBar(Shell shell, SystemFilterWorkWithFilterPoolsTreeViewer tree)
- {
- newAction = new SystemFilterNewFilterPoolAction(shell,this);
- //dltAction = new SystemSimpleDeleteAction(shell,this);
- dltAction = new DeleteFilterPoolAction(shell,this);
- rnmAction = new SystemCommonRenameAction(shell,this);
- // undo typical settings...
- rnmAction.allowOnMultipleSelection(false);
- rnmAction.setProcessAllSelections(false);
- //rnmAction = new SystemSimpleRenameAction(shell,this);
- //poolNameValidator = new ValidatorFilterPoolName((Vector)null);
- //rnmAction.setNameValidator(poolNameValidator);
- cpyAction = new SystemFilterCopyFilterPoolAction(shell);
- cpyAction.setSelectionProvider(this);
- movAction = new SystemFilterMoveFilterPoolAction(shell);
- movAction.setSelectionProvider(this);
- refreshAction = new SystemFilterWorkWithFilterPoolsRefreshAllAction(tree, shell);
-
- contextMenuActions = new IAction[6];
- contextMenuActions[0] = newAction;
- contextMenuActions[1] = rnmAction;
- contextMenuActions[2] = cpyAction;
- contextMenuActions[3] = movAction;
- contextMenuActions[4] = dltAction;
- contextMenuActions[5] = refreshAction;
-
- for (int idx=0; idx<contextMenuActions.length; idx++)
- {
- ((ISystemAction)contextMenuActions[idx]).setSelection(tree.getSelection());
- ((ISystemAction)contextMenuActions[idx]).setViewer(tree);
- }
-
- // populate toolbar...
- toolbarMgr.add(refreshAction);
- toolbarMgr.add(newAction);
- toolbarMgr.add(dltAction);
- toolbarMgr.add(rnmAction);
- toolbarMgr.add(cpyAction);
- toolbarMgr.add(movAction);
- toolbarMgr.update(false);
-
- // populate tree..
- tree.setContextMenuActions(contextMenuActions);
-
- }
-
- /**
- * ISelectionChangedListener method. Called when user changes selection in tree
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- //IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- //SystemSimpleContentElement element = (SystemSimpleContentElement)sel.getFirstElement();
- if (rnmAction != null)
- rnmAction.selectionChanged(event);
- }
-
- /**
- * Return current selection
- */
- public SystemSimpleContentElement getSelectedElement()
- {
- IStructuredSelection sel = (IStructuredSelection)tree.getSelection();
- return (SystemSimpleContentElement)sel.getFirstElement();
- }
- /**
- * Return true if something selected
- */
- public boolean isSelectionEmpty()
- {
- IStructuredSelection sel = (IStructuredSelection)tree.getSelection();
- return sel.isEmpty();
- }
- public void clearSelection()
- {
- tree.setSelection((ISelection)null);
- }
-
-
- /**
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- boolean closeDialog = verify();
- if (closeDialog)
- {
- setOutputObject(getInputObject());
- }
- return closeDialog;
- }
-
- public boolean close()
- {
- //RSECorePlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
- return super.close();
- }
- /**
- * Verifies all input.
- * @return true if there are no errors in the user input
- */
- public boolean verify()
- {
-
- clearErrorMessage();
-/*
- if (errMsg != null)
- controlInError.setFocus();
- return (errMsg == null);
- */
- return true;
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = true;
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
-
- // ------------------------------
- // ISYSTEMDELETETARGET METHODS...
- // ------------------------------
-
- /**
- * Return true if delete should even be shown in the popup menu
- */
- public boolean showDelete()
- {
- return true;
- }
- /**
- * Return true if delete should be enabled based on your current selection.
- */
- public boolean canDelete()
- {
- SystemSimpleContentElement element = getSelectedElement();
- if (element != null) {
- Object elementData = element.getData();
- //System.out.println("In SFWWFPsDlg.canDelete: element data class = " + elementData.getClass().getName());
- if (elementData instanceof ISystemFilterPool) {
- ISystemFilterPool pool = (ISystemFilterPool)elementData;
- return (pool.isDeletable() && element.isDeletable());
- }
- }
- return false;
- }
-
- /**
- * Actually do the delete of currently selected items.
- */
- public boolean doDelete(IProgressMonitor monitor)
- {
- boolean ok = false;
- SystemSimpleContentElement element = getSelectedElement();
- Object elementData = element.getData();
- if ((elementData == null) || !(elementData instanceof ISystemFilterPool))
- return ok;
- ISystemFilterPool pool = (ISystemFilterPool)elementData;
- ISystemFilterPoolManager mgr = pool.getSystemFilterPoolManager();
- try
- {
- mgr.deleteSystemFilterPool(pool);
- ok = true;
- SystemSimpleContentElement parent = element.getParent();
- clearSelection();
- tree.setSelection(new StructuredSelection(parent),true);
- parent.deleteChild(element);
- tree.refresh(parent);
- } catch (Exception exc)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(pool.getName(),exc));
- msgDlg.open();
- //RSEUIPlugin.logError("Error deleting filter pool in workwith dialog",exc);
- }
- return ok;
- }
-
- // ------------------------------
- // ISYSTEMRENAMETARGET METHODS...
- // ------------------------------
-
- /**
- * Return true if rename should even be shown in the popup menu
- */
- public boolean showRename()
- {
- return true;
- }
- /**
- * Return true if rename should be enabled based on your current selection.
- */
- public boolean canRename()
- {
- boolean canRename = false;
- SystemSimpleContentElement element = getSelectedElement();
- if (element != null) {
- Object elementData = element.getData();
- //System.out.println("In SFWWFPsDlg.canRename: element data class = " + elementData.getClass().getName());
- if (elementData instanceof ISystemFilterPool) {
- ISystemFilterPool pool = (ISystemFilterPool)elementData;
- canRename = (!pool.isNonRenamable() && element.isRenamable());
- //if (canRename) {
- // poolNameValidator.setExistingNamesList(pool.getSystemFilterPoolManager().getSystemFilterPoolNamesVector());
- //}
- }
- }
- return canRename;
- }
-
- /**
- * Actually do the rename of currently selected items.
- * The array of new names matches the currently selected items.
- */
- public boolean doRename(String[] newNames)
- {
- boolean ok = false;
- SystemSimpleContentElement element = getSelectedElement();
- Object elementData = element.getData();
- if ((elementData == null) || !(elementData instanceof ISystemFilterPool))
- return ok;
- ISystemFilterPool pool = (ISystemFilterPool)elementData;
- ISystemFilterPoolManager mgr = pool.getSystemFilterPoolManager();
- try
- {
- mgr.renameSystemFilterPool(pool, newNames[0]);
- ok = true;
- element.setName(newNames[0]);
- String properties[] = {IBasicPropertyConstants.P_TEXT};
- tree.update(element, properties); // for refreshing non-structural properties in viewer when model changes
- }
- catch (SystemMessageException exc)
- {
- SystemMessageDialog.displayMessage(getShell(), exc);
- }
- catch (Exception exc)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_RENAMING).makeSubstitution(pool.getName(),exc));
- msgDlg.open();
- //RSEUIPlugin.logError("Error renaming filter pool in workwith dialog",exc);
- }
- return ok;
- }
-
- // -----------------------------
- // ISELECTIONPROVIDER METHODS...
- // -----------------------------
- /**
- *
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- tree.addSelectionChangedListener(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- tree.removeSelectionChangedListener(listener);
- }
-
- public void setSelection(ISelection selection)
- {
- tree.setSelection(selection);
- }
-
- public ISelection getSelection()
- {
- return tree.getSelection();
- }
-
-
- /**
- * Callback from new action when new pool created
- */
- public void addNewFilterPool(Shell shell, ISystemFilterPool pool)
- {
- String newPoolMgrName = pool.getSystemFilterPoolManager().getName();
- SystemSimpleContentElement rootElement = filterPoolContent;
- SystemSimpleContentElement[] mgrElements = rootElement.getChildren();
- SystemSimpleContentElement mgrElement = null;
- for (int idx=0; (mgrElement==null) && (idx<mgrElements.length); idx++)
- {
- String mgrName = mgrElements[idx].getName();
- if (mgrName.equals(newPoolMgrName))
- mgrElement = mgrElements[idx];
- }
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(pool.getName(), pool, mgrElement, (Vector)null);
- cElement.setImageDescriptor(SystemFilterUIHelpers.getFilterPoolImage(pool.getProvider(),pool));
- if (mgrElement != null)
- mgrElement.addChild(cElement, 0);
- tree.refresh(mgrElement); // rebuild whole thing
- tree.setSelection(new StructuredSelection(cElement),true);
- // defect 42503
- Object inputObj = getInputObject();
- if (inputObj instanceof ISubSystem)
- {
- ISubSystem ss = (ISubSystem)inputObj;
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FILTERPOOL_CREATED);
- msg.makeSubstitution("'"+pool.getName()+"'", "'"+ss.getName()+"'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- if (shell.isDisposed() || !shell.isVisible())
- shell = getShell();
- SystemMessageDialog msgdlg = new SystemMessageDialog(shell, msg);
- boolean yes = msgdlg.openQuestionNoException();
- if (yes)
- {
- ISystemFilterPoolReferenceManager sfprm = ss.getSystemFilterPoolReferenceManager();
- sfprm.addReferenceToSystemFilterPool(pool);
- }
- }
- }
-
-
- /**
- * Callback from new action to get array of managers
- */
- public ISystemFilterPoolManager[] getFilterPoolManagers()
- {
- ISystemFilterPoolManager[] mgrs = filterPoolManagers;
- return mgrs;
- }
-
- /**
- * Callback from new action to get index of initial manager to select
- */
- public int getFilterPoolManagerSelection() {
- int selection = 0;
- SystemSimpleContentElement element = getSelectedElement();
- if (element != null) {
- Object elementData = element.getData();
- if (elementData != null) {
- if (elementData instanceof ISystemFilterPoolManager) {
- selection = getManagerIndex((ISystemFilterPoolManager) elementData);
- } else if (elementData instanceof ISystemFilterPool) {
- selection = getManagerIndex(((ISystemFilterPool) elementData).getSystemFilterPoolManager());
- }
- }
- }
- return selection;
- }
-
- private int getManagerIndex(ISystemFilterPoolManager mgr)
- {
- int pos = -1;
- ISystemFilterPoolManager[] mgrs = filterPoolManagers;
- for (int idx=0; (pos==-1)&&(idx<mgrs.length); idx++)
- {
- if (mgr == mgrs[idx])
- pos = idx;
- }
- if (pos == -1)
- pos = 0;
- return pos;
- }
-
- // SystemFilterPoolDialogInterface methods...
- /**
- * Allow base action to pass instance of itself for callback to get info
- */
- public void setFilterPoolDialogActionCaller(SystemFilterAbstractFilterPoolAction caller)
- {
- }
- /**
- * Return an object containing user-specified information pertinent to filter pool actions
- */
- public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs()
- {
- SystemFilterPoolDialogOutputs output = new SystemFilterPoolDialogOutputs();
- output.filterPoolTreeRoot = filterPoolContent;
- return output;
- }
-
- /**
- * Set the help context id for this wizard
- */
- public void setHelpContextId(String id)
- {
- super.setHelp(id);
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemUnNamedFilterDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemUnNamedFilterDialog.java
deleted file mode 100644
index 07424635c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/filters/dialogs/SystemUnNamedFilterDialog.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.filters.dialogs;
-
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * A dialog that prompts the user for a single filter string, but not for the
- * purpose of creating a named filter. The output is that single filter string,
- * and the caller can do what they want with it.
- */
-
-public class SystemUnNamedFilterDialog extends SystemPromptDialog
- implements
- ISystemFilterStringEditPaneListener
-{
-
- protected SystemFilterStringEditPane editpane;
- protected String outputFilterString;
- // inputs
- protected ISystemFilterPoolReferenceManagerProvider provider;
- /**
- * Constructor
- */
- public SystemUnNamedFilterDialog(Shell shell)
- {
- this(shell, SystemResources.RESID_CRTFILTER_TITLE);
- }
- /**
- * Constructor, when unique title desired
- */
- public SystemUnNamedFilterDialog(Shell shell, String title)
- {
- super(shell, title);
- //this.parentPool = parentPool;
- //setMinimumSize(450, 350); // x, y
- //pack();
- setOutputObject(null);
- setHelp();
- }
-
- /**
- * Overridable extension point for setting dialog help. By default, there is no help
- */
- protected void setHelp()
- {
- }
- // -------------------
- // INPUT/CONFIGURATION
- // -------------------
- /**
- * Set the contextual system filter pool reference manager provider. Eg, in the RSE, this
- * will be the selected subsystem if the New Filter action is launched from there, or if
- * launched from a filter pool reference under there.
- * <p>
- * Will be non-null if the current selection is a reference to a filter pool or filter,
- * or a reference manager provider.
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- this.provider = provider;
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"Inside setSystemFilterPoolReferenceManagerProvider. null? " + (provider==null));
- }
- /**
- * Specify an edit pane that prompts the user for the contents of a filter string.
- */
- public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
- {
- this.editpane = editPane;
- }
-
- // -------------------
- // OUTPUT
- // -------------------
- /**
- * Return the string the user configured in this dialog.
- * Will return null if the user cancelled the dialog, so test with wasCancelled().
- */
- public String getFilterString()
- {
- return outputFilterString;
- }
-
-
- // LIFECYCLE
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return editpane.getInitialFocusControl();
- }
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- editpane = getFilterStringEditPane(getShell());
- editpane.setSystemFilterPoolReferenceManagerProvider(provider);
-
- // Edit pane is our whole content area
- Control composite = editpane.createContents(parent);
-
- // add listeners
- editpane.addChangeListener(this);
-
- return composite;
- }
- /**
- * Return our edit pane. Overriding this is an alternative to calling setEditPane.
- * This is called in createContents
- */
- protected SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
- {
- if (editpane == null)
- editpane = new SystemFilterStringEditPane(shell);
- return editpane;
- }
-
- /**
- * Parent override.
- * Called when user presses OK button.
- * This is when we save all the changes the user made.
- */
- protected boolean processOK()
- {
- SystemMessage errorMessage = editpane.verify(); // should fire events back to us if there is an error
- if (errorMessage != null)
- return false;
- outputFilterString = editpane.getFilterString();
- return super.processOK();
- }
-
- /**
- * Parent override.
- * Called when user presses CLOSE button. We simply blow away all their changes!
- */
- protected boolean processCancel()
- {
- return super.processCancel();
- }
-
- /**
- * Override of parent method so we can direct it to the Apply button versus the OK button
- */
- public void setPageComplete(boolean complete)
- {
- }
-
- // ---------------
- // HELPER METHODS
- // ---------------
-
-
-
- // ----------------------------------------------
- // EDIT PANE CHANGE LISTENER INTERFACE METHODS...
- // ----------------------------------------------
- /**
- * Callback method. The user has changed the filter string. It may or may not
- * be valid. If not, the given message is non-null. If it is, and you want it,
- * call getSystemFilterString() in the edit pane.
- */
- public void filterStringChanged(SystemMessage message)
- {
- if (message != null)
- setErrorMessage(message);
- else
- clearErrorMessage();
- setPageComplete(message == null);
- }
- /**
- * Callback method. We are about to do a verify,the side effect of which is to
- * change the current state of the dialog, which we don't want. This tells the
- * dialog to back up that state so it can be restored.
- */
- public void backupChangedState()
- {
- }
- /**
- * Callback method. After backup and change events this is called to restore state
- */
- public void restoreChangedState()
- {
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.java
deleted file mode 100644
index 083bed04c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Dykstal (IBM) - 148434 Better F1 help.
- *******************************************************************************/
-package org.eclipse.rse.internal.ui.logging;
-
-import org.eclipse.osgi.util.NLS;
-
-public class LoggingPreferenceLabels extends NLS {
-
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.ui.logging.LoggingPreferenceLabels";//$NON-NLS-1$
-
- public static String LOGGING_PREFERENCE_PAGE_TOPLABEL;
- public static String LOGGING_PREFERENCE_PAGE_ERRORS_ONLY;
- public static String LOGGING_PREFERENCE_PAGE_WARNINGS_ERRORS;
- public static String LOGGING_PREFERENCE_PAGE_INFO_DEBUG;
- public static String LOGGING_PREFERENCE_PAGE_FULL_DEBUG;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, LoggingPreferenceLabels.class);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.properties
deleted file mode 100644
index c6b759bab..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferenceLabels.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Initial Contributors:
-# The following IBM employees contributed to the Remote System Explorer
-# component that contains this file: David McKnight, Kushal Munir,
-# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
-# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
-#
-# Contributors:
-# {Name} (company) - description of contribution.
-###############################################################################
-
-# =====================================
-# Remote System Logging properties file
-# =====================================
-# NLS_MESSAGEFORMAT_VAR
-# NLS_ENCODING=UTF-8
-
-# Preference Page
-# ----------------
-LOGGING_PREFERENCE_PAGE_TOPLABEL = Logging Level
-LOGGING_PREFERENCE_PAGE_ERRORS_ONLY = &Errors only
-LOGGING_PREFERENCE_PAGE_WARNINGS_ERRORS = &Warnings and errors
-LOGGING_PREFERENCE_PAGE_INFO_DEBUG = Warnings, errors and &information messages
-LOGGING_PREFERENCE_PAGE_FULL_DEBUG = Full &debug
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferencePage.java
deleted file mode 100644
index c9725ac0d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/logging/LoggingPreferencePage.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Michael Berger (IBM Canada) - 148434 Better F1 help.
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.logging;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.preference.PreferenceStore;
-import org.eclipse.rse.logging.Logger;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-
-/**
- * An abstract preference page for all remote system logging.<br/>
- * Use a subclass of this page if you need a preference page to control
- * logging.
- */
-public abstract class LoggingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private Button radioButton0;
- private Button radioButton1;
- private Button radioButton2;
- private Button radioButton3;
-
- /**
- * Creates composite control and sets the default layout data.
- *
- * @param parent the parent of the new composite
- * @param numColumns the number of columns for the new composite
- * @return the newly-created coposite
- */
- private Composite createComposite(Composite parent, int span, int numColumns) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = span;
- composite.setLayoutData(data);
- return composite;
- }
-
- /**
- * Creates group control and sets the default layout data.
- * @param parent the parent of the new composite
- * @param numColumns the number of columns for the new composite
- * @return the newly-created coposite
- */
- private Group createGroup(Composite parent, int span, int numColumns, String text) {
- Group group = new Group(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- group.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = span;
- group.setLayoutData(data);
- group.setText(text);
- return group;
- }
-
- /**
- * Utility method that creates a radio button instance
- * and sets the default layout data.
- *
- * @param parent the parent for the new button
- * @param label the label for the new button
- * @return the newly-created button
- */
- private Button createRadioButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.RADIO | SWT.LEFT);
- button.setText(label);
- GridData data = new GridData();
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * Method declared on PreferencePage
- */
- protected Control createContents(Composite parent) {
- Composite composite_tab = createComposite(parent, 1, 1);
- String topLabel = LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_TOPLABEL;
- Group group = createGroup(composite_tab, 1, 1, topLabel);
- radioButton0 = createRadioButton(group, LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_ERRORS_ONLY);
- radioButton1 = createRadioButton(group, LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_WARNINGS_ERRORS);
- radioButton2 = createRadioButton(group, LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_INFO_DEBUG);
- if (Logger.DEBUG) {
- radioButton3 = createRadioButton(group, LoggingPreferenceLabels.LOGGING_PREFERENCE_PAGE_FULL_DEBUG);
- }
- initializeValues();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.rse.ui.rsel0000"); //$NON-NLS-1$
- return composite_tab;
- }
-
- /**
- *
- */
- protected IPreferenceStore doGetPreferenceStore() {
- Bundle bundle = getBundle();
- if (bundle != null) {
- AbstractUIPlugin plugin = getPlugin();
- if (plugin != null) {
- return plugin.getPreferenceStore();
- } else {
- return new PreferenceStore();
- }
- } else {
- return new PreferenceStore();
- }
- }
-
- protected abstract AbstractUIPlugin getPlugin();
-
- private Bundle getBundle() {
- Plugin plugin = getPlugin();
- Bundle bundle = plugin.getBundle();
- return bundle;
- }
-
- /**
- * Method declared on IWorkbenchPreferencePage
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * Initializes states of the controls using current values
- * in the preference store.
- */
- private void initializeValues() {
- IPreferenceStore store = getPreferenceStore();
- radioButton0.setSelection(false);
- radioButton1.setSelection(false);
- radioButton2.setSelection(false);
- if (null != radioButton3) radioButton3.setSelection(false);
- int choice = store.getInt(Logger.LOGGING_LEVEL);
- switch (choice) {
- case 0:
- radioButton0.setSelection(true);
- break;
- case 1:
- radioButton1.setSelection(true);
- break;
- case 2:
- radioButton2.setSelection(true);
- break;
- case 3:
- if (null != radioButton3)
- radioButton3.setSelection(true);
- else
- radioButton2.setSelection(true);
- break;
- }
- }
-
- /**
- * Initializes states of the controls using default values
- * in the preference store.
- */
- private void initializeDefaults() {
- IPreferenceStore store = getPreferenceStore();
- radioButton0.setSelection(false);
- radioButton1.setSelection(false);
- radioButton2.setSelection(false);
- if (null != radioButton3) radioButton3.setSelection(false);
- int choice = store.getDefaultInt(Logger.LOGGING_LEVEL);
- switch (choice) {
- case 0:
- radioButton0.setSelection(true);
- break;
- case 1:
- radioButton1.setSelection(true);
- break;
- case 2:
- radioButton2.setSelection(true);
- break;
- case 3:
- if (null != radioButton3)
- radioButton3.setSelection(true);
- else
- radioButton2.setSelection(true);
- break;
- }
- }
-
- /**
- * Method declared on PreferencePage
- */
- protected void performDefaults() {
- super.performDefaults();
- initializeDefaults();
- }
-
- /**
- * Method declared on PreferencePage
- */
- public boolean performOk() {
- storeValues();
- return true;
- }
-
- /**
- * Stores the values of the controls back to the preference store.
- */
- private void storeValues() {
- IPreferenceStore store = getPreferenceStore();
- int choice = 0;
- if (radioButton1.getSelection())
- choice = 1;
- else if (radioButton2.getSelection())
- choice = 2;
- else if (null != radioButton3 && radioButton3.getSelection()) choice = 3;
- store.setValue(Logger.LOGGING_LEVEL, choice);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java
deleted file mode 100644
index c457b4d62..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/RemoteSystemsPreferencePage.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * - created and used PreferencesMapper
- * Martin Oberhuber (Wind River) - [180562] don't implement ISystemPreferencesConstants
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-
-
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemPreferenceChangeEvents;
-import org.eclipse.rse.internal.core.model.SystemPreferenceChangeEvent;
-import org.eclipse.rse.internal.ui.PreferencesMapper;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBooleanFieldEditor;
-import org.eclipse.rse.ui.propertypages.SystemTypeFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * Root preference page for Remote Systems Plugin
- */
-public class RemoteSystemsPreferencePage
- extends FieldEditorPreferencePage implements IWorkbenchPreferencePage
-{
- private SystemBooleanFieldEditor showFilterPoolsEditor;
- private SystemBooleanFieldEditor qualifyConnectionNamesEditor;
- private SystemBooleanFieldEditor rememberStateEditor;
-
-
- // yantzi: artemis 60, restore from cache when available
- private SystemBooleanFieldEditor restoreFromCache;
- private Composite innerComposite;
-
- private SystemTypeFieldEditor systemTypesEditor;
- private SystemBooleanFieldEditor showNewConnectionPromptEditor;
- private boolean lastShowFilterPoolsValue = false;
- private boolean lastQualifyConnectionNamesValue = false;
- private boolean lastRememberStateValue = true; // changed in R2 by Phil. Not sure about migration!
-// private boolean lastRestoreFromCacheValue = true; // yantzi: new in artemis 6.0
- private boolean lastShowNewConnectionPromptValue = true;
- private boolean lastUseDeferredQueryValue = false;
-
- /**
- * Constructor
- */
- public RemoteSystemsPreferencePage()
- {
- super(GRID);
- setTitle(SystemResources.RESID_PREF_ROOT_PAGE);
- setPreferenceStore(RSEUIPlugin.getDefault().getPreferenceStore());
-// setDescription(SystemResources.RESID_PREF_ROOT_TITLE); // removed since this is not read by screen reader
- }
- /**
- * We intercept to set the help
- */
- public void createControl(Composite parent)
- {
- super.createControl(parent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), RSEUIPlugin.HELPPREFIX+"rsep0000"); //$NON-NLS-1$
- }
-
- /**
- * GUI widgets for preferences page
- */
- protected void createFieldEditors()
- {
- IPreferenceStore coreStore = new PreferencesMapper(RSECorePlugin.getDefault().getPluginPreferences());
-
- // ENABLED STATE AND DEFAULT USERID PER SYSTEM TYPE
- systemTypesEditor = new SystemTypeFieldEditor(
- ISystemPreferencesConstants.SYSTEMTYPE_VALUES,
- SystemResources.RESID_PREF_USERID_PERTYPE_PREFIX_LABEL,
- getFieldEditorParent()
- );
- addField(systemTypesEditor);
- systemTypesEditor.setToolTipText(SystemResources.RESID_PREF_USERID_PERTYPE_PREFIX_TOOLTIP);
-
- // QUALIFY CONNECTION NAMES
- qualifyConnectionNamesEditor = new SystemBooleanFieldEditor(
- ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES,
- SystemResources.RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_LABEL,
- getFieldEditorParent()
- );
- addField(qualifyConnectionNamesEditor);
- qualifyConnectionNamesEditor.setToolTipText(SystemResources.RESID_PREF_QUALIFYCONNECTIONNAMES_PREFIX_TOOLTIP);
- lastQualifyConnectionNamesValue = getPreferenceStore().getBoolean(qualifyConnectionNamesEditor.getPreferenceName());
-
- // SHOW FILTER POOLS
- showFilterPoolsEditor = new SystemBooleanFieldEditor(
- ISystemPreferencesConstants.SHOWFILTERPOOLS,
- SystemResources.RESID_PREF_SHOWFILTERPOOLS_PREFIX_LABEL,
- getFieldEditorParent()
- );
- addField(showFilterPoolsEditor);
- showFilterPoolsEditor.setToolTipText(SystemResources.RESID_PREF_SHOWFILTERPOOLS_PREFIX_TOOLTIP);
- lastShowFilterPoolsValue = getPreferenceStore().getBoolean(showFilterPoolsEditor.getPreferenceName());
-
- // SHOW "NEW CONNECTION..." PROMPT INSIDE REMOTE SYSTEMS VIEW
- showNewConnectionPromptEditor = new SystemBooleanFieldEditor(
- ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT,
- SystemResources.RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_LABEL,
- getFieldEditorParent()
- );
- addField(showNewConnectionPromptEditor);
- showNewConnectionPromptEditor.setToolTipText(SystemResources.RESID_PREF_SHOWNEWCONNECTIONPROMPT_PREFIX_TOOLTIP);
- lastShowNewConnectionPromptValue = getPreferenceStore().getBoolean(showNewConnectionPromptEditor.getPreferenceName());
-
- // REMEMBER STATE
- rememberStateEditor = new SystemBooleanFieldEditor(
- ISystemPreferencesConstants.REMEMBER_STATE,
- SystemResources.RESID_PREF_REMEMBERSTATE_PREFIX_LABEL,
- getFieldEditorParent()
- );
- addField(rememberStateEditor);
- rememberStateEditor.setToolTipText(SystemResources.RESID_PREF_REMEMBERSTATE_PREFIX_TOOLTIP);
- lastRememberStateValue = getPreferenceStore().getBoolean(rememberStateEditor.getPreferenceName());
-
- // Restore from cache
- innerComposite = SystemWidgetHelpers.createComposite(getFieldEditorParent(), SWT.NULL);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalIndent = 20;
- innerComposite.setLayoutData(gd);
- restoreFromCache = new SystemBooleanFieldEditor(
- ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE,
- SystemResources.RESID_PREF_RESTOREFROMCACHE_PREFIX_LABEL,
- innerComposite
- );
- restoreFromCache.setEnabled(lastRememberStateValue, innerComposite);
- addField(restoreFromCache);
- restoreFromCache.setToolTipText(SystemResources.RESID_PREF_RESTOREFROMCACHE_PREFIX_TOOLTIP);
-// lastRestoreFromCacheValue = getPreferenceStore().getBoolean(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE);
-
-
- // set mnemonics
- (new Mnemonics()).setOnPreferencePage(true).setMnemonics(getFieldEditorParent());
-
- }
-
- public void init(IWorkbench workbench)
- {
- }
-
- /**
- * we don't use this after all because it causes an event to be fired as the
- * user makes each change. We prefer to wait until Apply or Defaults are pressed.
- */
- public void propertyChange(PropertyChangeEvent event)
- {
-
- // yantzi: artemis 6.0
- if (event.getSource() == rememberStateEditor)
- {
- Object newValue = event.getNewValue();
- if (newValue instanceof Boolean)
- {
- restoreFromCache.setEnabled(((Boolean) newValue).booleanValue(), innerComposite);
- }
- }
-
- super.propertyChange(event);
- }
-
- /**
- * Override of parent so we can fire changes to our views
- */
- public boolean performOk()
- {
- boolean ok = super.performOk();
- SystemPreferencesManager.savePreferences(); // better save to disk, just in case.
- if (!RSECorePlugin.isTheSystemRegistryActive())
- return ok;
- if (showFilterPoolsEditor != null)
- {
- boolean newValue = showFilterPoolsEditor.getBooleanValue();
- if (newValue != lastShowFilterPoolsValue)
- {
- RSEUIPlugin.getTheSystemRegistryUI().setShowFilterPools(newValue);
- firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS,lastShowFilterPoolsValue,newValue);
- }
- lastShowFilterPoolsValue = newValue;
- }
- if (showNewConnectionPromptEditor != null)
- {
- boolean newValue = showNewConnectionPromptEditor.getBooleanValue();
- if (newValue != lastShowNewConnectionPromptValue)
- {
- RSEUIPlugin.getTheSystemRegistryUI().setShowNewHostPrompt(newValue);
- }
- lastShowNewConnectionPromptValue = newValue;
- }
- if (qualifyConnectionNamesEditor != null)
- {
- boolean newValue = qualifyConnectionNamesEditor.getBooleanValue();
- if (newValue != lastQualifyConnectionNamesValue)
- {
- RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(newValue);
- firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES,lastQualifyConnectionNamesValue,newValue);
- }
- lastQualifyConnectionNamesValue = newValue;
- }
- if (rememberStateEditor != null)
- {
- boolean newValue = rememberStateEditor.getBooleanValue();
- if (newValue != lastRememberStateValue)
- {
- firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_RESTORESTATE,lastRememberStateValue,newValue);
- }
- lastRememberStateValue = newValue;
- }
-
- return ok;
- }
-
- /**
- * Fire a preference change event
- */
- private void firePreferenceChangeEvent(int type, boolean oldValue, boolean newValue)
- {
- RSECorePlugin.getTheSystemRegistry().fireEvent(
- new SystemPreferenceChangeEvent(type,
- oldValue ? Boolean.TRUE : Boolean.FALSE,
- newValue ? Boolean.TRUE : Boolean.FALSE));
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java
deleted file mode 100644
index 39ef15d29..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * David McKnight (IBM) - [197129] Removing obsolete ISystemConnectionWizardPropertyPage and SystemSubSystemsPropertiesWizardPage
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.comm.SystemKeystoreProviderManager;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.widgets.ServerConnectionSecurityForm;
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-public class ServerConnectionSecurityPropertyPage extends SystemBasePropertyPage
-{
-
-
- private ServerConnectionSecurityForm _form;
-
- public ServerConnectionSecurityPropertyPage()
- {
- super();
- }
-
- /**
- * @see org.eclipse.rse.ui.propertypages.SystemBasePropertyPage#createContentArea(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // Create property page UI
- _form = new ServerConnectionSecurityForm(getShell(), getMessageLine());
- _form.createContents(parent);
-
- initialize();
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "ssls0001"); //$NON-NLS-1$
-
- return parent;
- }
-
- /**
- * @see org.eclipse.rse.ui.propertypages.SystemBasePropertyPage#verifyPageContents()
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- private void initialize()
- {
- IPreferenceStore prefStore = RSEUIPlugin.getDefault().getPreferenceStore();
-
- boolean alertSSL = prefStore.getBoolean(ISystemPreferencesConstants.ALERT_SSL);
- boolean alertNonSSL = prefStore.getBoolean(ISystemPreferencesConstants.ALERT_NONSSL);
-
- // enable/disable as appropriate
- _form.setAlertSSL(alertSSL);
- _form.setAlertNonSSL(alertNonSSL);
-
- // if there is no keystore provider then this needs to be disabled
- boolean hasProvider = SystemKeystoreProviderManager.getInstance().hasProvider();
- if (!hasProvider)
- {
- _form.disable();
- }
- else
- {
- _form.enable();
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk()
- {
- Object subsystem = getElement();
-
- if (subsystem instanceof ISubSystem)
- {
- return applyValues(((ISubSystem)subsystem).getConnectorService());
- }
- return true;
- }
-
- public void setSubSystemConfiguration(ISubSystemConfiguration factory)
- {
- }
-
- public boolean applyValues(IConnectorService connectorService)
- {
- boolean alertSSL = _form.getAlertSSL();
- boolean alertNonSSL = _form.getAlertNonSSL();
- IPreferenceStore prefStore = RSEUIPlugin.getDefault().getPreferenceStore();
- prefStore.setValue(ISystemPreferencesConstants.ALERT_SSL, alertSSL);
- prefStore.setValue(ISystemPreferencesConstants.ALERT_NONSSL, alertNonSSL);
- return true;
- }
-
- public void setHostname(String name)
- {
- }
-
- public void setSystemType(IRSESystemType systemType)
- {
-
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java
deleted file mode 100644
index 01c7942f5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * David McKnight (IBM) - [197129] Removing obsolete ISystemConnectionWizardPropertyPage and SystemSubSystemsPropertiesWizardPage
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.SubSystem;
-import org.eclipse.rse.ui.ISystemVerifyListener;
-import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardErrorUpdater;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.widgets.IServerLauncherForm;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * Property page for editing persistant environment variables for an
- * RSE connection.
- */
-public class ServerLauncherPropertyPage extends SystemBasePropertyPage
-//implements ISystemConnectionWizardPropertyPage, ISystemConnectionWizardErrorUpdater
-{
-
- private IServerLauncherForm _form;
- protected IRSESystemType _systemType;
- private IServerLauncherProperties sl;
- private ISubSystemConfiguration _factory;
-
- /**
- * Constructor for ServerLauncherPropertyPage.
- */
- public ServerLauncherPropertyPage()
- {
- super();
- }
-
- /**
- * @see org.eclipse.rse.ui.propertypages.SystemBasePropertyPage#createContentArea(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
-
- ISubSystemConfiguration factory = null;
- Object input = getElement();
- IConnectorService connectorService = null;
- if (input instanceof ISubSystem)
- {
- ISubSystem ss = (ISubSystem)input;
- connectorService = ss.getConnectorService();
- sl = connectorService.getRemoteServerLauncherProperties();
- factory = ss.getSubSystemConfiguration();
- }
- else if (input instanceof ISubSystemConfiguration)
- {
- factory = (ISubSystemConfiguration)input;
- }
- else
- {
- factory =_factory;
- }
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class);
- _form = adapter.getServerLauncherForm(factory, getShell(), getMessageLine());
-
- // Create property page UI
- _form.createContents(parent);
- if (sl != null && connectorService != null)
- {
- _form.setHostname(connectorService.getHost().getHostName());
- _form.initValues(sl);
- }
-
- return parent;
- }
-
- /**
- * @see org.eclipse.rse.ui.propertypages.SystemBasePropertyPage#verifyPageContents()
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- public void setSubSystemConfiguration(ISubSystemConfiguration factory)
- {
- _factory = factory;
- }
-
- public void setHostname(String hostName)
- {
- _form.setHostname(hostName);
- }
-
- public boolean applyValues(IConnectorService connectorService)
- {
- if (_form == null)
- return true;
-
- if (getElement() instanceof SubSystem)
- {
- SubSystem ss = (SubSystem)getElement();
- if (!ss.getConnectorService().supportsServerLaunchProperties())
- {
- return true;
- }
- }
-
- if (_form.verify())
- {
- if (sl == null)
- {
- sl = connectorService.getRemoteServerLauncherProperties();
- }
-
- if (_form.updateValues(sl))
- {
- try
- {
- connectorService.commit();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk()
- {
- if (_form.isDirty())
- {
- return applyValues(sl.getConnectorService());
- }
- return true;
- }
-
- public boolean isPageComplete()
- {
- if (_form.isDirty())
- {
- return _form.verify();
- }
- else
- {
- return true;
- }
- }
-
- public void addVerifyListener(ISystemVerifyListener listener)
- {
- if (_form instanceof ISystemConnectionWizardErrorUpdater)
- ((ISystemConnectionWizardErrorUpdater)_form).addVerifyListener(listener);
- }
-
- public String getTheErrorMessage()
- {
- return getErrorMessage();
- }
-
- public void setSystemType(IRSESystemType systemType)
- {
- _systemType = systemType;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java
deleted file mode 100644
index 42f5befcb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [226574] don't show encoding if no subsystem supports it
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.ISystemConnectionFormCaller;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemConnectionForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * The property page for connection properties
- * The plugin.xml file registers this for objects of class org.eclipse.rse.rse.model.IHost
- */
-public class SystemConnectionPropertyPage extends SystemBasePropertyPage
- implements ISystemMessageLine, ISystemConnectionFormCaller
-{
-
- protected SystemConnectionForm form;
- protected String parentHelpId;
-
- /**
- * Constructor for SystemConnectionPropertyPage
- */
- public SystemConnectionPropertyPage()
- {
- super();
- parentHelpId = RSEUIPlugin.HELPPREFIX + "pcon0000"; //$NON-NLS-1$
- form = new SystemConnectionForm(this, this);
- }
- /**
- * Create the page's GUI contents.
- */
- protected Control createContentArea(Composite parent)
- {
- // prepare input data
- IHost conn = (IHost)getElement();
- form.initializeInputFields(conn);
-
- // only add encoding fields if needed for this connection
- ISubSystem[] sses = conn.getSubSystems();
- boolean addEncodingFields = false;
- for (int i = 0; i < sses.length && !addEncodingFields; i++){
- ISubSystem ss = sses[i];
- addEncodingFields = ss.getSubSystemConfiguration().supportsEncoding(conn);
- }
-
- if (addEncodingFields){
- // add encoding fields
- form.addDefaultEncodingFields();
- }
-
- // create validators
- ISystemValidator connectionNameValidators[] = new ISystemValidator[1];
- connectionNameValidators[0] = SystemConnectionForm.getConnectionNameValidator(conn);
- form.setConnectionNameValidators(connectionNameValidators);
- // create content area
- Control c = form.createContents(parent,true, parentHelpId);
- // set focus
- form.getInitialFocusControl().setFocus();
- SystemWidgetHelpers.setCompositeHelp(parent, parentHelpId);
- return c;
- }
-
- /**
- * Get the input connection object
- */
- protected IHost getConnection()
- {
- return (IHost)getElement();
- }
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk()
- {
- boolean okToClose = verifyPageContents();
- if (okToClose)
- {
- IHost conn = (IHost)getElement();
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.updateHost( conn, conn.getSystemType(), form.getConnectionName(),form.getHostName(),
- form.getConnectionDescription(), form.getDefaultUserId(),
- form.getUserIdLocation() );
-
- // update encoding
- String encoding = form.getDefaultEncoding();
- boolean isRemoteEncoding = form.isEncodingRemoteDefault();
-
- // user set encoding
- if (!isRemoteEncoding) {
- conn.setDefaultEncoding(encoding, false);
- }
- // remote default encoding
- else {
- // remove user encoding from host property first
- conn.setDefaultEncoding(null, false);
- // remove default remote encoding to indicate to get from remote system
- conn.setDefaultEncoding(null, true);
- }
-
- boolean offlineSelection = form.isWorkOffline();
- if (offlineSelection != conn.isOffline())
- {
- // offline status has changed
- if (!offlineSelection)
- {
- // offline going online
- sr.setHostOffline(conn, false);
- }
- else
- {
- // these need to be set before calling disconnect so the iSeires subsystems know not
- // to collapse
- sr.setHostOffline(conn, true);
-
- // online going offline, disconnect all subsystems
- ISubSystem[] subsystems = sr.getSubSystems(conn);
- if (subsystems != null)
- {
- boolean cancelled = false;
- for (int i = 0; i < subsystems.length && !cancelled; i++)
- {
- try
- {
- subsystems[i].disconnect(false);
- } catch (InterruptedException e) {
- // user cancelled disconnect
- cancelled = true;
- } catch (Exception e) {
- SystemBasePlugin.logError("SystemConnectionPropertyPage.performOk", e); //$NON-NLS-1$
- }
- }
- }
-
- // check that everything was disconnedted okay and this is not the local connection
- if(sr.isAnySubSystemConnected(conn) && !conn.getSystemType().isLocal())
- {
- // backout changes, likely because user cancelled the disconnect
- sr.setHostOffline(conn, false);
- okToClose = false;
- }
- }
- }
- }
- return okToClose;
- }
-
- /**
- * Validate all the widgets on the page
- * <p>
- * Subclasses should override to do full error checking on all
- * the widgets on the page.
- */
- protected boolean verifyPageContents()
- {
- return form.verify(true);
- }
-
-
-
- // ----------------------------------------
- // CALLBACKS FROM SYSTEM CONNECTION FORM...
- // ----------------------------------------
- /**
- * Event: the user has selected a system type.
- */
- public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization)
- {
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java
deleted file mode 100644
index b8f4380d2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemTabFolderLayout;
-import org.eclipse.rse.ui.ISystemConnectionFormCaller;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.ISystemMessageLineTarget;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-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.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-
-/**
- * The property page for subsystem properties when accessed from the connection property page.
- * The plugin.xml file registers this for objects of class org.eclipse.rse.ui.model.IHost
- <page
- objectClass="org.eclipse.rse.ui.model.IHost"
- name="SubSystems"
- class="org.eclipse.rse.core.ui.propertypages.SystemConnectionSubSystemsPropertyPage"
- id="org.eclipse.rse.SystemConnectionSubSystemsPropertyPage">
- </page>
- */
-public class SystemConnectionSubSystemsPropertyPage extends SystemBasePropertyPage
- implements ISystemMessageLine, ISystemConnectionFormCaller, SelectionListener
-{
-
- protected CTabFolder tabFolder;
- protected ResourceBundle rb;
- protected String parentHelpId;
- protected PropertyPage[] pages;
- protected CTabItem[] tabs;
-
- /**
- * Constructor.
- */
- public SystemConnectionSubSystemsPropertyPage()
- {
- super();
- //RSEUIPlugin sp = RSEUIPlugin.getDefault();
- parentHelpId = RSEUIPlugin.HELPPREFIX + "pcon0000"; //$NON-NLS-1$
- }
-
- /**
- * Return false if you don't want to have mnemonics automatically applied to your page
- * by this parent class. We return false as we assume each subpage does their own.
- */
- protected boolean wantMnemonics()
- {
- return false;
- }
-
- /**
- * Create the page's GUI contents.
- */
- protected Control createContentArea(Composite parent)
- {
- // prepare input data
- //IHost conn = (IHost)getElement();
-
- // create notebook
- Composite composite_prompts = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.numColumns = 1;
- composite_prompts.setLayout(layout);
-
- // create notebook pages
- ISubSystem[] subsystems = getSubSystems();
- pages = getSubSystemPropertyPages(subsystems);
-
- if (pages != null)
- {
- tabFolder = createTabFolder(composite_prompts);
- createTabbedItems(pages);
- tabFolder.setFocus();
- }
- else
- {
- SystemWidgetHelpers.createLabel(composite_prompts, SystemPropertyResources.RESID_TERM_NOTAVAILABLE);
- }
-
- SystemWidgetHelpers.setCompositeHelp(parent, parentHelpId);
- return composite_prompts;
- }
-
- /**
- * Create the notebook.
- */
- protected CTabFolder createTabFolder(Composite parent)
- {
- tabFolder = new CTabFolder(parent, SWT.NONE);
- tabFolder.setLayout(new SystemTabFolderLayout());
- tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
- return tabFolder;
- }
-
- /**
- * Query the property page for each subsystem and then add each to the
- * tabbed notebook as a tab...
- */
- private PropertyPage[] getSubSystemPropertyPages(ISubSystem[] subsystems)
- {
- PropertyPage[] pages = null;
- Vector v = new Vector();
-
- for (int idx = 0; idx < subsystems.length; idx++)
- {
- ISubSystem ss = subsystems[idx];
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ss.getSubSystemConfiguration().getAdapter(ISubSystemConfigurationAdapter.class);
- PropertyPage page = adapter.getPropertyPage(ss, tabFolder);
-
- if (page != null)
- {
- page.setContainer(getContainer());
- }
-
- if (page != null)
- {
- page.setElement((IAdaptable)ss);
-
- if (page instanceof ISystemMessageLineTarget)
- ((ISystemMessageLineTarget)page).setMessageLine(msgLine);
-
- v.addElement(page);
- }
- }
-
- if (v.size() > 0)
- {
- pages = new PropertyPage[v.size()];
-
- for (int idx=0; idx<pages.length; idx++)
- {
- pages[idx] = (PropertyPage)v.elementAt(idx);
- }
- }
-
- return pages;
- }
-
- /**
- * For each property page create a tabbed item.
- */
- private void createTabbedItems(PropertyPage[] pages)
- {
- if (pages != null)
- {
- tabs = new CTabItem[pages.length];
-
- for (int idx = 0; idx < pages.length; idx++)
- {
- PropertyPage page = pages[idx];
- ISubSystem ss = (ISubSystem)((IWorkbenchPropertyPage)page).getElement();
- CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
- tabItem.setText(ss.getName());
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ss.getSubSystemConfiguration().getAdapter(ISubSystemConfigurationAdapter.class);
- Image image = adapter.getGraphicsImage(ss.getSubSystemConfiguration());
-
- if (image != null)
- {
- tabItem.setImage(image);
- }
-
- tabItem.setData(page);
-
- if (page.getControl() == null)
- {
- page.createControl(tabFolder);
- }
-
- // dy: Need to force the control to repack incase the buttonbar was added
- // and subsequently removed. Otherwise an ArrayIndexOutOfBounds exception
- // occurs when SWT tries to lay out the page
- page.getControl().pack(true);
- tabItem.setControl(page.getControl());
- tabs[idx] = tabItem;
- }
- }
- }
-
- /**
- * Get the input connection object
- */
- protected IHost getConnection()
- {
- return (IHost)getElement();
- }
-
- /**
- * Get the input subsystems
- */
- protected ISubSystem[] getSubSystems()
- {
- ISubSystem[] subsystems =
- RSECorePlugin.getTheSystemRegistry().getSubSystems(getConnection());
- return subsystems;
- }
-
- /**
- * The <code>PreferencePage</code> implementation of this
- * <code>IPreferencePage</code> method returns <code>true</code>
- * if the page is valid.
- * <p>
- * We cycle through all pages calling okToLeave().
- */
- public boolean okToLeave()
- {
- boolean ok = isValid();
-
- if (ok && (pages!= null) && (pages.length > 0))
- {
- int currIdx = tabFolder.getSelectionIndex();
-
- // if a page is selected
- if (currIdx != -1)
- {
- PropertyPage currentPage = pages[currIdx];
- ok = currentPage.okToLeave();
- }
-
- for (int idx = 0; ok && (idx < pages.length); idx++)
- {
- if (idx != currIdx)
- {
- PropertyPage page = pages[idx];
- ok = page.okToLeave();
-
- if (!ok)
- {
- tabFolder.setSelection(idx);
- }
- }
- }
- }
-
- return ok;
- }
-
- /**
- * Return true if this page is valid. Override of parent.
- * Cycles through all tab pages calling isValid.
- */
- public boolean isValid()
- {
- boolean ok = super.isValid();
- if (ok && (pages!=null) && (pages.length>0))
- {
- for (int idx=0; ok && (idx<pages.length); idx++)
- {
- PropertyPage page = pages[idx];
- ok = page.isValid();
- }
- }
- return ok;
- }
-
- /**
- * Called by parent when user presses OK.
- * We cycle through all subpages calling performOk
- */
- public boolean performOk()
- {
- boolean okToClose = super.performOk();
-
- if (okToClose && (pages != null) && (pages.length > 0))
- {
- int currIdx = tabFolder.getSelectionIndex();
-
- if (currIdx != -1)
- {
- PropertyPage currentPage = pages[currIdx];
- okToClose = currentPage.performOk();
- }
-
- for (int idx = 0; okToClose && (idx < pages.length); idx++)
- {
- if (idx != currIdx)
- {
- PropertyPage page = pages[idx];
- okToClose = page.performOk();
-
- if (!okToClose)
- {
- tabFolder.setSelection(idx);
- }
- }
- }
- }
-
- return okToClose;
- }
-
- /**
- * Validate all the widgets on the page
- * <p>
- * Subclasses should override to do full error checking on all
- * the widgets on the page.
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
- // ----------------------------------------
- // The following were for any aborted attempt to query registered subsystem property pages
- // and use them. The problem with this is that for iSeries, all property pages for subsystems
- // are shared and we ended up with redundancies.
- // ----------------------------------------
-
- // ----------------------------------------
- // SelectionListener methods...
- // ----------------------------------------
- /**
- * A tab item selected
- */
- public void widgetSelected(SelectionEvent event)
- {
- if (event.getSource() == tabFolder)
- {
- }
- }
- /**
- * Not used
- */
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
-
- // ----------------------------------------
- // CALLBACKS FROM SYSTEM CONNECTION FORM...
- // ----------------------------------------
- /**
- * Event: the user has selected a system type.
- */
- public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization)
- {
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectorServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectorServicesPropertyPage.java
deleted file mode 100644
index 25e6c6f60..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectorServicesPropertyPage.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.rse.ui.widgets.services.ConnectorServiceElement;
-import org.eclipse.rse.ui.widgets.services.ConnectorServicesForm;
-import org.eclipse.rse.ui.widgets.services.RootServiceElement;
-import org.eclipse.rse.ui.widgets.services.ServiceElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-public class SystemConnectorServicesPropertyPage extends SystemBasePropertyPage
-{
- private ConnectorServicesForm _form;
- private ServiceElement _root;
- public IHost getHost()
- {
- return (IHost)getElement();
- }
-
-
- protected Control createContentArea(Composite parent)
- {
- _form = new ConnectorServicesForm(getMessageLine());
-
- Control control = _form.createContents(parent);
- initForm();
- return control;
- }
-
-
- protected void initForm()
- {
- _root = getRoot();
- _form.init(_root);
- }
-
- protected ServiceElement getRoot()
- {
- RootServiceElement root = new RootServiceElement();
- IHost host = getHost();
- IConnectorService[] connectorServices = host.getConnectorServices();
- ServiceElement[] elements = new ServiceElement[connectorServices.length];
- for (int i = 0; i < connectorServices.length; i++)
- {
- elements[i] = new ConnectorServiceElement(host, root, connectorServices[i]);
- }
- root.setChildren(elements);
- return root;
- }
-
- protected boolean verifyPageContents()
- {
- return true;
- }
-
-
- public boolean performCancel()
- {
- _root.revert();
- return super.performCancel();
- }
-
-
- public boolean performOk()
- {
- _root.commit();
- return super.performOk();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolPropertyPage.java
deleted file mode 100644
index a693f4e08..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolPropertyPage.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-
-/**
- * The property page for filter pool properties.
- * This is an output-only page.
- * The plugin.xml file registers this for objects of class org.eclipse.rse.internal.filters.SystemFilterPool
- */
-public class SystemFilterPoolPropertyPage extends SystemBasePropertyPage
-{
-
- protected Label labelType, labelName, labelProfile, labelReferenceCount, labelRelatedConnection;
- protected String errorMessage;
- protected boolean initDone = false;
-
- /**
- * Constructor
- */
- public SystemFilterPoolPropertyPage()
- {
- super();
- }
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // ensure the page has no special buttons
- noDefaultAndApplyButton();
-
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
-
- // Type display
- labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
- labelType.setText(SystemResources.RESID_FILTERPOOL_TYPE_VALUE);
-
- // Name display
- labelName = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_NAME_LABEL, SystemResources.RESID_FILTERPOOL_NAME_TOOLTIP);
-
- // Profile display
- labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_PROFILE_LABEL, SystemResources.RESID_FILTERPOOL_PROFILE_TOOLTIP);
-
- // Reference count display
- labelReferenceCount = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_REFERENCECOUNT_LABEL, SystemResources.RESID_FILTERPOOL_REFERENCECOUNT_TOOLTIP);
-
- // Related connection display
- labelRelatedConnection = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOL_RELATEDCONNECTION_LABEL, SystemResources.RESID_FILTERPOOL_RELATEDCONNECTION_TOOLTIP);
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- }
- /**
- * From parent: do full page validation
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Get the input filterpool object
- */
- protected ISystemFilterPool getFilterPool()
- {
- Object element = getElement();
- if (element instanceof ISystemFilterPool)
- return (ISystemFilterPool)element;
- else
- return ((ISystemFilterPoolReference)element).getReferencedFilterPool();
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISystemFilterPool pool = getFilterPool();
- // name
- labelName.setText(pool.getName());
- // profile
- ISubSystemConfiguration ssFactory = (ISubSystemConfiguration)(pool.getProvider());
- String profileName = ssFactory.getSystemProfile(pool).getName();
- labelProfile.setText( profileName );
- // reference count
- labelReferenceCount.setText(Integer.toString(pool.getReferenceCount()));
- // related connection
- if (pool.getOwningParentName() == null)
- labelRelatedConnection.setText(SystemPropertyResources.RESID_TERM_NOTAPPLICABLE);
- else
- labelRelatedConnection.setText(pool.getOwningParentName());
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolReferencePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolReferencePropertyPage.java
deleted file mode 100644
index b25404479..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPoolReferencePropertyPage.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-
-/**
- * The property page for filter pool properties.
- * This is an output-only page.
- * The plugin.xml file registers this for objects of class org.eclipse.rse.internal.filters.SystemFilterPool
- */
-public class SystemFilterPoolReferencePropertyPage extends SystemBasePropertyPage
-{
-
- protected Label labelType, labelName, labelSubSystem, labelProfile, labelConnection; //, labelRelatedConnection;
- protected String errorMessage;
- protected boolean initDone = false;
-
- /**
- * Constructor
- */
- public SystemFilterPoolReferencePropertyPage()
- {
- super();
- }
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
-
- // Type display
- labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
- labelType.setText(SystemResources.RESID_FILTERPOOLREF_TYPE_VALUE);
-
- // Name display
- labelName = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_NAME_LABEL, SystemResources.RESID_FILTERPOOLREF_NAME_TOOLTIP);
-
- // SubSystem display
- labelSubSystem = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_SUBSYSTEM_LABEL, SystemResources.RESID_FILTERPOOLREF_SUBSYSTEM_TOOLTIP);
-
- // Connection display
- labelConnection = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_CONNECTION_LABEL, SystemResources.RESID_FILTERPOOLREF_CONNECTION_TOOLTIP);
-
- // Profile display
- labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_FILTERPOOLREF_PROFILE_LABEL, SystemResources.RESID_FILTERPOOLREF_PROFILE_TOOLTIP);
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- }
- /**
- * From parent: do full page validation
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Get the input filterpoolreference object
- */
- protected ISystemFilterPoolReference getFilterPoolReference()
- {
- return ((ISystemFilterPoolReference)getElement());
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISystemFilterPoolReference poolRef = getFilterPoolReference();
- ISystemFilterPool pool = poolRef.getReferencedFilterPool();
- ISubSystem ss = (ISubSystem)poolRef.getProvider();
-
- // name
- labelName.setText(pool.getName());
- // subsystem
- labelSubSystem.setText(ss.getName());
- // connection
- labelConnection.setText(ss.getHostAliasName());
- // profile
- labelProfile.setText(ss.getSystemProfileName());
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPropertyPage.java
deleted file mode 100644
index 594e1552b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemFilterPropertyPage.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-
-/**
- * The property page for filter properties.
- * This is an output-only page.
- * The plugin.xml file registers this for objects of class org.eclipse.rse.internal.filters.SystemFilter
- */
-public class SystemFilterPropertyPage extends SystemBasePropertyPage
-{
-
- protected Label labelType, labelName, labelFilterPool, labelStringCount, labelIsConnectionPrivate, labelProfile;
- protected String errorMessage;
- protected boolean initDone = false;
-
- /**
- * Constructor
- */
- public SystemFilterPropertyPage()
- {
- super();
- }
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
-
- // Type display
- labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
- labelType.setText(SystemResources.RESID_PP_FILTER_TYPE_VALUE);
-
- // Name display
- labelName = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_NAME_LABEL, SystemResources.RESID_PP_FILTER_NAME_TOOLTIP);
-
- // String count display
- labelStringCount = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_STRINGCOUNT_LABEL, SystemResources.RESID_PP_FILTER_STRINGCOUNT_TOOLTIP);
-
- // Is connection-private display
- labelIsConnectionPrivate = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_ISCONNECTIONPRIVATE_LABEL, SystemResources.RESID_PP_FILTER_ISCONNECTIONPRIVATE_TOOLTIP);
-
- // Parent Filter Pool display
- labelFilterPool = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_FILTERPOOL_LABEL, SystemResources.RESID_PP_FILTER_FILTERPOOL_TOOLTIP);
-
- // Parent Profile display
- labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTER_PROFILE_LABEL, SystemResources.RESID_PP_FILTER_PROFILE_TOOLTIP);
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- }
- /**
- * From parent: do full page validation
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Get the input filter object
- */
- protected ISystemFilter getFilter()
- {
- Object element = getElement();
- if (element instanceof ISystemFilter)
- return (ISystemFilter)element;
- else
- return ((ISystemFilterReference)element).getReferencedFilter();
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISystemFilter filter = getFilter();
- boolean isTransient = filter.isTransient();
- // name
- labelName.setText(filter.getName());
- // type
- if (filter.isPromptable()){
- labelType.setText(SystemResources.RESID_PP_FILTER_TYPE_PROMPTABLE_VALUE);
- labelType.setToolTipText(SystemResources.RESID_PP_FILTER_TYPE_PROMPTABLE_TOOLTIP);
- }
- if (!isTransient)
- {
- // pool
- ISystemFilterPool pool = filter.getParentFilterPool();
- labelFilterPool.setText(pool.getName());
- // profile
- ISubSystemConfiguration ssFactory = (ISubSystemConfiguration)(pool.getProvider());
- String profileName = ssFactory.getSystemProfile(pool).getName();
- labelProfile.setText( profileName );
- // string count
- labelStringCount.setText(Integer.toString(filter.getFilterStringCount()));
- // is connection-private
- if (pool.getOwningParentName() == null)
- labelIsConnectionPrivate.setText(SystemResources.TERM_NO);
- else
- labelIsConnectionPrivate.setText(SystemResources.TERM_YES);
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemLoggingPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemLoggingPreferencePage.java
deleted file mode 100644
index 1559527a3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemLoggingPreferencePage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-
-import org.eclipse.rse.internal.ui.logging.LoggingPreferencePage;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-
-/**
- * The logging preference page for Remote Systems.
- */
-public class SystemLoggingPreferencePage extends LoggingPreferencePage {
-
- /**
- * @see org.eclipse.rse.logging.LoggingPreferencePage#getPlugin()
- */
- protected AbstractUIPlugin getPlugin() {
- return RSEUIPlugin.getDefault();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemPreferenceInitializer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemPreferenceInitializer.java
deleted file mode 100644
index 758f83155..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemPreferenceInitializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class initializes the preferences for this plugin.
- */
-public class SystemPreferenceInitializer extends AbstractPreferenceInitializer {
-
- /**
- * Constructor.
- */
- public SystemPreferenceInitializer() {
- super();
- }
-
- /**
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences() {
- RSEUIPlugin.getDefault().initializeDefaultPreferences();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewProfilePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewProfilePropertyPage.java
deleted file mode 100644
index e80cb7465..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewProfilePropertyPage.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-
-/**
- * The property page for profile nodes in the Team view.
- * This is an output-only page.
- */
-public class SystemTeamViewProfilePropertyPage extends SystemBasePropertyPage
-{
-
- protected Label labelType, labelName, labelStatus;
- protected String errorMessage;
- protected boolean initDone = false;
-
- /**
- * Constructor for SystemFilterPropertyPage
- */
- public SystemTeamViewProfilePropertyPage()
- {
- super();
- }
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
-
- // Type prompt
- labelType = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL, SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP);
- labelType.setText(SystemViewResources.RESID_PROPERTY_PROFILE_TYPE_VALUE);
-
- // Name prompt
- labelName = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL, SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP);
-
- // Status prompt
- labelStatus = createLabeledLabel(composite_prompts, SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL, SystemViewResources.RESID_PROPERTY_PROFILESTATUS_TOOLTIP);
-
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- }
- /**
- * From parent: do full page validation
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Get the input team view category node
- */
- protected ISystemProfile getProfile()
- {
- Object element = getElement();
- return ((ISystemProfile)element);
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISystemProfile profile = getProfile();
- // populate GUI...
- labelName.setText(profile.getName());
- boolean active = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName());
- if (active)
- labelStatus.setText(SystemViewResources.RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL);
- else
- labelStatus.setText(SystemViewResources.RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL);
-
- }
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk()
- {
- boolean ok = true;
- return ok;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java
deleted file mode 100644
index 6a2641579..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.propertypages;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.propertypages.SystemBasePropertyPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-
-/**
- * The property page for subsystem factory nodes in the Team view.
- * This is an output-only page.
- */
-public class SystemTeamViewSubSystemConfigurationPropertyPage extends SystemBasePropertyPage
-{
-
- protected Label labelType, labelName, labelId, labelVendor, labelTypes;
- protected String errorMessage;
- protected boolean initDone = false;
-
- /**
- * Constructor for SystemFilterPropertyPage
- */
- public SystemTeamViewSubSystemConfigurationPropertyPage()
- {
- super();
- }
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // Type prompt
- labelType = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL, SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP);
- labelType.setText(SystemViewResources.RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE);
-
- // Name prompt
- labelName = createLabeledLabel(composite_prompts, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL, SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP);
-
- // Id prompt
- labelId = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_ID_LABEL, SystemResources.RESID_PP_SUBSYSFACTORY_ID_TOOLTIP);
-
- // Vendor prompt
- labelVendor = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_VENDOR_LABEL, SystemResources.RESID_PP_SUBSYSFACTORY_VENDOR_TOOLTIP);
-
- // System Types prompt
- labelTypes = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_TYPES_LABEL, SystemResources.RESID_PP_SUBSYSFACTORY_TYPES_TOOLTIP);
-
- // description
- addFillerLine(composite_prompts, nbrColumns);
- addSeparatorLine(composite_prompts, nbrColumns);
- SystemWidgetHelpers.createVerbiage(composite_prompts, SystemResources.RESID_PP_SUBSYSFACTORY_VERBIAGE, nbrColumns, false, 200);
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- }
-
- /**
- * From parent: do full page validation
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Get the input team view subsystem factory node
- */
- protected ISubSystemConfiguration getSubSystemConfiguration()
- {
- Object element = getElement();
- SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode)element;
- return ssfNode.getSubSystemConfiguration();
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISubSystemConfiguration ssf = getSubSystemConfiguration();
- ISubSystemConfigurationProxy proxy = ssf.getSubSystemConfigurationProxy();
- // populate GUI...
- labelName.setText(ssf.getName());
- labelId.setText(proxy.getId());
- labelVendor.setText(proxy.getVendor());
- String systypes = ""; //$NON-NLS-1$
- if (ssf.getSubSystemConfigurationProxy().supportsAllSystemTypes())
- {
- systypes = SystemResources.TERM_ALL;
- }
- else
- {
- IRSESystemType[] types = ssf.getSystemTypes();
- StringBuffer buf = new StringBuffer();
- for (int idx=0; idx<types.length; idx++)
- {
- if (idx>0)
- buf.append(", "); //$NON-NLS-1$
- buf.append(types[idx].getLabel());
- }
- systypes = buf.toString();
- }
- labelTypes.setText(systypes);
- }
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk()
- {
- boolean ok = true;
- return ok;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ContextObjectWithViewer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ContextObjectWithViewer.java
deleted file mode 100644
index 6672fbfec..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ContextObjectWithViewer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [187739] [refresh] Sub Directories are collapsed when Parent Directory is Refreshed on Remote Systems
- ********************************************************************************/
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.view.ContextObject;
-
-public class ContextObjectWithViewer extends ContextObject {
- private Viewer _viewer;
- private IRSECallback _callback;
-
- public ContextObjectWithViewer(Object modelObject, Viewer viewer){
- super(modelObject);
- _viewer = viewer;
- }
-
- public ContextObjectWithViewer(Object modelObject, ISubSystem subsystem, Viewer viewer){
- super(modelObject, subsystem);
- _viewer = viewer;
- }
-
- public ContextObjectWithViewer(Object modelObject, ISubSystem subsystem, ISystemFilterReference filterReference, Viewer viewer){
- super(modelObject, subsystem, filterReference);
- _viewer = viewer;
- }
-
- public ContextObjectWithViewer(Object modelObject, Viewer viewer, IRSECallback callback){
- super(modelObject);
- _viewer = viewer;
- _callback = callback;
- }
-
- public ContextObjectWithViewer(Object modelObject, ISubSystem subsystem, Viewer viewer, IRSECallback callback){
- super(modelObject, subsystem);
- _viewer = viewer;
- _callback = callback;
- }
-
- public ContextObjectWithViewer(Object modelObject, ISubSystem subsystem, ISystemFilterReference filterReference, Viewer viewer, IRSECallback callback){
- super(modelObject, subsystem, filterReference);
- _viewer = viewer;
- _callback = callback;
- }
-
- public Viewer getViewer()
- {
- return _viewer;
- }
-
- public IRSECallback getCallback()
- {
- return _callback;
- }
-
- public void setCallback(IRSECallback callback){
- _callback = callback;
- }
-
- public void setViewer(Viewer viewer){
- _viewer = viewer;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java
deleted file mode 100644
index 48e1c205a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ElementComparer.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Kevin Doyle (IBM) - [195537] Move ElementComparer From SystemView to Separate File
- * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
- * David Dykstal (IBM) - [225911] Exception received after deleting a profile containing a connection
- * David Dykstal (IBM) - [228774] [regression] AssertionFailedException when connecting to New Connection
- * Martin Oberhuber (Wind River) - [228774] Improve ElementComparer Performance
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.jface.viewers.IElementComparer;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.internal.core.model.SystemRegistry;
-
-/**
- * An implementation of an element comparer for the system view.
- */
-public class ElementComparer implements IElementComparer {
-
- public boolean equals(Object a, Object b) {
- // equal if same absolute name in same subsystem;
- // or, when adapters are not found, both are the same instance.
- return SystemRegistry.isSameObjectByAbsoluteName(a, null, b, null);
- }
-
- public int hashCode(Object element) {
- /*
- * Hashcodes should be invariant across the lifetime of the object.
- * Since one adapter is typically used for many elements in RSE,
- * performance would be better if the original Element's hashCode
- * were used rather than the adapter's hashCode. The problem with
- * this is, that if the remote object changes, it cannot be
- * identified any more.
- * Note that currently the hashCode of the object can change
- * over time if properties are modified (this is probably a bug).
- * Therefore, if there is no absolute name, play it safe and return the adapter's hashCode which won't ever change.
- */
- int result = 0;
- if (element != null) {
- ISystemDragDropAdapter dda = SystemRegistry.getSystemDragDropAdapter(element);
- if (dda != null) {
- // adapter available
- String absName = dda.getAbsoluteName(element);
- if (absName != null) {
- result = absName.hashCode();
- } else {
- result = dda.hashCode();
- }
- } else {
- // --MOB: Usually, we should fall back to constant hashcode 0
- // here if no adapter is available, in order to ensure constant
- // hashcode even if object properties change. But as a matter of
- // fact, those elements that we have in the SystemView and which
- // do not have an adapter registered, are very few; and they are
- // always constant over their lifetime, such as the "Pending..."
- // node for instance. We therefore return the element's hashcode
- // here, along with the corresponding equals() code above,
- // which falls back to Object equality if no adapter is
- // available.
- result = element.hashCode();
- }
- }
- return result;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ISystemMementoConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ISystemMementoConstants.java
deleted file mode 100644
index e3dcf4ff4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/ISystemMementoConstants.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-public interface ISystemMementoConstants
-{
-
- /**
- * Memento ID for profiles
- */
- public static final String MEMENTO_KEY_PROFILE = "Profile"; //$NON-NLS-1$
- /**
- * Memento ID for connections
- */
- public static final String MEMENTO_KEY_CONNECTION = "Conn"; //$NON-NLS-1$
- /**
- * Memento ID for subsystems
- */
- public static final String MEMENTO_KEY_SUBSYSTEM = "Subs"; //$NON-NLS-1$
- /**
- * Memento ID for filter pool references
- */
- public static final String MEMENTO_KEY_FILTERPOOLREFERENCE = "FPoolRef"; //$NON-NLS-1$
- /**
- * Memento ID for filter references
- */
- public static final String MEMENTO_KEY_FILTERREFERENCE = "FRef"; //$NON-NLS-1$
- /**
- * Memento ID for filter string references
- */
- public static final String MEMENTO_KEY_FILTERSTRINGREFERENCE = "FSRef"; //$NON-NLS-1$
- /**
- * Memento ID for remote objects
- */
- public static final String MEMENTO_KEY_REMOTE = "Remote"; //$NON-NLS-1$
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SafeTreeViewer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SafeTreeViewer.java
deleted file mode 100644
index c276c671c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SafeTreeViewer.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- ********************************************************************************/
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.jface.viewers.IDelayedLabelDecorator;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * The SafeTreeViewer wraps an SWT TreeViewer in order to avoid
- * exceptions due to accessing already disposed items.
- *
- * The main reason for this wrapping is that delayed label providers
- * (i.e. instances of {@link IDelayedLabelDecorator}) can trigger tree
- * item updates called in the viewer after the tree item itself got
- * disposed already. This happens especially if items appear and
- * disappear very fast within the tree which then will lead to nasty
- * SWT Widget already disposed exceptions.
- *
- * Clients may subclass this class.
- *
- * @since RSE 2.0
- */
-public class SafeTreeViewer extends TreeViewer {
-
- /**
- * Constructor.
- *
- * @param parent The parent control.
- */
- public SafeTreeViewer(Composite parent) {
- super(parent);
- }
-
- /**
- * Constructor.
- *
- * @param tree The tree control.
- */
- public SafeTreeViewer(Tree tree) {
- super(tree);
- }
-
- /**
- * Constructor.
- *
- * @param parent The parent control.
- * @param style The SWT style bits passed to the tree creation.
- */
- public SafeTreeViewer(Composite parent, int style) {
- super(parent, style);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#doUpdateItem(org.eclipse.swt.widgets.Item, java.lang.Object)
- */
- protected void doUpdateItem(Item item, Object element) {
- if (item != null && item.isDisposed()) return;
- super.doUpdateItem(item, element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.AbstractTreeViewer#doUpdateItem(org.eclipse.swt.widgets.Widget, java.lang.Object, boolean)
- */
- protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
- if (widget != null && widget.isDisposed()) return;
- super.doUpdateItem(widget, element, fullMap);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#getItemCount(org.eclipse.swt.widgets.Control)
- */
- protected int getItemCount(Control widget) {
- if (widget != null && widget.isDisposed()) return 0;
- return super.getItemCount(widget);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#getItemCount(org.eclipse.swt.widgets.Item)
- */
- protected int getItemCount(Item item) {
- if (item != null && item.isDisposed()) return 0;
- return super.getItemCount(item);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#showItem(org.eclipse.swt.widgets.Item)
- */
- protected void showItem(Item item) {
- if (item != null && item.isDisposed()) return;
- super.showItem(item);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#updatePlus(org.eclipse.swt.widgets.Item, java.lang.Object)
- */
- protected void updatePlus(Item item, Object element) {
- if (item != null && item.isDisposed()) return;
- super.updatePlus(item, element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#createChildren(org.eclipse.swt.widgets.Widget)
- */
- protected void createChildren(Widget widget) {
- if (widget != null && widget.isDisposed()) return;
- super.createChildren(widget);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#getChild(org.eclipse.swt.widgets.Widget, int)
- */
- protected Item getChild(Widget widget, int index) {
- if (widget != null && widget.isDisposed()) return null;
- return super.getChild(widget, index);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#getChildren(org.eclipse.swt.widgets.Widget)
- */
- protected Item[] getChildren(Widget widget) {
- if (widget != null && widget.isDisposed()) return new Item[0];
- return super.getChildren(widget);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#getExpanded(org.eclipse.swt.widgets.Item)
- */
- protected boolean getExpanded(Item item) {
- if (item != null && item.isDisposed()) return false;
- return super.getExpanded(item);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#getItems(org.eclipse.swt.widgets.Item)
- */
- protected Item[] getItems(Item item) {
- if (item != null && item.isDisposed()) return new Item[0];
- return super.getItems(item);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.TreeViewer#getParentItem(org.eclipse.swt.widgets.Item)
- */
- protected Item getParentItem(Item item) {
- if (item != null && item.isDisposed()) return null;
- return super.getParentItem(item);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SubSystemConfigurationAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SubSystemConfigurationAdapterFactory.java
deleted file mode 100644
index e78215033..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SubSystemConfigurationAdapterFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
-
-
-public class SubSystemConfigurationAdapterFactory implements IAdapterFactory
-{
-
- private ISubSystemConfigurationAdapter ssFactoryAdapter = new SubSystemConfigurationAdapter();
-
- /**
- * @see IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList()
- {
- return new Class[] {ISubSystemConfigurationAdapter.class};
- }
- /**
- * Called by our plugin's startup method to register our adaptable object types
- * with the platform. We prefer to do it here to isolate/encapsulate all factory
- * logic in this one place.
- */
- public void registerWithManager(IAdapterManager manager)
- {
- manager.registerAdapters(this, ISubSystemConfiguration.class);
- }
- /**
- * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- Object adapter = null;
- if (adaptableObject instanceof ISubSystemConfiguration)
- adapter = ssFactoryAdapter;
-
- return adapter;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxCellEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxCellEditor.java
deleted file mode 100644
index 6d35e73a4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxCellEditor.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * A slight variation of the Eclipse-supplied ComboBoxCellEditor class, which
- * allows the input array to be changed dynamically.
- * <p>
- * A cell editor that presents a list of items in a combo box. The cell editor's
- * value is the zero-based index of the selected item.
- * </p>
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class SystemComboBoxCellEditor extends CellEditor
-{
- private boolean readOnly = false;
- /**
- * The list of items to present in the combo box.
- */
- private String[] items;
-
- /**
- * The zero-based index of the selected item.
- */
- private int selection;
-
- /**
- * The custom combo box control.
- */
- private CCombo comboBox;
- /**
- * Creates a new cell editor with a combo containing the given
- * list of choices and parented under the given control. The cell
- * editor value is the zero-based index of the selected item.
- * Initially, the cell editor has no cell validator and
- * the first item in the list is selected.
- *
- * @param parent the parent control
- * @param items the list of strings for the combo box
- */
- public SystemComboBoxCellEditor(Composite parent, String[] items)
- {
- super(parent);
- selection = 0;
- if (items != null)
- setItems(items);
- else
- setValueValid(true);
- }
- /**
- * Creates a new cell editor with a combo containing the given
- * list of choices and parented under the given control. The cell
- * editor value is the zero-based index of the selected item.
- * Initially, the cell editor has no cell validator and
- * the first item in the list is selected.
- *
- * @param parent the parent control
- * //@param whether or not this is readonly
- */
- //public SystemComboBoxCellEditor(Composite parent, boolean readOnly)
- public SystemComboBoxCellEditor(Composite parent)
- {
- super(parent);
- selection = 0;
- //this.readOnly = readOnly;
- setValueValid(true);
- }
- /**
- * Change the input items
- */
- public void setItems(String[] items)
- {
- this.items = items;
- populateComboBoxItems();
- setValueValid(true);
- }
- /* (non-Javadoc)
- * Method declared on CellEditor.
- */
- protected Control createControl(Composite parent)
- {
- if (!readOnly)
- comboBox = new CCombo(parent, SWT.NONE);
- else
- comboBox = new CCombo(parent, SWT.READ_ONLY);
- comboBox.setFont(parent.getFont());
-
- comboBox.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- keyReleaseOccured(e);
- }
- });
-
- comboBox.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
-
- // DKM - only process this when there is a selection change
- // fix for defect 138324
- if (selection == comboBox.getSelectionIndex() && comboBox.getText().equals(comboBox.getItem(comboBox.getSelectionIndex())))
- return; // no change
-
- // must set the selection before getting value
- selection = comboBox.getSelectionIndex();
- Object newValue = doGetValue();
-
-
- boolean newValidState = isCorrect(newValue);
- if (newValidState) {
- doSetValue(newValue);
- } else {
- // try to insert the current value into the error message.
- setErrorMessage(
- NLS.bind(getErrorMessage(), items[selection]));
- }
- fireApplyEditorValue();
- }
- });
-
- comboBox.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- return comboBox;
- }
- /**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method returns
- * the zero-based index of the current selection.
- *
- * @return the zero-based index of the current selection wrapped
- * as an <code>Integer</code>
- */
- protected Object doGetValue()
- {
- return new Integer(selection);
- }
- /* (non-Javadoc)
- * Method declared on CellEditor.
- */
- protected void doSetFocus()
- {
- comboBox.setFocus();
- }
- /**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method
- * accepts a zero-based index of a selection.
- *
- * @param value the zero-based index of the selection wrapped
- * as an <code>Integer</code>
- */
- protected void doSetValue(Object value)
- {
- if (!(value instanceof Integer))
- {
- String[] items = comboBox.getItems();
- for (int i = 0; i < items.length; i++)
- {
- String item = items[i];
- if (item.equals(value))
- {
- selection = i;
- }
- }
- return;
- }
-
- //Assert.isTrue(comboBox != null && (value instanceof Integer));
- int newselection = ((Integer) value).intValue();
- if (newselection != selection)
- {
- selection = newselection;
- }
- String curText = comboBox.getText();
- if (!comboBox.getItem(selection).equals(curText))
- {
- comboBox.select(selection);
- }
- }
- /**
- * Add the items to the combo box.
- */
- private void populateComboBoxItems()
- {
- if (comboBox != null && items != null)
- {
- comboBox.removeAll();
- for (int i = 0; i < items.length; i++)
- comboBox.add(items[i], i);
- setValueValid(true);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxPropertyDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxPropertyDescriptor.java
deleted file mode 100644
index e849c9158..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemComboBoxPropertyDescriptor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-/**
- * A variation of the Eclipse-supplied ComboBoxPropertyDescriptor for
- * displaying properties are a list. This list will be different for each
- * selected object, hence we need the ability to change that list as each
- * object is selected.
- */
-public class SystemComboBoxPropertyDescriptor
- extends PropertyDescriptor
-{
- private SystemComboBoxCellEditor editor;
-
- /**
- * The list of possible values to display in the combo box
- */
- protected String[] values;
- /**
- * Creates an property descriptor with the given id, display name, and list
- * of value labels to display in the combo box cell editor.
- *
- * @param id the id of the property
- * @param displayName the name to display for the property
- * @param valuesArray the list of possible values to display in the combo box
- */
- public SystemComboBoxPropertyDescriptor(Object id, String displayName, String[] valuesArray)
- {
- super(id, displayName);
- values = valuesArray;
- }
- /**
- * Creates an property descriptor with the given id, display name, but no list.
- * You must call setValues.
- *
- * @param id the id of the property
- * @param displayName the name to display for the property
- */
- public SystemComboBoxPropertyDescriptor(Object id, String displayName)
- {
- super(id, displayName);
- }
- /**
- * The <code>ComboBoxPropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method creates and returns a new
- * <code>ComboBoxCellEditor</code>.
- * <p>
- * The editor is configured with the current validator if there is one.
- * </p>
- */
- public CellEditor createPropertyEditor(Composite parent)
- {
- //editor = new SystemComboBoxCellEditor(parent, false); // last parm = readonly
- editor = new SystemComboBoxCellEditor(parent);
- editor.setItems(values);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
- }
- /**
- * Set the values to display in the list.
- */
- public void setValues(String[] values)
- {
- this.values = values;
- if (editor != null)
- editor.setItems(values);
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java
deleted file mode 100644
index 0acd6e9ad..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java
+++ /dev/null
@@ -1,874 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * Rupen Mardirossian (IBM) - [187713] Check to see if target is null before attempting to retrieve targetAdapter in tranferRSEResources method (line 248)
- * Martin Oberhuber (Wind River) - [200682] Fix drag&drop for elements just adaptable to IResource, like CDT elements
- * David McKnight (IBM) - [186363] get rid of obsolete calls to SubSystem.connect()
- * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- * David McKnight (IBM) - [228587] [dnd] NPE From Refresh on Copy/Paste
- * David McKnight (IBM) - [232889] Dragging and dropping files from a remote unix system to a local project does not work
- * David McKnight (IBM) - [234721] [dnd] When dragging a file from windows file explorer into RSE, a refresh error is given.
- * David McKnight (IBM) - [248922] [dnd] Remote to local overwrite copy does not work
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.ISystemResourceSet;
-import org.eclipse.rse.core.model.SystemRemoteResourceSet;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.internal.ui.GenericMessages;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.internal.model.SystemScratchpad;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.undo.CopyResourcesOperation;
-import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
-import org.eclipse.ui.progress.UIJob;
-
-
-/**
- * Runnable to perform actual transfer operation.
- *
- */
-public class SystemDNDTransferRunnable extends WorkspaceJob
-{
-
- public static final int SRC_TYPE_RSE_RESOURCE = 0;
- public static final int SRC_TYPE_ECLIPSE_RESOURCE = 1;
- public static final int SRC_TYPE_OS_RESOURCE = 2;
- public static final int SRC_TYPE_TEXT = 3;
- public static final int SRC_TYPE_UNKNOWN = 4;
-
- private List _srcObjects;
- private List _resultSrcObjects;
- private List _resultTgtObjects;
- private List _setList;
-
-
- private Object _currentTarget;
- private int _sourceType;
- private Viewer _originatingViewer;
- private boolean _ok;
- private Shell _shell;
-
- public SystemDNDTransferRunnable(Object target, ArrayList srcObjects, Viewer originatingViewer, int sourceType)
- {
- super(GenericMessages.TransferOperation_message);
- _srcObjects = srcObjects;
- _currentTarget = target;
- _sourceType = sourceType;
- _originatingViewer = originatingViewer;
- _resultSrcObjects = new ArrayList(_srcObjects.size());
- _resultTgtObjects = new ArrayList();
- _setList = new ArrayList();
- this.setUser(true);
- _shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- }
-
- protected SystemRemoteResourceSet getSetFor(ISubSystem subSystem, ISystemDragDropAdapter adapter)
- {
- for (int i = 0; i < _setList.size(); i++)
- {
- SystemRemoteResourceSet set = (SystemRemoteResourceSet)_setList.get(i);
- if (set.getAdapter() == adapter && set.getSubSystem() == subSystem)
- {
- return set;
- }
- }
-
- // no existing set - create one
- SystemRemoteResourceSet newSet = new SystemRemoteResourceSet(subSystem, adapter);
- _setList.add(newSet);
- return newSet;
- }
-
- protected boolean transferRSEResources(Object target, ISubSystem targetSubSystem, ISystemDragDropAdapter targetAdapter, IProgressMonitor monitor)
- {
-
-
- // transfer local artificts and categorize remote objects
- for (int i = 0; i < _srcObjects.size() && _ok; i++)
- {
- Object srcObject = _srcObjects.get(i);
- _resultSrcObjects.add(srcObject);
-
- if (srcObject instanceof SystemMessage)
- {
- operationFailed(monitor);
- showErrorMessage((SystemMessage) srcObject);
- return _ok;
- }
- else if (srcObject != null)
- {
- ISystemDragDropAdapter srcAdapter = (ISystemDragDropAdapter) ((IAdaptable) srcObject).getAdapter(ISystemDragDropAdapter.class);
-
- if (srcAdapter != null)
- {
- if (srcObject instanceof IHost)
- {
- Object tempObject = srcAdapter.doDrag(srcObject, false, monitor);
- if (targetAdapter.validateDrop(tempObject, target, false))
- {
- targetAdapter.doDrop(tempObject, target, false, false, _sourceType, monitor);
- _resultTgtObjects.add(tempObject);
- }
- }
- else
- {
- ISubSystem srcSubSystem = srcAdapter.getSubSystem(srcObject);
- if (srcSubSystem.isConnected() ||
- srcObject instanceof ISystemFilterReference ||
- srcObject instanceof ISubSystem)
- {
- SystemRemoteResourceSet set = getSetFor(srcSubSystem, srcAdapter);
- set.addResource(srcObject);
- }
- }
- }
- }
- }
-
- String targetPath = targetAdapter.getAbsoluteName(target);
- boolean sameSubSystemType = true;
- String targetType = ""; //$NON-NLS-1$
- if (targetSubSystem != null)
- {
- targetType = targetSubSystem.getName();
- }
-
- // now we have things divided into sets
- // transfer 1 set at a time
- for (int s = 0; s < _setList.size(); s++)
- {
- SystemRemoteResourceSet set = (SystemRemoteResourceSet)_setList.get(s);
-
-
-
-
- ISubSystem srcSubSystem = set.getSubSystem();
- ISystemDragDropAdapter srcAdapter = set.getAdapter();
-
- String srcType = srcSubSystem.getName();
- sameSubSystemType = targetType.equals(srcType);
-
- if (!sameSubSystemType && targetSubSystem != null)
- {
- ISystemResourceSet tempObjects = srcAdapter.doDrag(set, monitor);
-
- if (tempObjects == null)
- {
- // drag failed
- operationFailed(monitor);
- showInvalidTransferMessage(set, targetPath);
- }
- else if (tempObjects.hasMessage())
- {
- operationFailed(monitor);
- showErrorMessage(tempObjects.getMessage());
- }
- else
- {
- if (targetAdapter.validateDrop(tempObjects, target, (targetSubSystem == srcSubSystem)))
- {
- // special case for filters
- if (target instanceof ISystemFilterReference)
- {
- ISubSystemConfiguration factory = targetSubSystem.getSubSystemConfiguration();
- if (factory.supportsDropInFilters())
- {
- target = targetSubSystem.getTargetForFilter((ISystemFilterReference)target);
- targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
- }
- }
-
-
- ISystemResourceSet droppedObjects = targetAdapter.doDrop(tempObjects, target, sameSubSystemType, (targetSubSystem == srcSubSystem), _sourceType, monitor);
- if (droppedObjects == null)
- {
- operationFailed(monitor);
- }
- else if (droppedObjects.hasMessage())
- {
- //Even the droppedObject has message, it could still has
- //dropped results. (user cancels the operation, but some objects
- //has already been copied.
- //Need to make sure we refresh those copied object.
- List results = droppedObjects.getResourceSet();
- for (int d = 0; d < results.size(); d++)
- {
- _resultTgtObjects.add(results.get(d));
- }
- operationFailed(monitor);
- showErrorMessage(droppedObjects.getMessage());
- }
- else
- {
- List results = droppedObjects.getResourceSet();
- for (int d = 0; d < results.size(); d++)
- {
- _resultTgtObjects.add(results.get(d));
- }
- }
- }
- else
- {
- // invalid drop
- operationFailed(monitor);
- showInvalidTransferMessage(set, targetPath);
- }
- }
- }
- else
- {
- // special case for filters
- if (target instanceof ISystemFilterReference && targetSubSystem != null)
- {
- ISubSystemConfiguration factory = targetSubSystem.getSubSystemConfiguration();
- if (factory.supportsDropInFilters())
- {
- target = targetSubSystem.getTargetForFilter((ISystemFilterReference)target);
- if (target == null)
- {
- return false;
- }
- else
- {
- targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
- }
- }
- }
- if (targetAdapter.validateDrop(set, target, (targetSubSystem == srcSubSystem)))
- {
-
- ISystemResourceSet droppedObjects = targetAdapter.doDrop(set, target, sameSubSystemType, (targetSubSystem == srcSubSystem), _sourceType, monitor);
- if (droppedObjects == null)
- {
- operationFailed(monitor);
- }
- else if (droppedObjects.hasMessage())
- {
- operationFailed(monitor);
- showErrorMessage(droppedObjects.getMessage());
- }
- else
- {
- List results = droppedObjects.getResourceSet();
- for (int d = 0; d < results.size(); d++)
- {
- _resultTgtObjects.add(results.get(d));
- }
- }
- }
- else
- {
- // invalid drop
- operationFailed(monitor);
- showInvalidTransferMessage(set, targetPath);
- }
- }
- }
-
- return _ok;
- }
-
- protected boolean transferRSEResourcesToEclipseResource(IResource target, ISubSystem targetSubSystem, IProgressMonitor monitor)
- {
- boolean alwaysOverwrite = false;
-
- List resourcesToCopy = new ArrayList();
- IWorkspaceRoot root = target.getWorkspace().getRoot();
- for (int i = 0; i < _srcObjects.size() && _ok; i++)
- {
- Object srcObject = _srcObjects.get(i);
-
- _resultSrcObjects.add(srcObject);
-
- if (srcObject instanceof SystemMessage)
- {
- operationFailed(monitor);
- showErrorMessage((SystemMessage) srcObject);
- }
- else if (srcObject != null)
- {
- // find all the files to copy and check that they don't exist first
- ISystemDragDropAdapter srcAdapter = (ISystemDragDropAdapter) ((IAdaptable) srcObject).getAdapter(ISystemDragDropAdapter.class);
- Object tempFile = srcAdapter.doDrag(srcObject, true, monitor);
- if (tempFile instanceof IResource)
- {
- boolean canCopy = true;
- IResource res = (IResource)tempFile;
- try
- {
- IPath destPath = target.getFullPath();
- destPath = destPath.append(res.getName());
-
- IResource newResource = root.findMember(destPath);
-
- // check for existing files
- if (!alwaysOverwrite){
- if (newResource != null && newResource.exists()){
- int result = checkOverwrite(res, newResource);
- if (result != IDialogConstants.OK_ID){
- canCopy = false;
- if (result == IDialogConstants.CANCEL_ID){
- // cancel the whole operation
- monitor.setCanceled(true);
- return false;
- }
-
- _resultSrcObjects.remove(srcObject);
- }
- }
- }
-
- // add to the list of files to copy
- if (canCopy){
- resourcesToCopy.add(res);
- }
- }
- catch (Exception e)
- {
- operationFailed(monitor);
- SystemBasePlugin.logError(e.getMessage(), e);
- }
- }
- }
- }
-
- // now doing the actual copy
- if (!resourcesToCopy.isEmpty()) {
- IResource[] resources = (IResource[])resourcesToCopy.toArray(new IResource[resourcesToCopy.size()]);
- IPath destinationPath = target.getFullPath();
- CopyResourcesOperation op = new CopyResourcesOperation(resources, destinationPath,
- SystemResources.RESID_COPY_TITLE);
-
-
- IAdaptable adaptable = WorkspaceUndoUtil.getUIInfoAdapter(_shell);
- try {
- PlatformUI.getWorkbench().getOperationSupport()
- .getOperationHistory().execute(op, monitor,adaptable);
- } catch (ExecutionException e) {
- SystemMessage errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_OCCURRED);
- if (e.getCause() instanceof CoreException) {
- SystemBasePlugin.logError(e.getMessage(), e);
- errorMessage.makeSubstitution(e.getCause().getMessage());
- } else {
- SystemBasePlugin.logError(e.getMessage(), e);
- errorMessage.makeSubstitution(e.getMessage());
- }
-
- showErrorMessage(errorMessage);
- operationFailed(monitor);
- return false;
- }
- }
-
- return true;
- }
-
-
- private int checkOverwrite(final IResource source, final IResource destination) {
- final int[] result = new int[1]; // using array since you can't change a final int
-
- Runnable query = new Runnable() {
- public void run() {
- int resultId[] = {
- IDialogConstants.OK_ID,
- IDialogConstants.CANCEL_ID };
-
- String labels[] = new String[] {
- IDialogConstants.OK_LABEL,
- IDialogConstants.CANCEL_LABEL };
-
- String title = SystemResources.RESID_COLLISION_RENAME_TITLE;
- String correctedVerbiage = SystemResources.RESID_COLLISION_RENAME_VERBIAGE.replaceAll("&1" , "{0}"); //$NON-NLS-1$//$NON-NLS-2$
- String msg = NLS.bind(correctedVerbiage, destination.getFullPath().makeRelative());
-
- MessageDialog dialog = new MessageDialog(
- PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- title,
- null, msg, MessageDialog.QUESTION, labels, 0);
- dialog.open();
- if (dialog.getReturnCode() == SWT.DEFAULT) {
- // A window close returns SWT.DEFAULT - mapped to a cancel
- result[0] = IDialogConstants.CANCEL_ID;
- } else {
- result[0] = resultId[dialog.getReturnCode()];
- }
- }
- };
-
- PlatformUI.getWorkbench().getDisplay().syncExec(query);
- return result[0];
- }
-
- protected boolean transferNonRSEResources(Object target, ISubSystem targetSubSystem, ISystemDragDropAdapter targetAdapter, IProgressMonitor monitor)
- {
-
- for (int i = 0; i < _srcObjects.size() && _ok; i++)
- {
- Object srcObject = _srcObjects.get(i);
-
- _resultSrcObjects.add(srcObject);
-
- if (srcObject instanceof SystemMessage)
- {
- operationFailed(monitor);
- showErrorMessage((SystemMessage) srcObject);
- }
- else if (srcObject != null)
- {
-
-
- // special case for filters
- if (target instanceof ISystemFilterReference && targetSubSystem != null)
- {
-
- ISubSystemConfiguration factory = targetSubSystem.getSubSystemConfiguration();
- if (factory.supportsDropInFilters() && factory.providesCustomDropInFilters())
- {
- ((ISystemFilterReference)target).markStale(true);
-
- target = targetSubSystem.getTargetForFilter((ISystemFilterReference)target);
- targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- }
- }
-
- if (_sourceType == SRC_TYPE_ECLIPSE_RESOURCE)
- {
- // Eclipse resource transfer
- IResource resource = null;
- if (srcObject instanceof IResource) {
- resource = (IResource) srcObject;
- } else if (srcObject instanceof IAdaptable) {
- resource = (IResource)((IAdaptable)srcObject).getAdapter(IResource.class);
- } else {
- resource = (IResource)Platform.getAdapterManager().getAdapter(srcObject, IResource.class);
- }
- if (resource!=null) {
- Object droppedObject = targetAdapter.doDrop(resource, target, false, false, _sourceType, monitor);
- if (droppedObject == null)
- operationFailed(monitor);
- else
- _resultTgtObjects.add(droppedObject);
- }
- }
- else if (_sourceType == SRC_TYPE_OS_RESOURCE)
- {
- if (srcObject instanceof String)
- {
- // non-Eclipse file transfer
- String file = (String) srcObject;
-
- Object droppedObject = targetAdapter.doDrop(file, target, false, false, _sourceType, monitor);
- if (droppedObject == null)
- operationFailed(monitor);
- else
- _resultTgtObjects.add(droppedObject);
- }
- }
- else if (_sourceType == SRC_TYPE_TEXT)
- {
- if (srcObject instanceof String)
- {
- String text = (String) srcObject;
- Object droppedObject = targetAdapter.doDrop(text, target, false, false, _sourceType, monitor);
- if (droppedObject == null)
- operationFailed(monitor);
- else
- _resultTgtObjects.add(droppedObject);
- }
- }
- else if (_sourceType == SRC_TYPE_RSE_RESOURCE)
- {
- ISystemDragDropAdapter srcAdapter = (ISystemDragDropAdapter) ((IAdaptable) srcObject).getAdapter(ISystemDragDropAdapter.class);
-
- if (srcAdapter != null)
- {
- if (srcObject instanceof IHost)
- {
- Object tempObject = srcAdapter.doDrag(srcObject, false, monitor);
- if (targetAdapter.validateDrop(tempObject, target, false))
- {
- targetAdapter.doDrop(tempObject, target, false, false, _sourceType, monitor);
- _resultTgtObjects.add(tempObject);
- }
- }
- else
- {
- ISubSystem srcSubSystem = srcAdapter.getSubSystem(srcObject);
-
- if (srcSubSystem.isConnected() ||
- srcObject instanceof ISystemFilterReference ||
- srcObject instanceof ISubSystem)
- {
- String srcType = srcSubSystem.getName();
- String srcPath = srcAdapter.getAbsoluteName(srcObject);
- String targetPath = targetAdapter.getAbsoluteName(target);
- boolean sameSubSystemType = true;
- if (targetSubSystem != null)
- {
- String targetType = targetSubSystem.getName();
- sameSubSystemType = targetType.equals(srcType);
- }
-
- if (!sameSubSystemType)
- {
- Object tempObject = srcAdapter.doDrag(srcObject, sameSubSystemType, monitor);
- if (tempObject == null)
- {
- // drag failed
- operationFailed(monitor);
- showInvalidTransferMessage(srcPath, targetPath);
- }
- else if (tempObject instanceof SystemMessage)
- {
- operationFailed(monitor);
- showErrorMessage((SystemMessage) tempObject);
- }
- else
- {
-
- if (targetAdapter.validateDrop(tempObject, target, (targetSubSystem == srcSubSystem)))
- {
- // special case for filters
- if (target instanceof ISystemFilterReference && targetSubSystem != null)
- {
- ISubSystemConfiguration factory = targetSubSystem.getSubSystemConfiguration();
- if (factory.supportsDropInFilters() && factory.providesCustomDropInFilters())
- {
- target = targetSubSystem.getTargetForFilter((ISystemFilterReference)target);
- targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- }
- }
-
- Object droppedObject = targetAdapter.doDrop(tempObject, target, sameSubSystemType, (targetSubSystem == srcSubSystem), _sourceType, monitor);
- if (droppedObject == null)
- {
- operationFailed(monitor);
- }
- else if (droppedObject instanceof SystemMessage)
- {
- operationFailed(monitor);
- showErrorMessage((SystemMessage) droppedObject);
- }
- else
- _resultTgtObjects.add(droppedObject);
- }
- else
- {
- // invalid drop
- operationFailed(monitor);
- showInvalidTransferMessage(srcPath, targetPath);
- }
- }
- }
- else if (srcObject != target && !srcPath.equals(targetPath))
- {
- // special case for filters
-
- if (target instanceof ISystemFilterReference && targetSubSystem != null)
- {
- ISubSystemConfiguration factory = targetSubSystem.getSubSystemConfiguration();
- if (factory.supportsDropInFilters() && factory.providesCustomDropInFilters())
- {
- target = targetSubSystem.getTargetForFilter((ISystemFilterReference)target);
- targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- }
- }
- if (targetAdapter.validateDrop(srcObject, target, (targetSubSystem == srcSubSystem)))
- {
-
- Object droppedObject = targetAdapter.doDrop(srcObject, target, sameSubSystemType, (targetSubSystem == srcSubSystem), _sourceType, monitor);
- if (droppedObject == null)
- {
- operationFailed(monitor);
- }
- else if (droppedObject instanceof SystemMessage)
- {
- operationFailed(monitor);
- showErrorMessage((SystemMessage) droppedObject);
- }
- else
- _resultTgtObjects.add(droppedObject);
- }
- else
- {
- // invalid drop
- operationFailed(monitor);
- showInvalidTransferMessage(srcPath, targetPath);
- }
- }
- else
- {
- // can't drop src onto itself
- // invalid drop
- operationFailed(monitor);
- showInvalidTransferMessage(srcPath, targetPath);
- }
- }
- }
- }
- }
- }
- if (monitor != null && monitor.isCanceled())
- {
- _ok = false;
- return _ok;
- }
- }
-
-
- return true;
- }
-
- public IStatus runInWorkspace(IProgressMonitor monitor)
- {
-
- _ok = true;
-
- Object target = _currentTarget;
- ISubSystem targetSubSystem = null;
- //boolean expandFolder = false;
-
-
- if (target instanceof IAdaptable)
- {
- ISystemDragDropAdapter targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- // checking for IResource since we already handle them specially
- if (targetAdapter != null && !(target instanceof IResource))
- {
- targetSubSystem = targetAdapter.getSubSystem(target);
-
- if (targetSubSystem != null && !targetSubSystem.isConnected())
- {
- try
- {
- targetSubSystem.connect(monitor, false);
- }
- catch (Exception e)
- {
- }
- }
-
- SystemMessage copyMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYGENERIC_PROGRESS);
- if (monitor != null)
- monitor.beginTask(copyMessage.getLevelOneText(), IProgressMonitor.UNKNOWN);
-
- if (_sourceType == SRC_TYPE_RSE_RESOURCE)
- {
- transferRSEResources(target, targetSubSystem, targetAdapter, monitor);
- }
- else
- {
- transferNonRSEResources(target, targetSubSystem, targetAdapter, monitor);
- }
- }
- else if (target instanceof IResource)
- {
- transferRSEResourcesToEclipseResource((IResource)target, targetSubSystem, monitor);
- }
- }
-
- // fire refresh for target
- if (_ok && monitor != null) // I added this test: phil
- {
- monitor.done();
- }
-
-
- if (target != null && target instanceof ISystemContainer)
- {
- ((ISystemContainer)target).markStale(true);
- }
-
- RefreshJob refresh = new RefreshJob(target, targetSubSystem);
- refresh.schedule();
- return Status.OK_STATUS;
- }
-
- public class RefreshJob extends UIJob
- {
- private Object _target;
- private ISubSystem _targetSubSystem;
- public RefreshJob(Object target, ISubSystem targetSubSystem)
- {
- super("Refresh"); //$NON-NLS-1$
- _target = target;
- _targetSubSystem = targetSubSystem;
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor)
- {
- String[] oldNames = new String[_resultSrcObjects.size()];
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- if (_resultTgtObjects.size() > 0)
- {
- boolean doRefresh = _ok;
-
- for (int t = 0; t < _resultTgtObjects.size() && t < _resultSrcObjects.size(); t++)
- {
- Object tgt = _resultTgtObjects.get(t);
- Object src = _resultSrcObjects.get(t);
- if (tgt == src || tgt == null)
- {
- doRefresh = false;
- }
- else
- {
- doRefresh = true;
- }
- ISystemDragDropAdapter adapter = null;
- if (src instanceof IAdaptable) {
- adapter = (ISystemDragDropAdapter)((IAdaptable)src).getAdapter(ISystemDragDropAdapter.class);
- }
- else {
- adapter = (ISystemDragDropAdapter)Platform.getAdapterManager().getAdapter(src, ISystemDragDropAdapter.class);
- }
-
- if (adapter != null){
- oldNames[t] = adapter.getAbsoluteName(src);
- }
- else if (src instanceof IResource){ // could be an eclipse resource
- oldNames[t] = ((IResource)src).getFullPath().toOSString();
- }
- else if (src instanceof String){ // local os resource
- oldNames[t] = (String)src;
- }
- else {
- oldNames[t] = ""; // source resource unknown //$NON-NLS-1$
- }
- }
-
- if (_originatingViewer instanceof TreeViewer)
- {
- try
- {
- TreeViewer viewer = (TreeViewer) _originatingViewer;
- viewer.setExpandedState(_target, true);
- }
- catch (Exception e)
- {
-
- }
- }
-
- if (doRefresh)
- {
- String operation = ISystemRemoteChangeEvents.SYSTEM_REMOTE_OPERATION_COPY;
- registry.fireRemoteResourceChangeEvent(operation, ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED, _resultTgtObjects, _target, _targetSubSystem, oldNames, _originatingViewer);
- }
- else if (_target instanceof SystemScratchpad)
- {
- registry.fireEvent(new SystemResourceChangeEvent(_resultTgtObjects, ISystemResourceChangeEvents.EVENT_ADD_MANY, _target));
- }
- }
-
- return Status.OK_STATUS;
- }
- }
-
- private void operationFailed(IProgressMonitor monitor)
- {
-
- _ok = false;
- if (monitor != null)
- monitor.done();
- }
-
- private void showInvalidTransferMessage(String srcPath, String targetPath)
- {
- SystemMessage errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_TRANSFER_INVALID);
- errorMessage.makeSubstitution(srcPath, targetPath);
- showErrorMessage(errorMessage);
- }
-
- private void showInvalidTransferMessage(ISystemResourceSet resourceSet, String targetPath)
- {
- SystemMessage errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_TRANSFER_INVALID);
- errorMessage.makeSubstitution(resourceSet.toString(), targetPath);
- showErrorMessage(errorMessage);
- }
-
- private void showErrorMessage(SystemMessage errorMessage)
- {
- Display.getDefault().asyncExec(new ShowErrorRunnable(errorMessage));
- }
-
- public class ShowErrorRunnable implements Runnable
- {
- SystemMessage _errorMessage;
- public ShowErrorRunnable(SystemMessage errorMessage)
- {
- _errorMessage = errorMessage;
- }
-
- public void run()
- {
- Shell shell = SystemBasePlugin.getActiveWorkbenchShell();
- SystemMessageDialog dlg = new SystemMessageDialog(shell, _errorMessage);
- dlg.open();
- }
-
- }
-
- public boolean dropOkay()
- {
- return _ok;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDecoratingLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDecoratingLabelProvider.java
deleted file mode 100644
index 9d9eda810..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDecoratingLabelProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author mjberger
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class SystemDecoratingLabelProvider extends DecoratingLabelProvider implements ITableLabelProvider
-{
- private ITableLabelProvider _tableLabelProvider;
-
- public SystemDecoratingLabelProvider(ITableLabelProvider provider, ILabelDecorator decorator) {
- super((ILabelProvider)provider, decorator);
- // TODO Auto-generated constructor stub
- _tableLabelProvider = provider;
- }
-
-
- public Image getColumnImage(Object element, int columnIndex)
- {
- if (columnIndex == 0) //TODO: Make this more generic
- {
- return getImage(element);
- }
- return _tableLabelProvider.getColumnImage(element, columnIndex);
- }
-
- public String getColumnText(Object element, int columnIndex)
- {
- if (columnIndex == 0) //TODO: Make this more generic
- {
- return getText(element);
- }
- return _tableLabelProvider.getColumnText(element, columnIndex);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDeferredTableTreeContentManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDeferredTableTreeContentManager.java
deleted file mode 100644
index cdb4cc0be..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDeferredTableTreeContentManager.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed the initial implementation:
- * David McKnight.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.ui.operations.SystemDeferredTreeContentManager;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-public class SystemDeferredTableTreeContentManager extends
- SystemDeferredTreeContentManager {
-
- private SystemTableTreeViewProvider _provider;
- private SystemTableTreeView _view;
- public SystemDeferredTableTreeContentManager(SystemTableTreeViewProvider provider, SystemTableTreeView viewer) {
- super(provider, viewer);
- _provider = provider;
- _view = viewer;
- }
-
-
- protected void addChildren(Object parent, Object[] children, IProgressMonitor monitor) {
- super.addChildren(parent, children, monitor);
-
- _provider.setCachedObjects(parent, children);
- IPropertyDescriptor[] descriptors = _view.getUniqueDescriptors();
- if (descriptors == null)
- {
- Display.getDefault().asyncExec(new RelayoutView(parent));
- }
- }
-
- /**
- * Return the IDeferredWorkbenchAdapter for element or the element if it is
- * an instance of IDeferredWorkbenchAdapter. If it does not exist return
- * null.
- *
- * @param element
- * @return IDeferredWorkbenchAdapter or <code>null</code>
- */
- protected IDeferredWorkbenchAdapter getAdapter(Object element)
- {
-
- if (element instanceof IContextObject)
- {
- element = ((IContextObject)element).getModelObject();
- }
- return super.getAdapter(element);
- }
-
-
- public class RelayoutView implements Runnable
- {
- public RelayoutView(Object parent)
- {
- }
-
- public void run()
- {
- _view.computeLayout();
- _view.refresh(true);
- //SystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- //registry.fireEvent(new SystemResourceChangeEvent(_parent, ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE, _parent));
- }
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDropActionDelegate.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDropActionDelegate.java
deleted file mode 100644
index c0a3b2ca0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDropActionDelegate.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.part.IDropActionDelegate;
-
-
-
-/**
- * This class is used for dropping RSE src objects on known non-RSE targets
- *
- */
-public class SystemDropActionDelegate implements IDropActionDelegate
-{
-
- public static final String ID = "org.eclipse.rse.ui.view.DropActions"; //ID fixed, by Phil //$NON-NLS-1$
-
-
- /** (non-Javadoc)
- * Method declared on IDropActionDelegate
- */
- public boolean run(Object data, Object target)
- {
- String localPath = null;
- IResource resource = null;
-
- if (target instanceof IProjectNature)
- {
- target = ((IProjectNature)target).getProject();
- }
-
- if (target instanceof IResource)
- {
- resource = (IResource) target;
- localPath = resource.getLocation().toOSString();
- }
- else if (target instanceof String)
- {
- localPath = (String)target;
- }
- else if (target instanceof IAdaptable)
- {
- target = ((IAdaptable)target).getAdapter(IResource.class);
- if (target != null && target instanceof IResource)
- {
- resource = (IResource)target;
- localPath = resource.getLocation().toOSString();
- }
- }
-
-
- if (localPath != null)
- {
-
- if (data instanceof byte[])
- {
- byte[] result = (byte[]) data;
-
- // get the sources
- //StringTokenizer tokenizer = new StringTokenizer(new String(result), SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
- String[] tokens = (new String(result)).split("\\"+SystemViewDataDropAdapter.RESOURCE_SEPARATOR); //$NON-NLS-1$
- ArrayList srcObjects = new ArrayList();
-
- //while (tokenizer.hasMoreTokens())
- for (int i = 0; i <tokens.length; i++)
- {
- String srcStr = tokens[i];
-
- Object srcObject = getObjectFor(srcStr);
- srcObjects.add(srcObject);
- }
-
- SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(target, srcObjects, null, SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE);
-
- runnable.schedule();
-
- if (resource != null)
- {
- try
- {
- resource.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- catch (CoreException e)
- {
- }
- }
- RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
- }
-
- /** FIXME - IREmoteFile is systems.core independent now
- IRemoteFileSubSystem localFS = getLocalFileSubSystem();
- try
- {
- IRemoteFile rsfTarget = localFS.getRemoteFileObject(localPath);
-
- if (data instanceof byte[])
- {
- byte[] result = (byte[]) data;
-
- // get the sources
- //StringTokenizer tokenizer = new StringTokenizer(new String(result), SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
- String[] tokens = (new String(result)).split("\\"+SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
- ArrayList srcObjects = new ArrayList();
- ArrayList rulesList = new ArrayList();
- int j = 0;
- //while (tokenizer.hasMoreTokens())
- for (int i = 0; i <tokens.length; i++)
- {
- String srcStr = tokens[i];
-
- Object srcObject = getObjectFor(srcStr);
- srcObjects.add(srcObject);
- if (srcObject instanceof ISchedulingRule)
- {
- rulesList.add(srcObject);
- j++;
- }
- else if (srcObject instanceof IRemoteFile)
- {
- rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)srcObject));
- j++;
- }
- }
- if (resource != null)
- {
- rulesList.add(resource);
- j++;
- }
-
- ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]);
- MultiRule rule = null;
- if (j > 0)
- {
- rule = new MultiRule(rules);
- }
-
- Viewer currentViewer = null; // todo: figure out how to determine the current viewer! Phil
- SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(rsfTarget, srcObjects, currentViewer, SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE);
-
- runnable.setRule(rule);
-
- runnable.schedule();
-
- if (resource != null)
- {
- try
- {
- resource.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- catch (CoreException e)
- {
- }
- }
- RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
- }
- }
- catch (SystemMessageException e)
- {
- }
- **/
- return true;
- }
-
- return false;
- }
- /**
- * Method for decoding an source object ID to the actual source object.
- * We determine the profile, connection and subsystem, and then
- * we use the SubSystem.getObjectWithKey() method to get at the
- * object.
- *
- */
- private Object getObjectFor(String str)
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- // first extract subsystem id
- int connectionDelim = str.indexOf(":"); //$NON-NLS-1$
- if (connectionDelim == -1) // not subsystem, therefore likely to be a connection
- {
- int profileDelim = str.indexOf("."); //$NON-NLS-1$
- if (profileDelim != -1)
- {
- String profileId = str.substring(0, profileDelim);
- String connectionId = str.substring(profileDelim + 1, str.length());
- ISystemProfile profile = registry.getSystemProfile(profileId);
- return registry.getHost(profile, connectionId);
- }
- }
-
-
- int subsystemDelim = str.indexOf(":", connectionDelim + 1); //$NON-NLS-1$
- if (subsystemDelim == -1) // not remote object, therefore likely to be a subsystem
- {
- return registry.getSubSystem(str);
- }
- else
- {
- String subSystemId = str.substring(0, subsystemDelim);
- String srcKey = str.substring(subsystemDelim + 1, str.length());
-
-
- ISubSystem subSystem = registry.getSubSystem(subSystemId);
- if (subSystem != null)
- {
- Object result = null;
- try
- {
- result = subSystem.getObjectWithAbsoluteName(srcKey);
- }
- catch (SystemMessageException e)
- {
- return e.getSystemMessage();
- }
- catch (Exception e)
- {
- }
- if (result != null)
- {
- return result;
- }
- else
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_FILE_NOTFOUND);
- msg.makeSubstitution(srcKey, subSystem.getHostAliasName());
- return msg;
- }
- }
- else
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_CONNECTION_NOTFOUND);
- msg.makeSubstitution(subSystemId);
- return msg;
- }
- }
- }
-
- protected IRunnableContext getRunnableContext(Shell shell)
- {
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc != null)
- {
- return irc;
- }
-
- irc = new ProgressMonitorDialog(shell);
- RSEUIPlugin.getTheSystemRegistryUI().setRunnableContext(shell, irc);
- return irc;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemEmptyListAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemEmptyListAPIProviderImpl.java
deleted file mode 100644
index 076c5ad93..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemEmptyListAPIProviderImpl.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is a special-case provider when we want the list to be empty.
- */
-public class SystemEmptyListAPIProviderImpl
- extends SystemAbstractAPIProvider
-{
-
-
- /**
- * Constructor
- */
- public SystemEmptyListAPIProviderImpl()
- {
- super();
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- * <p>We return an empty list.
- */
- public Object[] getSystemViewRoots()
- {
- return emptyList;
- }
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- * We return false.
- */
- public boolean hasSystemViewRoots()
- {
- return false;
- }
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- * <p>We return an empty list
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- return emptyList; //
- }
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- * <p>we return false
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return false;
- }
-
-
- // ----------------------------------
- // OUR OWN METHODS...
- // ----------------------------------
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritablePropertyData.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritablePropertyData.java
deleted file mode 100644
index 2453553da..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritablePropertyData.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-/**
- * This class captures the data needed to populate a
- * InheritableTextCellEditor.
- */
-public class SystemInheritablePropertyData
-{
- private String localValue=""; //$NON-NLS-1$
- private String inheritedValue=""; //$NON-NLS-1$
- private boolean isLocal;
- private boolean notApplicable = false;
-
- private String inheritedXlatedString;
-
- public SystemInheritablePropertyData()
- {
- super();
- setInheritedDisplayString(SystemPropertyResources.RESID_PROPERTY_INHERITED);
- }
-
- /**
- * Identify this value as "not applicable". This causes
- * this string to be displayed, and prevents users from editing this property.
- */
- public void setNotApplicable(boolean set)
- {
- notApplicable = set;
- }
- /**
- * Get the notApplicable flag. Default is false.
- */
- public boolean getNotApplicable()
- {
- return notApplicable;
- }
-
- /**
- * Gets the localValue
- * @return Returns a String
- */
- public String getLocalValue()
- {
- return localValue;
- }
- /**
- * Sets the localValue
- * @param localValue The localValue to set
- */
- public void setLocalValue(String localValue)
- {
- if (localValue == null)
- localValue = ""; // to prevent equals() from crashing //$NON-NLS-1$
- this.localValue = localValue;
- }
-
- /**
- * Gets the inheritedValue
- * @return Returns a String
- */
- public String getInheritedValue()
- {
- return inheritedValue;
- }
- /**
- * Sets the inheritedValue
- * @param inheritedValue The inheritedValue to set
- */
- public void setInheritedValue(String inheritedValue)
- {
- if (inheritedValue == null)
- inheritedValue = ""; // to prevent equals() from crashing //$NON-NLS-1$
- this.inheritedValue = inheritedValue;
- }
-
-
- /**
- * Gets the isLocal
- * @return Returns a boolean
- */
- public boolean getIsLocal()
- {
- return isLocal;
- }
- /**
- * Sets the isLocal
- * @param isLocal The isLocal to set
- */
- public void setIsLocal(boolean isLocal)
- {
- this.isLocal = isLocal;
- }
-
- /**
- * Set the string to append to the inherited value in display-only mode
- */
- public void setInheritedDisplayString(String s)
- {
- inheritedXlatedString = s;
- }
-
- /**
- * Convert to string for readonly-property sheet value
- */
- public String toString()
- {
- if (notApplicable)
- return SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
- String value = null;
- if (isLocal)
- value = localValue;
- else
- //value = " (*INHERITED)";
- value = inheritedValue + " " + inheritedXlatedString; //$NON-NLS-1$
- return value;
- }
-
- /**
- * The property sheet viewer will decide to call the adapter back when Enter is pressed,
- * only if the result of calling equals() on the previous and current versions of this
- * object returns false. If we did not have this method, they'd always return true.
- */
- public boolean equals(Object other)
- {
- if (other instanceof SystemInheritablePropertyData)
- {
- SystemInheritablePropertyData otherData = (SystemInheritablePropertyData)other;
- boolean equal =
- ((isLocal == otherData.getIsLocal()) &&
- (localValue.equals(otherData.getLocalValue())) &&
- (inheritedValue.equals(otherData.getInheritedValue())) );
- /*
- System.out.println("inside equals. Result? " + equal + " Local value: " + localValue);
- if (!equal)
- {
- System.out.println("... isLocal.......: " + isLocal + " vs " + otherData.getIsLocal());
- System.out.println("... localValue....: '" + localValue + "' vs '" + otherData.getLocalValue() + "'");
- System.out.println("... inheritedValue: '" + inheritedValue + "' vs " + otherData.getInheritedValue() + "'");
- }
- */
- return equal;
- }
- else
- return super.equals(other);
- }
-
- /**
- * For debugging
- */
- public void printDetails()
- {
- System.out.println("SystemInheritablePropertyData: "); //$NON-NLS-1$
- System.out.println("...localValue = "+localValue); //$NON-NLS-1$
- System.out.println("...inheritedValue = "+inheritedValue); //$NON-NLS-1$
- System.out.println("...isLocal = "+isLocal); //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextCellEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextCellEditor.java
deleted file mode 100644
index e02669709..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextCellEditor.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.ui.widgets.InheritableEntryField;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * A cell editor that manages an inheritable text entry field.
- * The cell editor's value is the text string itself.
- */
-public class SystemInheritableTextCellEditor
- //extends DialogCellEditor
- extends CellEditor
- implements SelectionListener
-{
- protected InheritableEntryField textField;
- protected Text text;
- protected SystemInheritablePropertyData data;
- private String toggleButtonToolTipText, entryFieldToolTipText;
-
- private ModifyListener modifyListener;
-
- /**
- * State information for updating action enablement
- */
- private boolean isSelection = false;
- private boolean isDeleteable = false;
- private boolean isSelectable = false;
-
- /**
- * Creates a new text string cell editor parented under the given control.
- * The cell editor value is the string itself, which is initially the empty string.
- * Initially, the cell editor has no cell validator.
- *
- * @param parent the parent control
- */
- public SystemInheritableTextCellEditor(Composite parent)
- {
- super(parent);
- }
- /**
- * Checks to see if the "deleteable" state (can delete/
- * nothing to delete) has changed and if so fire an
- * enablement changed notification.
- */
- private void checkDeleteable()
- {
- boolean oldIsDeleteable = isDeleteable;
- isDeleteable = isDeleteEnabled();
- if (oldIsDeleteable != isDeleteable)
- {
- fireEnablementChanged(DELETE);
- }
- }
-
-
- /**
- * Checks to see if the "selectable" state (can select)
- * has changed and if so fire an enablement changed notification.
- */
- private void checkSelectable()
- {
- boolean oldIsSelectable = isSelectable;
- isSelectable = isSelectAllEnabled();
- if (oldIsSelectable != isSelectable)
- {
- fireEnablementChanged(SELECT_ALL);
- }
- }
- /**
- * Checks to see if the selection state (selection /
- * no selection) has changed and if so fire an
- * enablement changed notification.
- */
- private void checkSelection()
- {
- boolean oldIsSelection = isSelection;
- isSelection = getTextField().getSelectionCount() > 0;
- if (oldIsSelection != isSelection)
- {
- fireEnablementChanged(COPY);
- fireEnablementChanged(CUT);
- }
- }
- /**
- * Return the entry field of the composite control
- */
- private Text getTextField()
- {
- return textField.getTextField();
- }
-
- public InheritableEntryField getInheritableEntryField()
- {
- return textField;
- }
-
- /**
- * Gets the toggleButtonToolTipText
- * @return Returns a String
- */
- public String getToggleButtonToolTipText()
- {
- return toggleButtonToolTipText;
- }
- /**
- * Sets the toggleButtonToolTipText
- * @param toggleButtonToolTipText The toggleButtonToolTipText to set
- */
- public void setToggleButtonToolTipText(String toggleButtonToolTipText)
- {
- this.toggleButtonToolTipText = toggleButtonToolTipText;
- if (textField != null)
- textField.setToggleToolTipText(toggleButtonToolTipText);
- }
-
- /**
- * Gets the entryFieldToolTipText
- * @return Returns a String
- */
- public String getEntryFieldToolTipText()
- {
- return entryFieldToolTipText;
- }
- /**
- * Sets the entryFieldToolTipText
- * @param entryFieldToolTipText The entryFieldToolTipText to set
- */
- public void setEntryFieldToolTipText(String entryFieldToolTipText)
- {
- this.entryFieldToolTipText = entryFieldToolTipText;
- if (textField != null)
- textField.setTextFieldToolTipText(entryFieldToolTipText);
- }
-
- /* (non-Javadoc)
- * Method declared on CellEditor.
- */
- protected Control createControl(Composite parent)
- {
- // specify no borders on text widget as cell outline in
- // table already provides the look of a border.
- textField = new InheritableEntryField(parent, SWT.NULL, SWT.BORDER, SWT.SINGLE);
- textField.setToggleButtonHeight(14);
- textField.setBackground(parent.getBackground());
- textField.addSelectionListener(this);
- if (toggleButtonToolTipText != null)
- textField.setToggleToolTipText(toggleButtonToolTipText);
- if (entryFieldToolTipText != null)
- textField.setTextFieldToolTipText(entryFieldToolTipText);
- text = getTextField();
- text.addKeyListener(new KeyAdapter()
- {
- public void keyPressed(KeyEvent e)
- {
- // The call to inherited keyReleaseOccurred is what causes the apply
- // event if the key pressed is Enter.
- keyReleaseOccured(e);
- // as a result of processing the above call, clients may have
- // disposed this cell editor
- if ((getControl() == null) || getControl().isDisposed())
- return;
- checkSelection(); // see explaination below
- checkDeleteable();
- checkSelectable();
- }
- });
- text.addTraverseListener(new TraverseListener()
- {
- public void keyTraversed(TraverseEvent e)
- {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN)
- {
- e.doit = false;
- }
- }
- });
- // We really want a selection listener but it is not supported so we
- // use a key listener and a mouse listener to know when selection changes
- // may have occured
- text.addMouseListener(new MouseAdapter()
- {
- public void mouseUp(MouseEvent e) {
- checkSelection();
- checkDeleteable();
- checkSelectable();
- }
- });
- text.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- }
-
- public void focusLost(FocusEvent e) {
- SystemInheritableTextCellEditor.this.focusLost();
- }
- });
- textField.getToggleButton().addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- SystemInheritableTextCellEditor.this.focusLost();
- }
-
- public void focusGained(FocusEvent e) {
- }
- });
-
- text.setFont(parent.getFont());
- //text.setBackground(parent.getBackground());
- text.setText("");//$NON-NLS-1$
- text.addModifyListener(getModifyListener());
- setValueValid(true);
- return textField;
- }
-
- protected void focusLost()
- {
- super.focusLost();
- }
-
- /**
- * Return current data.
- *
- * @return the SystemInheritablePropertyData data object
- */
- protected Object doGetValue()
- {
- SystemInheritablePropertyData outputData = new SystemInheritablePropertyData();
- outputData.setIsLocal(textField.isLocal());
- outputData.setLocalValue(textField.getLocalText());
- outputData.setInheritedValue(textField.getInheritedText());
- return outputData;
- }
-
-
- /* (non-Javadoc)
- * Method declared on CellEditor.
- */
- protected void doSetFocus()
- {
- if (text != null)
- {
- if (text.isEnabled())
- {
- text.selectAll();
- text.setFocus();
- }
- else
- {
- textField.setToggleButtonFocus();
- }
-
- checkSelection();
- checkDeleteable();
- checkSelectable();
- }
- }
- /**
- * The <code>TextCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method accepts
- * a SystemInheritablePropertyData data object.
- *
- * @param value a SystemInheritablePropertyData object
- */
- protected void doSetValue(Object value)
- {
- Assert.isTrue(text != null && (value instanceof SystemInheritablePropertyData));
- textField.removeModifyListener(getModifyListener());
- data = (SystemInheritablePropertyData)value;
- textField.setLocalText(data.getLocalValue());
- textField.setInheritedText(data.getInheritedValue());
- textField.setLocal(data.getIsLocal());
- textField.addModifyListener(getModifyListener());
- }
- /**
- * Processes a modify event that occurred in this text cell editor.
- * This framework method performs validation and sets the error message
- * accordingly, and then reports a change via <code>fireEditorValueChanged</code>.
- * Subclasses should call this method at appropriate times. Subclasses
- * may extend or reimplement.
- *
- * @param e the SWT modify event
- */
- protected void editOccured(ModifyEvent e)
- {
- String value = text.getText();
- if (value == null)
- value = ""; //$NON-NLS-1$
- Object typedValue = value;
- boolean oldValidState = isValueValid();
- boolean newValidState = isCorrect(typedValue);
- if (!newValidState)
- {
- // try to insert the current value into the error message.
- setErrorMessage(NLS.bind(getErrorMessage(), value));
- }
- valueChanged(oldValidState, newValidState);
- }
- /**
- * Since a text editor field is scrollable we don't
- * set a minimumSize.
- */
- public LayoutData getLayoutData()
- {
- return new LayoutData();
- }
- /**
- * Return the modify listener.
- */
- private ModifyListener getModifyListener()
- {
- if (modifyListener == null)
- {
- modifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e)
- {
- editOccured(e);
- }
- };
- }
- return modifyListener;
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method returns <code>true</code> if
- * the current selection is not empty.
- */
- public boolean isCopyEnabled()
- {
- if (text == null || text.isDisposed() || !text.isEnabled())
- return false;
- return text.getSelectionCount() > 0;
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method returns <code>true</code> if
- * the current selection is not empty.
- */
- public boolean isCutEnabled()
- {
- if (text == null || text.isDisposed() || !text.isEnabled())
- return false;
- return text.getSelectionCount() > 0;
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method returns <code>true</code>
- * if there is a selection or if the caret is not positioned
- * at the end of the text.
- */
- public boolean isDeleteEnabled()
- {
- if (text == null || text.isDisposed() || !text.isEnabled())
- return false;
- return text.getSelectionCount() > 0 || text.getCaretPosition() < text.getCharCount();
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method always returns <code>true</code>.
- */
- public boolean isPasteEnabled()
- {
- if (text == null || text.isDisposed() || !text.isEnabled())
- return false;
- return true;
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method always returns <code>true</code>.
- */
- public boolean isSaveAllEnabled()
- {
- if (text == null || text.isDisposed() || !text.isEnabled())
- return false;
- return true;
- }
- /**
- * Returns <code>true</code> if this cell editor is
- * able to perform the select all action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if select all is possible,
- * <code>false</code> otherwise
- */
- public boolean isSelectAllEnabled()
- {
- if (text == null || text.isDisposed() || !text.isEnabled())
- return false;
- return text.getText().length() > 0;
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method copies the
- * current selection to the clipboard.
- */
- public void performCopy()
- {
- text.copy();
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method cuts the
- * current selection to the clipboard.
- */
- public void performCut()
- {
- text.cut();
- checkSelection();
- checkDeleteable();
- checkSelectable();
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method deletes the
- * current selection or, if there is no selection,
- * the character next character from the current position.
- */
- public void performDelete()
- {
- if (text.getSelectionCount() > 0)
- // remove the contents of the current selection
- text.insert(""); //$NON-NLS-1$
- else
- {
- // remove the next character
- int pos = text.getCaretPosition();
- if (pos < text.getCharCount())
- {
- text.setSelection(pos, pos + 1);
- text.insert(""); //$NON-NLS-1$
- }
- }
- checkSelection();
- checkDeleteable();
- checkSelectable();
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method pastes the
- * the clipboard contents over the current selection.
- */
- public void performPaste()
- {
- text.paste();
- checkSelection();
- checkDeleteable();
- checkSelectable();
- }
- /**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method selects all of the
- * current text.
- */
- public void performSelectAll()
- {
- text.selectAll();
- checkSelection();
- checkDeleteable();
- }
-
- // Selection Listener methods for InheritableTextCellEditor toggle switches
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
- public void widgetSelected(SelectionEvent e)
- {
- //System.out.println("Got widget selected event. isLocal() = " + textField.isLocal()+", text='"+textField.getText()+"'");
- boolean isLocal = textField.isLocal();
- String value = text.getText();
- data.setIsLocal(isLocal);
- boolean oldValidState = isValueValid();
- boolean newValidState = isLocal?isCorrect(value):true; //isCorrect(typedValue);
- if (!newValidState)
- {
- // try to insert the current value into the error message.
- setErrorMessage(NLS.bind(getErrorMessage(), value));
- }
- valueChanged(oldValidState, newValidState);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextPropertyDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextPropertyDescriptor.java
deleted file mode 100644
index 55ef23897..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemInheritableTextPropertyDescriptor.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-/**
- * A variation of the Eclipse-supplied TextPropertyDescriptor for
- * displaying text string properties that are inheritable.
- */
-public class SystemInheritableTextPropertyDescriptor
- extends PropertyDescriptor
-{
- private SystemInheritableTextCellEditor editor;
- private String toggleButtonToolTipText, entryFieldToolTipText;
- private boolean editable = true;
-
- /**
- * Creates a property descriptor with the given id, display name
- *
- * @param id the id of the property
- * @param displayName the name to display for the property
- */
- public SystemInheritableTextPropertyDescriptor(Object id, String displayName)
- {
- super(id, displayName);
- }
- /**
- * Call this with false in special circumstances to user's disable ability to edit this value.
- * Default is true
- * @see #getEditable()
- */
- public void setEditable(boolean allow)
- {
- editable = allow;
- }
- /**
- * Query the allow-editing value. Default is true.
- */
- public boolean getEditable()
- {
- return editable;
- }
-
- /**
- * Return an instance of SystemInheritableTextCellEditor, unless
- * our editable property is false, in which case we return null;
- */
- public CellEditor createPropertyEditor(Composite parent)
- {
- if (!editable)
- return null;
- editor = new SystemInheritableTextCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- if (toggleButtonToolTipText != null)
- editor.setToggleButtonToolTipText(toggleButtonToolTipText);
- if (entryFieldToolTipText != null)
- editor.setEntryFieldToolTipText(entryFieldToolTipText);
- return editor;
- }
-
-
- /**
- * Gets the toggleButtonToolTipText
- * @return Returns a String
- */
- public String getToggleButtonToolTipText()
- {
- return toggleButtonToolTipText;
- }
- /**
- * Sets the toggleButtonToolTipText
- * @param toggleButtonToolTipText The toggleButtonToolTipText to set
- */
- public void setToggleButtonToolTipText(String toggleButtonToolTipText)
- {
- this.toggleButtonToolTipText = toggleButtonToolTipText;
- }
-
- /**
- * Gets the entryFieldToolTipText
- * @return Returns a String
- */
- public String getEntryFieldToolTipText()
- {
- return entryFieldToolTipText;
- }
- /**
- * Sets the entryFieldToolTipText
- * @param entryFieldToolTipText The entryFieldToolTipText to set
- */
- public void setEntryFieldToolTipText(String entryFieldToolTipText)
- {
- this.entryFieldToolTipText = entryFieldToolTipText;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveHelpers.java
deleted file mode 100644
index 5c3b52f8e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveHelpers.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
-
-
-/**
- * @author coulthar
- *
- * Helper methods related to finding and switching perspectives, views and
- * so on.
- */
-public class SystemPerspectiveHelpers
-{
-
- // constants
- /**
- * The ID of the RSE perspective
- */
- public static String RSE_PERSP_ID = SystemPerspectiveLayout.ID;
-
-
- /**
- * Opens the RSE perspective, if not already, in the current window
- */
- public static boolean openRSEPerspective()
- {
- return openInNewPage(RSE_PERSP_ID);
- }
- /**
- * Tests if the RSE perspective is the active perspective
- */
- public static boolean isRSEPerspectiveActive()
- {
- IPerspectiveDescriptor activePersp = getActivePerspective();
- if ((activePersp!=null) && activePersp.getId().equals(RSE_PERSP_ID))
- return true;
- else
- return false;
- }
- /**
- * Opens a new page with a particular perspective, given the perspective's ID
- * @return true if was open or successfully opened/focused. False if anything went wrong
- */
- public static boolean openInNewPage(String perspID)
- {
- boolean ok = false;
- IPerspectiveDescriptor persp = getActivePerspective();
- if (persp == null)
- return ok;
- if (persp.getId().equals(perspID))
- return true;
- // If the perspective is already open, then reuse it.
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage[] pages = window.getPages();
- for (int i = 0; i < pages.length; i++)
- {
- persp = pages[i].getPerspective();
- if (persp != null && persp.getId().equals(perspID))
- {
- window.setActivePage(pages[i]);
- return true;
- }
- }
- // Open the page.
- try {
- //window.openPage(perspID, ResourcesPlugin.getWorkspace().getRoot()); OPENS A NEW WINDOW!!
- window.getWorkbench().showPerspective(perspID, window);
- ok = true;
- } catch (WorkbenchException e) {
- SystemBasePlugin.logError("Error opening perspective "+perspID, e); //$NON-NLS-1$
- }
- return ok;
- }
- /**
- * Return the currently active perpsective in the currently active page in the
- * currently active window.
- * May return null!
- */
- public static IPerspectiveDescriptor getActivePerspective()
- {
- // get the active window
- IWorkbenchWindow window = getActiveWindow();
- if (window != null)
- {
- // get the active page
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- // get the active perspective
- return page.getPerspective();
- }
- return null;
- }
- /**
- * Return the currently active window.
- * May return null!
- */
- public static IWorkbenchWindow getActiveWindow()
- {
- // get the active window
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- }
-
- /**
- * Search for, and return, a view with the given ID, in the active perspective
- */
- public static IViewPart findView(String viewID)
- {
- IViewPart viewPart = null;
- IWorkbenchWindow window = getActiveWindow();
- if (window != null)
- {
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- viewPart= page.findView(viewID);
- } // end if window != null
- return viewPart;
- }
-
- /**
- * Return the RSE tree view in the active perspective, or null if the active
- * perspective is NOT the RSE perspective.
- */
- public static SystemView findRSEView()
- {
- IViewPart viewPart = findView(SystemViewPart.ID);
- if ((viewPart != null) && (viewPart instanceof SystemViewPart))
- return ((SystemViewPart)viewPart).getSystemView();
- else
- return null;
- }
-
- /**
- * Show the view with given ID, if not already showing in current perspective,
- * in current page, in current window.
- * @return the view part instance if found or opened successfully. Null if something went wrong
- */
- public static IViewPart showView(String viewID)
- {
- IViewPart viewPart = null;
- IWorkbenchWindow window = getActiveWindow();
- if (window != null)
- {
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- {
- try
- {
- viewPart= page.findView(viewID);
- if ( viewPart != null )
- page.bringToTop(viewPart);
- else
- {
- //IWorkbenchPart activePart= page.getActivePart(); not used? Phil
- viewPart = page.showView(viewID);
- }
- }
- catch (PartInitException pie)
- {
- SystemBasePlugin.logError("Error opening view " + viewID, pie); //$NON-NLS-1$
- }
- } //end if page != null
- } // end if window != null
- return viewPart;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveLayout.java
deleted file mode 100644
index 7a1183db0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPerspectiveLayout.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - Fix 164628: get rid of dependency to debug.ui
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-
-
-import org.eclipse.rse.internal.ui.view.scratchpad.SystemScratchpadViewPart;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPart;
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-
-/**
- * This class is responsible for laying out the views in the RSE perspective
- */
-public class SystemPerspectiveLayout implements IPerspectiveFactory
-{
-
- public static final String ID = "org.eclipse.rse.ui.view.SystemPerspective"; // matches id in plugin.xml, layout tag //$NON-NLS-1$
- /**
- * Defines the initial layout for a perspective.
- * This method is only called when a new perspective is created. If
- * an old perspective is restored from a persistence file then
- * this method is not called.
- *
- * @param layout the page layout
- */
- public void createInitialLayout(IPageLayout layout)
- {
- String editorArea = layout.getEditorArea();
-
- IFolderLayout folder= layout.createFolder("org.eclipse.rse.ui.view.NavFolder", IPageLayout.LEFT, //$NON-NLS-1$
- (float)0.25, editorArea);
- //folder.addView(IPageLayout.ID_RES_NAV);
- folder.addView(SystemViewPart.ID);
- folder.addView(SystemTeamViewPart.ID);
-
- folder= layout.createFolder("org.eclipse.rse.ui.view.MiscFolder", IPageLayout.BOTTOM, //$NON-NLS-1$
- (float).60, editorArea);
-
- folder.addView(SystemTableViewPart.ID);
- //folder.addView(SystemMonitorViewPart.ID);
- folder.addView(IPageLayout.ID_TASK_LIST); // put in the desktop-supplied task list view
-
-
- folder= layout.createFolder("org.eclipse.rse.ui.view.OutlineFolder", IPageLayout.RIGHT, //$NON-NLS-1$
- (float).80, editorArea);
-
- folder.addView(IPageLayout.ID_OUTLINE); // put in desktop-supplied outline view
- // unfortunately we can't do the following as snippets aren't in wswb, according to DKM
-
- folder= layout.createFolder("org.eclipse.rse.ui.view.PropertiesFolder", IPageLayout.BOTTOM, //$NON-NLS-1$
- (float).75, "org.eclipse.rse.ui.view.NavFolder"); //$NON-NLS-1$
- //layout.addView(IPageLayout.ID_PROP_SHEET, IPageLayout.BOTTOM,
- // (float)0.75, "org.eclipse.rse.ui.view.NavFolder"); // put in desktop-supplied property sheet view
- folder.addView(IPageLayout.ID_PROP_SHEET);
- folder.addView(SystemScratchpadViewPart.ID);
-
- // update Show View menu with our views
- layout.addShowViewShortcut(SystemViewPart.ID);
- layout.addShowViewShortcut(SystemTableViewPart.ID);
-
- layout.addShowViewShortcut(SystemTableViewPart.ID);
- layout.addShowViewShortcut(SystemViewPart.ID);
- layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
- // update Perspective Open menu with our perspective
- layout.addPerspectiveShortcut(ID);
-
- // Add action sets to the tool bar.
- // Fix 164628: get rid of dependency to debug.ui
- //layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
- //layout.addActionSet(IDebugUIConstants.DEBUG_ACTION_SET);
- layout.addActionSet("org.eclipse.debug.ui.launchActionSet"); //$NON-NLS-1$
- layout.addActionSet("org.eclipse.debug.ui.debugActionSet"); //$NON-NLS-1$
-
-
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPropertySheetForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPropertySheetForm.java
deleted file mode 100644
index 952a26fb3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemPropertySheetForm.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-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.Shell;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-
-
-
-/**
- * This re-usable widget is for a property-sheet widget that is imbeddable in dialogs.
- * It is similar to the workbench property sheet but there are some important differences.
- */
-public class SystemPropertySheetForm extends Composite
-{
-
- private PropertySheetPage tree = null;
- private boolean enabledMode = true;
- //private ISystemViewInputProvider inputProvider = null;
- //private ISystemViewInputProvider emptyProvider = new SystemEmptyListAPIProviderImpl();
- public static final int DEFAULT_WIDTH = 300;
- public static final int DEFAULT_HEIGHT = 250;
-
- /**
- * Constructor
- * @param shell The owning window
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically SWT.NULL
- * @param msgLine where to show messages and tooltip text
- */
- public SystemPropertySheetForm(Shell shell, Composite parent, int style, ISystemMessageLine msgLine)
- {
- this(shell, parent, style, msgLine, 1, 1);
- }
- /**
- * Constructor when you want to span more than one column or row
- * @param shell The owning window
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically SWT.NULL
- * @param horizontalSpan how many columns in parent composite to span
- * @param verticalSpan how many rows in parent composite to span
- * @param msgLine where to show messages and tooltip text
- */
- public SystemPropertySheetForm(Shell shell, Composite parent, int style, ISystemMessageLine msgLine, int horizontalSpan, int verticalSpan)
- {
- super(parent, style);
- prepareComposite(1, horizontalSpan, verticalSpan);
- createPropertySheetView(shell);
- addOurSelectionListener();
- addOurMouseListener();
- addOurKeyListener();
- }
-
- /**
- * Return the system view tree viewer
- */
- public PropertySheetPage getPropertySheetView()
- {
- return tree;
- }
- /**
- * Return the underlying control
- */
- public Control getControl()
- {
- return tree.getControl();
- }
-
- /**
- * Set the tree's tooltip text
- */
- public void setToolTipText(String tip)
- {
- tree.getControl().setToolTipText(tip);
- }
- /**
- * Refresh contents
- */
- public void refresh()
- {
- tree.refresh();
- }
-
- /**
- * Method declared on ISelectionListener.
- */
- public void selectionChanged(ISelection selection)
- {
- tree.selectionChanged(null, selection);
- }
-
- /**
- * Disable/Enable all the child controls.
- */
- public void setEnabled(boolean enabled)
- {
- enabledMode = enabled;
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
- /**
- * Prepares this composite control and sets the default layout data.
- * @param Number of columns the new group will contain.
- */
- protected Composite prepareComposite(int numColumns,
- int horizontalSpan, int verticalSpan)
- {
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.widthHint = DEFAULT_WIDTH;
- data.heightHint = DEFAULT_HEIGHT;
- data.horizontalSpan = horizontalSpan;
- data.verticalSpan = verticalSpan;
- composite.setLayoutData(data);
- return composite;
- }
-
- protected void createPropertySheetView(Shell shell)
- {
- tree = new PropertySheetPage();
- tree.createControl(this);
- Control c = tree.getControl();
- GridData treeData = new GridData();
- treeData.horizontalAlignment = GridData.FILL;
- treeData.verticalAlignment = GridData.FILL;
- treeData.grabExcessHorizontalSpace = true;
- treeData.grabExcessVerticalSpace = true;
- treeData.widthHint = 220;
- treeData.heightHint= 200;
- c.setLayoutData(treeData);
- //tree.setShowActions(showActions);
-
- }
-
-
- protected void addOurSelectionListener()
- {
- // Add the button listener
-/* SelectionListener selectionListener = new SelectionListener()
- {
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
- public void widgetSelected(SelectionEvent event)
- {
- if (!enabledMode)
- return;
- }
- };*/
- //tree.getControl().addSelectionListener(selectionListener);
- }
-
- protected void addOurMouseListener()
- {
- MouseListener mouseListener = new MouseAdapter()
- {
- public void mouseDown(MouseEvent e)
- {
- if (!enabledMode)
- return;
- //requestActivation();
- }
- };
- tree.getControl().addMouseListener(mouseListener);
- }
-
- protected void addOurKeyListener()
- {
- KeyListener keyListener = new KeyAdapter()
- {
- public void keyPressed(KeyEvent e)
- {
- if (!enabledMode)
- {
- //e.doit = false;
- return;
- }
- //handleKeyPressed(e);
- }
- };
- tree.getControl().addKeyListener(keyListener);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResolveFilterStringAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResolveFilterStringAPIProviderImpl.java
deleted file mode 100644
index 23b08dffe..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResolveFilterStringAPIProviderImpl.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is used when the contents are used to show the resolution of a single filter string.
- */
-public class SystemResolveFilterStringAPIProviderImpl extends SystemTestFilterStringAPIProviderImpl
-{
-
-
-
- /**
- * Constructor
- * @param subsystem The subsystem that will resolve the filter string
- * @param filterString The filter string to test
- */
- public SystemResolveFilterStringAPIProviderImpl(ISubSystem subsystem, String filterString)
- {
- super(subsystem, filterString);
- } // end constructor
-
-
-} // end class SystemResolveFilterStringAPIProviderImpl
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java
deleted file mode 100644
index b178a665e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java
+++ /dev/null
@@ -1,646 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Kevin Doyle (IBM) - Added getSystemViewForm()
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API
- * Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David Dykstal (IBM) - [232130] meaningless label provided for filter references
- * David McKnight (IBM) - [244430] [regression] Incorrect behaviour for SystemSelectRemoteFolderAction
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemResourceSelectionInputProvider;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.rse.ui.widgets.SystemHostCombo;
-import org.eclipse.swt.SWT;
-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.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-public class SystemResourceSelectionForm implements ISelectionChangedListener
-{
- private Shell _shell;
- private boolean _multipleSelection = true;
- protected static final int PROMPT_WIDTH = 400; // The maximum width of the dialog's prompt, in pixels.
-
- private ISystemResourceSelectionInputProvider _inputProvider;
- private SystemHostCombo _connectionCombo;
- private SystemViewForm _systemViewForm;
- private Composite _propertySheetContainer;
- private SystemPropertySheetForm _ps;
-
- private Text _pathText;
- private boolean _isValid;
- private ISystemMessageLine _msgLine;
- protected Object previousSelection = null;
- private IValidatorRemoteSelection _selectionValidator = null;
- private boolean showPropertySheet = false;
-
-
- protected Object caller;
- protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
-
- protected String _verbiage = null;
- protected Label verbiageLabel;
- private Composite _container;
-
- // history
- private HashMap _history;
-
- // outputs
- protected IHost outputConnection = null;
- protected Object[] outputObjects = null;
-
-
- public SystemResourceSelectionForm(Shell shell, Composite parent, Object caller,
- ISystemResourceSelectionInputProvider inputProvider,
- String verbiage,
- boolean multipleSelection,
- ISystemMessageLine msgLine)
- {
- _msgLine= msgLine;
- _history = new HashMap();
- _inputProvider = inputProvider;
- _multipleSelection = multipleSelection;
- _shell = shell;
- _verbiage = verbiage;
- this.caller = caller;
- callerInstanceOfWizardPage = (caller instanceof WizardPage);
- callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
-
- createControls(parent);
- }
-
- public void setMessageLine(ISystemMessageLine msgLine)
- {
- _msgLine = msgLine;
- }
-
- /**
- * Return first selected object
- */
- public Object getSelectedObject()
- {
- if ((outputObjects != null) && (outputObjects.length>=1))
- return outputObjects[0];
- else
- return null;
- }
- /**
- * Return all selected objects.
- */
- public Object[] getSelectedObjects()
- {
- return outputObjects;
- }
-
- /**
- * Return the embedded System Tree object.
- * Will be null until createControls is called.
- */
- public ISystemTree getSystemTree()
- {
- return _systemViewForm.getSystemTree();
- }
-
- public void createControls(Composite parent)
- {
- _container = SystemWidgetHelpers.createComposite(parent, showPropertySheet ? 2 : 1);
- //Composite container = new Composite(parent, SWT.NULL);
-
-
- // INNER COMPOSITE
- int gridColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createFlushComposite(_container, gridColumns);
-
- // PROPERTY SHEET COMPOSITE
- if (showPropertySheet)
- {
- createPropertySheet(_container, _shell);
- }
-
-
- // MESSAGE/VERBIAGE TEXT AT TOP
- verbiageLabel = SystemWidgetHelpers.createVerbiage(composite_prompts, _verbiage, gridColumns, false, PROMPT_WIDTH);
-
-
- boolean allowMultipleConnnections = _inputProvider.allowMultipleConnections();
- if (!allowMultipleConnnections)
- {
- //Label connectionLabel = SystemWidgetHelpers.createLabel(composite_prompts, _inputProvider.getSystemConnection().getHostName());
- }
- else
- {
- IRSESystemType[] systemTypes = _inputProvider.getSystemTypes();
- String category = _inputProvider.getCategory();
-
- if (systemTypes != null)
- {
- _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, systemTypes, _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection());
- }
- else if (category != null)
- {
- _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection(), category);
- }
- else
- {
- _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL,
- SystemWidgetHelpers.getValidSystemTypes(null),
- _inputProvider.getSystemConnection(),
- _inputProvider.allowNewConnection());
-
- }
- _connectionCombo.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent evt)
- {
- IHost connection = _connectionCombo.getHost();
- connectionChanged(connection);
- }}
- );
- _connectionCombo.listenToConnectionEvents(true);
- }
-
- _pathText = SystemWidgetHelpers.createReadonlyTextField(composite_prompts);
- _systemViewForm = new SystemViewForm(_shell, composite_prompts, SWT.NULL, _inputProvider, !_multipleSelection, _msgLine);
- _systemViewForm.addSelectionChangedListener(this);
-
-
- GridLayout layout = new GridLayout();
- GridData gdata = new GridData(GridData.FILL_BOTH);
- composite_prompts.setLayout(layout);
- composite_prompts.setLayoutData(gdata);
-
- doInitializeFields();
- }
-
- private void doInitializeFields()
- {
- setPageComplete();
- return;
- }
-
- /**
- * Create the property sheet viewer
- */
- private void createPropertySheet(Composite outerParent, Shell shell)
- {
- _propertySheetContainer = SystemWidgetHelpers.createFlushComposite(outerParent, 1);
- ((GridData)_propertySheetContainer.getLayoutData()).grabExcessVerticalSpace = true;
- ((GridData)_propertySheetContainer.getLayoutData()).verticalAlignment = GridData.FILL;
-
- // PROPERTY SHEET VIEWER
- _ps = new SystemPropertySheetForm(shell,_propertySheetContainer, SWT.BORDER, _msgLine);
- }
-
- public Control getInitialFocusControl()
- {
- return _systemViewForm.getTreeControl();
- }
-
- public void applyViewerFilter(SystemActionViewerFilter filter)
- {
- if (filter != null)
- {
- _systemViewForm.getSystemTree().addFilter(filter);
- }
- }
-
- /**
- * Completes processing of the wizard page or dialog. If this
- * method returns true, the wizard/dialog will close;
- * otherwise, it will stay active.
- *
- * @return true if no errors
- */
- public boolean verify()
- {
- if (_isValid)
- {
- if (_msgLine != null)
- {
- _msgLine.clearErrorMessage();
- }
- return true;
- }
- else
- {
- return false;
- }
- }
-
- protected ISystemViewElementAdapter getViewAdapter(Object selection)
- {
- if (selection != null && selection instanceof IAdaptable)
- {
- return (ISystemViewElementAdapter)((IAdaptable)selection).getAdapter(ISystemViewElementAdapter.class);
- }
- return null;
- }
-
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object selection)
- {
- if (selection != null && selection instanceof IAdaptable)
- {
- return SystemAdapterHelpers.getRemoteAdapter(selection);
- }
- return null;
- }
-
- protected ISystemRemoteElementAdapter[] getRemoteAdapters(ISelection selection)
- {
- Object[] selectedObjects = getSelections(selection);
- ISystemRemoteElementAdapter[] adapters = new ISystemRemoteElementAdapter[selectedObjects.length];
- for (int idx=0; idx<adapters.length; idx++)
- {
- adapters[idx] = getRemoteAdapter(selectedObjects[idx]);
- }
- return adapters;
- }
-
-
- public void connectionChanged(IHost connection)
- {
- IHost previousConnection = _inputProvider.getSystemConnection();
- if (previousConnection != connection)
- {
-
- _inputProvider.setSystemConnection(connection, false);
-
- _systemViewForm.refresh();
- Object oldSelection = _history.get(connection);
- if (oldSelection != null)
- {
- setPreSelection(oldSelection);
- }
- }
- }
-
- public void setVerbiage(String verbiage)
- {
- _verbiage = verbiage;
- }
-
- public boolean setPreSelection(Object selection)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(selection);
- if (adapter != null)
- {
- Object parent = adapter.getParent(selection);
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- ISubSystem ss = adapter.getSubSystem(selection);
- IHost connection = ss.getHost();
- if (_inputProvider.allowMultipleConnections())
- {
- if (_connectionCombo.getHost()!= connection || _inputProvider.getSystemConnection() != connection)
- {
- _connectionCombo.select(connection);
- }
- }
- List filterRefs = registry.findFilterReferencesFor(selection, ss, false);
-
- ISystemTree systemTree = _systemViewForm.getSystemTree();
- if (filterRefs.size() > 0)
- {
- ISystemFilterReference ref = (ISystemFilterReference)filterRefs.get(0);
- systemTree.expandTo(ref, selection);
-
- return true;
- }
- else
- {
- if (setPreSelection(parent))
- {
- systemTree.expandTo(parent, selection);
- return true;
- }
- }
- }
- return false;
- }
-
-
- protected void setPathText(String text)
- {
- _pathText.setText(text);
- }
-
-
- public Object[] getOutputObjects()
- {
- return outputObjects;
- }
-
- /**
- * Return selected connection
- */
- public IHost getSelectedConnection()
- {
- return outputConnection;
- }
-
- /**
- * Return first item currently selected.
- */
- protected Object getFirstSelection(ISelection selection)
- {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
- if (sSelection != null)
- {
- Iterator selectionIterator = sSelection.iterator();
- if (selectionIterator.hasNext())
- return selectionIterator.next();
- else
- return null;
- }
- return null;
- }
- /**
- * Return all items currently selected.
- */
- protected Object[] getSelections(ISelection selection)
- {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
- if (sSelection != null)
- {
- Object[] selectedObjects = new Object[sSelection.size()];
- Iterator selectionIterator = sSelection.iterator();
- int idx = 0;
- while (selectionIterator.hasNext())
- selectedObjects[idx++] = selectionIterator.next();
- return selectedObjects;
- }
- return null;
- }
-
-
- private void setPathTextFromSelection(Object selection)
- {
- String text = ""; //$NON-NLS-1$
- ISystemViewElementAdapter adapter = getViewAdapter(selection);
- if (selection instanceof ISystemFilterReference) {
- text = adapter.getText(selection);
- } else {
- text = adapter.getAbsoluteName(selection);
- }
- setPathText(text);
- }
-
- /**
- * Show or hide the property sheet. This is called after the contents are created when the user
- * toggles the Details button.
- * @param shell Use getShell() in your dialog or wizard page
- * @param contents Use getContents() in your dialog or wizard page
- * @return new state -> true if showing, false if hiding
- */
- public boolean toggleShowPropertySheet(Shell shell, Control contents)
- {
- Point windowSize = shell.getSize();
- Point oldSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (showPropertySheet) // hiding?
- {
- _ps.dispose();
-
- _propertySheetContainer.dispose();
- _ps = null;
- _propertySheetContainer = null;
- ((GridLayout)_container.getLayout()).numColumns = 1;
- }
- else // showing?
- {
- //createPropertySheet((Composite)contents, shell);
- ((GridLayout)_container.getLayout()).numColumns = 2;
- createPropertySheet(_container, shell);
- }
-
- Point newSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- shell.setSize(new Point(windowSize.x + (newSize.x - oldSize.x), windowSize.y));
-
- if (_ps != null)
- {
- ISelection s = _systemViewForm.getSelection();
- if (s != null)
- _ps.selectionChanged(s);
- }
-
- showPropertySheet = !showPropertySheet;
- return showPropertySheet;
- }
-
-
-// ---------------------------------------------------
- // METHODS FOR SELECTION CHANGED LISTENER INTERFACE...
- // ---------------------------------------------------
- /**
- * User selected something in the _systemViewForm.
- */
- public void selectionChanged(SelectionChangedEvent e)
- {
- _isValid = true;
- ISelection selection = e.getSelection();
- outputObjects = null;
- int selectionSize = ((IStructuredSelection)selection).size();
- if ((selectionSize > 1) && !_systemViewForm.sameParent())
- {
- clearErrorMessage();
-
- setPathText(""); //$NON-NLS-1$
- setPageComplete();
- return; // don't enable OK/Add if selections from different parents
- }
-
- if (_ps != null)
- _ps.selectionChanged(selection);
-
- Object selectedObject = getFirstSelection(selection);
- if (selectedObject == previousSelection && selectionSize == 1)
- {
- // DKM we null set this before, so we need to reset it
- outputObjects = getSelections(selection);
- return;
- }
- clearErrorMessage();
- setPathText(""); //$NON-NLS-1$
- setPageComplete();
-
- previousSelection = selectedObject;
- if (selectedObject != null)
- {
-
- ISystemRemoteElementAdapter remoteAdapter = getRemoteAdapter(selectedObject);
- if (remoteAdapter != null)
- {
- setPathTextFromSelection(selectedObject);
-
- outputObjects = getSelections(selection);
- outputConnection = remoteAdapter.getSubSystem(selectedObject).getHost();
-
- _history.put(outputConnection, previousSelection);
- }
- else
- {
- ISystemViewElementAdapter elementAdapter = (ISystemViewElementAdapter)((IAdaptable)selectedObject).getAdapter(ISystemViewElementAdapter.class);
- if (elementAdapter != null)
- {
- setPathTextFromSelection(selectedObject);
-
- outputObjects = getSelections(selection);
- outputConnection = elementAdapter.getSubSystem(selectedObject).getHost();
-
- _history.put(outputConnection, previousSelection);
- }
- }
-
-
- if (_selectionValidator != null)
- {
- SystemMessage selectionMsg = _selectionValidator.isValid(outputConnection, getSelections(selection), getRemoteAdapters(selection));
-
- if (selectionMsg != null)
- {
- _isValid = false;
- setErrorMessage(selectionMsg);
- }
- }
- setPageComplete();
- }
-
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- return ( (_pathText.getText().length() > 0) ) && _isValid;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- if (callerInstanceOfWizardPage)
- {
- ((WizardPage)caller).setPageComplete(isPageComplete());
- }
- else if (callerInstanceOfSystemPromptDialog)
- {
- ((SystemPromptDialog)caller).setPageComplete(isPageComplete());
- }
- }
-
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- * <p>
- * Default is false
- */
- public void setShowPropertySheet(boolean show)
- {
- this.showPropertySheet = show;
- }
-
-
-
- /**
- * Specify a validator to use when the user selects a remote file or folder.
- * This allows you to decide if OK should be enabled or not for that remote file or folder.
- */
- public void setSelectionValidator(IValidatorRemoteSelection selectionValidator)
- {
- _selectionValidator = selectionValidator;
- }
-
- protected void clearErrorMessage()
- {
- if (_msgLine != null)
- _msgLine.clearErrorMessage();
- }
- protected void setErrorMessage(String msg)
- {
- if (_msgLine != null)
- if (msg != null)
- _msgLine.setErrorMessage(msg);
- else
- _msgLine.clearErrorMessage();
- }
- protected void setErrorMessage(SystemMessage msg)
- {
- if (_msgLine != null)
- if (msg != null)
- _msgLine.setErrorMessage(msg);
- else
- _msgLine.clearErrorMessage();
- }
-
-
- /**
- * Set the message shown as the text at the top of the form. Eg, "Select a file"
- */
- public void setMessage(String message)
- {
- this._verbiage = message;
- if (verbiageLabel != null)
- verbiageLabel.setText(message);
- }
- /**
- * Set the tooltip text for the remote systems tree from which an item is selected.
- */
- public void setSelectionTreeToolTipText(String tip)
- {
- _systemViewForm.setToolTipText(tip);
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java
deleted file mode 100644
index f5aee241c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [202866] Fix exceptions in RSE browse dialog when SystemRegistry is not yet fully initialized
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [252912] SystemRemoteFileDialog shows Local contents even when specifying a SystemType
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.view.ISystemResourceSelectionInputProvider;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-
-public abstract class SystemResourceSelectionInputProvider extends SystemAbstractAPIProvider
- implements ISystemResourceSelectionInputProvider
-{
- private IHost _connection = null;
- private boolean _onlyConnection = false;
- private boolean _allowNew = true;
- private IRSESystemType[] _systemTypes;
- private String _category = null;
-
- public SystemResourceSelectionInputProvider(IHost connection)
- {
- _connection = connection;
- }
-
- public SystemResourceSelectionInputProvider()
- {
- // choose random host
- IHost[] hosts = getValidHosts();
- if (hosts != null && hosts.length>0) {
- _connection = hosts[0];
- }
- }
-
- private boolean validHost(IHost host){
- if (_systemTypes != null){
- IRSESystemType hostType = host.getSystemType();
- for (int t = 0; t < _systemTypes.length; t++){
- IRSESystemType type = _systemTypes[t];
- if (hostType.equals(type)){
- return true;
- }
- }
- return false;
- }
- else {
- return true;
- }
- }
-
- private IHost[] getValidHosts() {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- IHost[] hosts = registry.getHosts();
-
- // make sure the hosts are valid for the specified system types
- if (_systemTypes != null){
- List hostList = new ArrayList();
- for (int i = 0; i < hosts.length; i++){
- IHost host = hosts[i];
- if (validHost(host)){
- hostList.add(host);
- }
- }
- return (IHost[])hostList.toArray(new IHost[hostList.size()]);
- }
- else {
- return hosts;
- }
- }
-
- public IHost getSystemConnection()
- {
- return _connection;
- }
-
- public boolean allowMultipleConnections()
- {
- return !_onlyConnection;
- }
-
- public void setAllowNewConnection(boolean flag)
- {
- _allowNew = flag;
- }
-
- public boolean allowNewConnection()
- {
- return _allowNew;
- }
-
- public void setSystemConnection(IHost connection, boolean onlyConnection)
- {
- _connection = connection;
- _onlyConnection = onlyConnection;
- }
-
- public IRSESystemType[] getSystemTypes()
- {
- return _systemTypes;
- }
-
- public void setSystemTypes(IRSESystemType[] types)
- {
- _systemTypes = types;
- if (_connection != null){ // reset the connection if isn't valid
- if (!validHost(_connection)){
- _connection = null;
- }
- }
- }
-
- public Object[] getSystemViewRoots()
- {
- if (_connection == null)
- {
- IHost[] hosts = getValidHosts();
- if (hosts!=null && hosts.length!=0) {
- _connection = hosts[0];
- }
- }
- if (_connection != null){
- return getConnectionChildren(_connection);
- }
- else {
- return new Object[0];
- }
- }
-
- public boolean hasSystemViewRoots()
- {
- return false;
- }
-
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- if (selectedConnection != null)
- {
- ISubSystem ss = getSubSystem(selectedConnection);
- if (ss!=null) {
- return ss.getChildren();
- }
- }
- return new Object[0];
- }
-
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- if (selectedConnection != null)
- {
- ISubSystem ss = getSubSystem(selectedConnection);
- if (ss!=null) {
- return ss.hasChildren();
- }
- }
- return false;
- }
-
- protected abstract ISubSystem getSubSystem(IHost selectedConnection);
-
-
- public void setCategory(String category)
- {
- _category = category;
- }
-
- public String getCategory()
- {
- return _category;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java
deleted file mode 100644
index af65137d8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.core.filters.SystemFilterUtil;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProvider;
-import org.eclipse.rse.ui.view.ISystemSelectRemoteObjectAPIProviderCaller;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * <p>
- * It is used when the contents are used to allow the user to select a remote system object.
- * The tree will begin with the filter pool references or filter references (depending on
- * the user's preferences setting) of the given subsystem.
- * <p>
- * Alternatively, a filter string can be given and the contents will be the result of resolving
- * that filter string.
- */
-public class SystemSelectRemoteObjectAPIProviderImpl
- extends SystemAbstractAPIProvider
- implements ISystemSelectRemoteObjectAPIProvider
- {
-
-
- protected ISubSystem subsystem = null;
- protected String filterString = null;
- protected ISystemViewElementAdapter subsystemAdapter = null;
-
- // For mode when we want to list the connections ...
- protected boolean listConnectionsMode = false;
- protected boolean showNewConnectionPrompt = false;
- protected boolean singleConnectionMode = false;
- protected String subsystemConfigurationId;
- protected String subsystemConfigurationCategory;
- protected String filterSuffix;
- protected IRSESystemType[] systemTypes;
- protected String preSelectFilterChild;
- protected Object preSelectFilterChildObject;
- protected ISystemFilter[] quickFilters;
- protected IHost[] inputConnections;
- protected SystemNewConnectionPromptObject connPrompt = null;
- protected Object[] connPromptAsArray;
- protected ISystemSelectRemoteObjectAPIProviderCaller caller;
- protected boolean multiConnections = false;
-
- /**
- * Constructor that takes the input needed to drive the list. Specifically,
- * we need to know what connections to list, and when a connection is expanded,
- * what subsystems to query for the remote objects.
- * <p>
- * This can be done by giving one of two possible pieces of information:
- * <ul>
- * <li>a subsystem factory Id, which scopes the connections to those containing subsystems
- * owned by this factory, and scopes subsystems to only those from this factory.
- * <li>The subsystem factory Id is usually the right choice, unless you want to include
- * connections and subsystems from multiple subsystem factories, such as is the case
- * for universal files ... there is one base factory but it is subclassed a number of
- * times. For this and any other case we also allow scoping by subsystem factory
- * category. All connections from any factory of this category are included, and
- * subsystems of factories from this category are used to populate the list.
- * </ul>
- * <p>
- * You must supply one of these. There is no need to supply both.
- * <p>
- * Also, it is often desired to restrict what system types the user can create new connections for.
- * While this could be deduced from the first two pieces of information, it is safer to ask the
- * caller to explicitly identify these. If null is passed, then there is no restrictions.
- *
- * @param configId The subsystemConfigurationId to restrict connections and subsystems to
- * An alternative to factoryCategory. Specify only one, pass null for the other.
- * @param configCategory The subsystem configuration category to restrict connections and subsystems to.
- * An alternative to factoryId. Specify only one, pass null for the other.
- * @param showNewConnectionPrompt true if to show "New Connection" prompt, false if not to
- * @param systemTypes Optional list of system types to restrict the "New Connection" wizard to. Pass null for no restrictions
- */
- public SystemSelectRemoteObjectAPIProviderImpl(String configId, String configCategory,
- boolean showNewConnectionPrompt, IRSESystemType[] systemTypes)
- {
- super();
- this.subsystemConfigurationId = configId;
- this.subsystemConfigurationCategory = configCategory;
- this.systemTypes = systemTypes;
- this.showNewConnectionPrompt = showNewConnectionPrompt;
- this.listConnectionsMode = true;
- }
-
- /**
- * Set the caller to callback to for some events, such as the expansion of a prompting
- * transient filter.
- */
- public void setCaller(ISystemSelectRemoteObjectAPIProviderCaller caller)
- {
- this.caller = caller;
- }
-
- /**
- * Specify whether the user should see the "New Connection..." special connection prompt
- */
- public void setShowNewConnectionPrompt(boolean show)
- {
- this.showNewConnectionPrompt = show;
- }
-
- /**
- * Specify system types to restrict what types of connections
- * the user can create, and see.
- * This will override subsystemConfigurationId,if that has been set!
- *
- * @param systemTypes An array of system types, or
- * <code>null</code> to allow all registered valid system types.
- * A system type is valid if at least one subsystem configuration
- * is registered against it.
- */
- public void setSystemTypes(IRSESystemType[] systemTypes)
- {
- this.systemTypes = systemTypes;
- }
-
- /**
- * Constructor when there is a subsystem
- * @param subsystem The subsystem that will resolve the filter string
- */
- public SystemSelectRemoteObjectAPIProviderImpl(ISubSystem subsystem)
- {
- super();
- setSubSystem(subsystem);
- }
-
- /**
- * Constructor when there is no subsystem yet
- * @see #setSubSystem(ISubSystem)
- */
- public SystemSelectRemoteObjectAPIProviderImpl()
- {
- super();
- }
-
- /**
- * Default or Restrict to a specific connection.
- * If default mode, it is preselected.
- * If only mode, it is the only connection listed.
- * @param connection The connection to default or restrict to
- * @param onlyMode true if this is to be the only connection shown in the list
- */
- public void setSystemConnection(IHost connection, boolean onlyMode)
- {
- this.inputConnections = new IHost[] {connection};
- this.singleConnectionMode = onlyMode;
- if (onlyMode)
- multiConnections = false;
- }
-
- /**
- * Change the input subsystem
- */
- public void setSubSystem(ISubSystem subsystem)
- {
- this.subsystem = subsystem;
- if (subsystem != null)
- this.subsystemAdapter = getViewAdapter(subsystem);
- else
- this.subsystemAdapter = null;
- }
-
- /**
- * Set the filter string to use to resolve the inputs.
- * If this is an absolute filter string, it gets turned into a quick filter string,
- * so that the user sees it and can expand it. If it is a relative filter string
- * to apply to all expansions, it is used to decorate all filtering as the user drills down.
- */
- public void setFilterString(String string)
- {
- // WARNING: ENTERING BIG HUGE HACK AREA!
- this.filterString = string;
- filterSuffix = null;
- if (string == null)
- return;
-
- if (string.endsWith(",")) //$NON-NLS-1$
- {
- int idx = string.indexOf('/');
- if (idx == -1)
- idx = string.indexOf('\\');
- if (idx == -1)
- {
- filterSuffix = string;
- }
- }
-
- if (filterSuffix != null)
- filterString = null;
-
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), "*** FILTER SUFFIX = '" + filterSuffix + "' ***"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Set the filters to be exposed to the user. These will be shown to the
- * user when they expand a connection.
- */
- public void setQuickFilters(ISystemFilter[] filters)
- {
- this.quickFilters = filters;
- }
-
- /**
- * Set child of the first filter to preselect
- */
- public void setPreSelectFilterChild(String name)
- {
- this.preSelectFilterChild = name;
- }
-
- /**
- * Get the name of the item to select when the first filter is expanded.
- * Called by the filter adapter.
- */
- public String getPreSelectFilterChild()
- {
- return preSelectFilterChild;
- }
-
- /**
- * Set actual child object of the first filter to preselect. Called
- * by the filter adapter once the children are resolved and a match on
- * the name is found.
- */
- public void setPreSelectFilterChildObject(Object obj)
- {
- this.preSelectFilterChildObject = obj;
- }
-
- /**
- * Get the actual object of the item to select when the first filter is expanded.
- * Called by the GUI form after expansion, so it can select this object
- */
- public Object getPreSelectFilterChildObject()
- {
- return preSelectFilterChildObject;
- }
-
- /**
- * Adorn filter string with any relative attributes requested. Eg "/nf" for folders only
- */
- public String decorateFilterString(Object selectedObject, String inputFilterString)
- {
- // this is a hack explicitly for the universal file system. We want to propogate "type filters"
- // like "/nf" and "class," on down the chain, even though we start by showing the user's filters.
- // When those filters are finally expanded, the filter adapter calls us to do this adornment.
-
- if (inputFilterString == null)
- return inputFilterString;
- else if ((filterSuffix != null) && (inputFilterString.indexOf(filterSuffix)==-1))
- {
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), "*** INPUT FILTER = '" + inputFilterString + "' ***"); //$NON-NLS-1$ //$NON-NLS-2$
- String result = inputFilterString;
- if (filterSuffix.equals(" /nf")) //$NON-NLS-1$
- result = inputFilterString + filterSuffix;
- else
- {
- /** FIXME - can't be coupled with IRemoteFile
- RemoteFileFilterString rffs =
- new RemoteFileFilterString((IRemoteFileSubSystemConfiguration)getSubSystemConfiguration(selectedObject), inputFilterString);
- rffs.setFile(filterSuffix);
- result = rffs.toString();
- */
- result = inputFilterString;
- }
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), "*** ADORNED FILTER = '" + result + "' ***"); //$NON-NLS-1$ //$NON-NLS-2$
- return result;
- }
- else
- return inputFilterString;
- }
-
- /**
- * For performance reasons, pre-check to see if filter decoration is even necessary...
- */
- public boolean filtersNeedDecoration(Object selectedObject)
- {
- ISubSystemConfiguration ssf = getSubSystemConfiguration(selectedObject);
- if (ssf == null)
- return false;
- /** FIXME - can't be coupled with IRemoteFile
- return ((ssf instanceof IRemoteFileSubSystemConfiguration) && (filterSuffix != null));
- */
- return false;
-
- }
-
- /**
- * get subsystem factory from filter or filter string
- */
- private ISubSystemConfiguration getSubSystemConfiguration(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilterReference)
- {
- ISubSystem ss = (ISubSystem)((ISystemFilterReference)selectedObject).getProvider();
- return ss.getSubSystemConfiguration();
- }
- else if (selectedObject instanceof ISystemFilterStringReference)
- {
- ISubSystem ss = (ISubSystem)((ISystemFilterStringReference)selectedObject).getProvider();
- return ss.getSubSystemConfiguration();
- }
- else
- return null;
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- */
- public Object[] getSystemViewRoots()
- {
- if (listConnectionsMode)
- return getConnections();
-
- if (subsystemAdapter == null)
- {
- return emptyList;
- }
-
- Object[] children = null;
-
- if (filterString == null)
- children = subsystemAdapter.getChildren((IAdaptable)subsystem, new NullProgressMonitor());
- else
- {
- children = resolveFilterString(subsystem, filterString);
- }
-
- return checkForEmptyList(children, null, true);
- }
-
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- */
- public boolean hasSystemViewRoots()
- {
- if (listConnectionsMode)
- return true;
- else
- {
- boolean hasroots = false;
- if (subsystemAdapter == null)
- hasroots = false;
- else if (filterString != null)
- hasroots = true;
- else
- hasroots = subsystemAdapter.hasChildren((IAdaptable)subsystem);
-
- return hasroots;
- }
- }
-
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- if (!listConnectionsMode)
- return null; // not applicable, never get called
- else
- {
- Object[] children = null;
- ISubSystem[] subsystems = getSubSystems(selectedConnection);
- ISubSystem subsystem = null;
-
- if ((subsystems != null) && (subsystems.length > 0))
- {
- subsystem = subsystems[0]; // always just use first. Hopefully never a problem!
-
- if (subsystems.length > 1)
- SystemBasePlugin.logWarning(this.getClass().getName() + ": More than one subsystem meeting criteria. SSFID = "+subsystemConfigurationId+", SSFCat = "+subsystemConfigurationCategory); //$NON-NLS-1$ //$NON-NLS-2$
-
- if (quickFilters != null)
- {
- // DKM - quick filters are only work properly for first subsystem, so for now, I'm only
- // only going to use them for the initial subsystem
- //boolean useFilters = false;
-
- // Phil
- // 50167: re-using the same filter object for every connection causes
- // grief, so we have to clone the filter for each connection.
- if (multiConnections)
- {
- // walk through quick filters, and create a clone for each one
- children = new ISystemFilter[quickFilters.length];
-
- for (int idx=0; idx<quickFilters.length; idx++)
- {
- ISystemFilter quickFilter = quickFilters[idx];
- children[idx] = SystemFilterUtil.makeSimpleFilter(quickFilter.getName());
- quickFilter.clone((ISystemFilter)children[idx]);
- ((ISystemFilter)children[idx]).setSubSystem(subsystem);
- }
- }
-
- else
- {
- // walk through quickFilters and if they are transient, assign current subsystem as parent
- for (int idx=0; idx<quickFilters.length; idx++)
- {
- if ((quickFilters[idx].isTransient()))
- {
- quickFilters[idx].setSubSystem(subsystem);
- }
- }
-
- children = quickFilters;
- }
- }
-
- else if ((filterString == null) || (filterSuffix != null))
- {
- children = subsystem.getChildren();
- }
- else
- {
- children = resolveFilterString(subsystem, filterString);
- }
- }
-
- return checkForEmptyList(children, subsystem, true);
- }
- }
-
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return true;
- }
-
- /**
- * Return true if we are listing connections or not, so we know whether we are interested in
- * connection-add events
- */
- public boolean showingConnections()
- {
- return listConnectionsMode;
- }
-
-
- // ----------------------------------
- // OUR OWN METHODS...
- // ----------------------------------
-
- /**
- * Return the connections appropriate for our subsystem factory ID or category
- * requirements.
- */
- protected Object[] getConnections()
- {
- if (singleConnectionMode && !showNewConnectionPrompt)
- return inputConnections;
- if ((connPrompt == null) && showNewConnectionPrompt)
- {
- connPrompt = new SystemNewConnectionPromptObject();
- connPromptAsArray = new Object[1];
- connPromptAsArray[0] = connPrompt;
- }
- if ((connPrompt!=null) && (systemTypes != null))
- {
- connPrompt.setSystemTypes(systemTypes);
- }
-
- IHost[] conns = null;
-
- if (singleConnectionMode)
- conns = inputConnections;
- else if (systemTypes != null)
- conns = sr.getHostsBySystemTypes(systemTypes);
- else if (subsystemConfigurationId != null) {
- ISubSystemConfiguration config = sr.getSubSystemConfiguration(subsystemConfigurationId);
- conns = sr.getHostsBySubSystemConfiguration(config);
- }
- else if (subsystemConfigurationCategory != null)
- conns = sr.getHostsBySubSystemConfigurationCategory(subsystemConfigurationCategory);
- else
- conns = sr.getHosts();
-
- Object[] children = null;
-
- if (showNewConnectionPrompt)
- {
- if ((conns == null) || (conns.length == 0))
- children = connPromptAsArray;
- else
- {
- multiConnections = (conns.length>1); // 50167pc
- children = new Object[1+conns.length];
- children[0] = connPrompt;
- for (int idx=0; idx<conns.length; idx++)
- children[idx+1] = conns[idx];
- }
- }
- else
- {
- children = conns;
- multiConnections = ((conns!=null) && (conns.length>1)); // 50167pc
- }
-
- return checkForEmptyList(children, null, false);
- }
-
- /**
- * Given a connection, return the subsystem(s) appropriate for the given
- * subsystem configuration id or category
- */
- protected ISubSystem[] getSubSystems(IHost selectedConnection)
- {
- ISubSystem[] subsystems = null;
- if (subsystemConfigurationId != null) {
- ISubSystemConfiguration config = sr.getSubSystemConfiguration(subsystemConfigurationId);
- if (config==null)
- subsystems = new ISubSystem[0];
- else
- subsystems = config.getSubSystems(selectedConnection, true);
- }
- else if (subsystemConfigurationCategory != null) {
- subsystems = sr.getSubSystemsBySubSystemConfigurationCategory(subsystemConfigurationCategory, selectedConnection);
- }
- else
- subsystems = sr.getSubSystems(selectedConnection);
- return subsystems;
- }
-
- /**
- * Return the result of asking a given subsystem to resolve a filter string
- */
- protected Object[] resolveFilterString(ISubSystem subsystem, String filterString)
- {
- Object[] children = null;
- try
- {
- children = subsystem.resolveFilterString(filterString, new NullProgressMonitor());
- } catch (InterruptedException exc)
- {
- if (cancelledObject == null)
- children = getCancelledMessageObject();
- } catch (Exception exc)
- {
- children = getFailedMessageObject();
- SystemBasePlugin.logError("Error in SystemTestFilterStringAPIProviderImpl#getSystemViewRoots()",exc); //$NON-NLS-1$
- }
- return children;
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
-
- /**
- * Prompt the user to create a new filter as a result of the user expanding a promptable
- * transient filter
- * <p>
- * Simply passes the request on to the caller.
- * <p>
- * NOT SUPPORTED YET!
- *
- * @return the filter created by the user or null if they cancelled the prompting
- */
- public ISystemFilter createFilterByPrompting(ISystemFilter filterPrompt, Shell shell)
- throws Exception
- {
- if (caller!=null)
- return caller.createFilterByPrompting(filterPrompt, shell);
- else
- return null;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeView.java
deleted file mode 100644
index 321df29dc..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeView.java
+++ /dev/null
@@ -1,2057 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [196582] ClassCastException when doing copy/paste with Search view open
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.window.SameShellProvider;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemRemoteChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonSelectAllAction;
-import org.eclipse.rse.internal.ui.actions.SystemOpenExplorerPerspectiveAction;
-import org.eclipse.rse.internal.ui.actions.SystemShowInTableAction;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.services.clientserver.StringCompare;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemDeleteTarget;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemRenameTarget;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAction;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ContextObject;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.part.EditorInputTransfer;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.progress.PendingUpdateAdapter;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-
-/**
- * This subclass of the standard JFace tabletree viewer is used to
- * show a generic tabletree view of the selected object
- * <p>
- *
- */
-public class SystemTableTreeView
- //FIXEM change TreeViewer to TableTreeViewer when Eclipse fixes SWT viewer
- //extends TableTreeViewer
- extends TreeViewer
- implements IMenuListener,
- ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget,
- ISystemResourceChangeListener, ISystemRemoteChangeListener,
- ISystemShellProvider, ISelectionChangedListener, ISelectionProvider
-{
-
- protected Composite getTableTree()
- {
- // TODO - turn back to table tree
- return getTree();
- }
-
- // TODO - turn back into tabletree
- // inner class to support cell editing - only use with table
- private ICellModifier cellModifier = new ICellModifier()
- {
- public Object getValue(Object element, String property)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- adapter.setPropertySourceInput(element);
- Object value = adapter.getPropertyValue(property);
- if (value == null)
- {
- value = ""; //$NON-NLS-1$
- }
- return value;
- }
-
- public boolean canModify(Object element, String property)
- {
- boolean modifiable = true;
- return modifiable;
- }
-
- public void modify(Object element, String property, Object value)
- {
- if (element instanceof TableItem && value != null)
- {
- Object obj = ((TableItem) element).getData();
- ISystemViewElementAdapter adapter = getViewAdapter(obj);
- if (adapter != null)
- {
- adapter.setPropertyValue(property, value);
-
- SelectionChangedEvent event = new SelectionChangedEvent(SystemTableTreeView.this, getSelection());
-
- // fire the event
- fireSelectionChanged(event);
- }
- }
- }
- };
-
- private class HeaderSelectionListener extends SelectionAdapter
- {
-
- public HeaderSelectionListener()
- {
- _upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID);
- _downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID);
- }
-
-
- /**
- * Handles the case of user selecting the
- * header area.
- * <p>If the column has not been selected previously,
- * it will set the sorter of that column to be
- * the current table view sorter. Repeated
- * presses on the same column header will
- * toggle sorting order (ascending/descending).
- */
- public void widgetSelected(SelectionEvent e)
- {
- Tree table = getTree();
- if (!table.isDisposed())
- {
- // column selected - need to sort
- TreeColumn tcolumn = (TreeColumn)e.widget;
- int column = table.indexOf(tcolumn);
- SystemTableViewSorter oldSorter = (SystemTableViewSorter) getSorter();
- if (oldSorter != null && column == oldSorter.getColumnNumber())
- {
- oldSorter.setReversed(!oldSorter.isReversed());
- if (tcolumn.getImage() == _upI)
- {
- tcolumn.setImage(_downI);
- }
- else
- {
- tcolumn.setImage(_upI);
- }
- }
- else
- {
- setSorter(new SystemTableViewSorter(column, SystemTableTreeView.this, _columnManager));
- tcolumn.setImage(_downI);
- }
-
- // unset image of other columns
- TreeColumn[] allColumns = table.getColumns();
- for (int i = 0; i < allColumns.length; i++)
- {
- if (i != column)
- {
- if (allColumns[i].getImage() != null)
- {
- allColumns[i].setImage(null);
- }
- }
- }
- refresh();
- }
- }
- }
- private Object _objectInput;
- //private ArrayList _attributeColumns;
- private TableLayout _layout;
- protected SystemTableTreeViewProvider _provider;
- private HeaderSelectionListener _columnSelectionListener;
- private SystemTableViewColumnManager _columnManager;
- private MenuManager _menuManager;
- private int _charWidth = 3;
- private SystemTableViewFilter _filter;
- private IPropertyDescriptor[] _uniqueDescriptors;
-
- // these variables were copied from SystemView to allow for limited support
- // of actions. I say limited because somethings don't yet work properly.
- protected SystemRefreshAction _refreshAction;
- protected PropertyDialogAction _propertyDialogAction;
- protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction;
- protected SystemShowInTableAction _showInTableAction;
-
- // global actions
- // Note the Edit menu actions are set in SystemViewPart. Here we use these
- // actions from our own popup menu actions.
- protected SystemCommonDeleteAction _deleteAction;
- // for global delete menu item
- protected SystemCommonRenameAction _renameAction;
- // for common rename menu item
- protected SystemCommonSelectAllAction _selectAllAction;
- // for common Ctrl+A select-all
-
- protected boolean _selectionShowRefreshAction;
- protected boolean _selectionShowOpenViewActions;
- protected boolean _selectionShowDeleteAction;
- protected boolean _selectionShowRenameAction;
- protected boolean _selectionEnableDeleteAction;
- protected boolean _selectionEnableRenameAction;
-
- protected boolean _selectionIsRemoteObject = true;
- protected boolean _selectionFlagsUpdated = false;
-
- private int[] _lastWidths = null;
- private ISystemMessageLine _messageLine;
- protected boolean menuListenerAdded = false;
-
-
- private static final int LEFT_BUTTON = 1;
- private int mouseButtonPressed = LEFT_BUTTON;
-
- private Image _upI;
- private Image _downI;
-
-
- /**
- * Constructor for the table view
- *
- */
- public SystemTableTreeView(Tree tableTree, ISystemMessageLine msgLine)
- {
- super(tableTree);
- _messageLine = msgLine;
- //_attributeColumns = new ArrayList();
- _layout = new TableLayout();
-
- _columnManager = new SystemTableViewColumnManager(this);
- _provider = new SystemTableTreeViewProvider(_columnManager);
- _columnSelectionListener = new HeaderSelectionListener();
-
-
- setContentProvider(_provider);
- setLabelProvider(_provider);
-
- _filter = new SystemTableViewFilter();
- addFilter(_filter);
-
- _charWidth = tableTree.getFont().getFontData()[0].getHeight() / 2;
- computeLayout();
-
- _menuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- _menuManager.setRemoveAllWhenShown(true);
- _menuManager.addMenuListener(this);
- Menu menu = _menuManager.createContextMenu(tableTree);
- tableTree.setMenu(menu);
-
- addSelectionChangedListener(this);
-
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.addSystemResourceChangeListener(this);
- sr.addSystemRemoteChangeListener(this);
-
- initDragAndDrop();
-
- tableTree.setVisible(false);
- // key listening for delete press
- getControl().addKeyListener(new KeyAdapter()
- {
- public void keyPressed(KeyEvent e)
- {
- handleKeyPressed(e);
- }
- });
- getControl().addMouseListener(new MouseAdapter()
- {
- public void mouseDown(MouseEvent e)
- {
- mouseButtonPressed = e.button; //d40615
- }
- });
- }
-
- public Layout getLayout()
- {
- return _layout;
- }
-
-
- public void setViewFilters(String[] filter)
- {
- if (_filter.getFilters() != filter)
- {
- _filter.setFilters(filter);
- refresh();
- }
- }
-
- public String[] getViewFilters()
- {
- return _filter.getFilters();
- }
-
- /**
- * Return the popup menu for the table
- */
- public Menu getContextMenu()
- {
- return getTableTree().getMenu();
- }
- /**
- * Return the popup menu for the table
- */
- public MenuManager getContextMenuManager()
- {
- return _menuManager;
- }
-
- /**
- * Called whenever the input for the view changes
- */
- public void inputChanged(Object newObject, Object oldObject)
- {
- if (newObject instanceof IAdaptable)
- {
- getTableTree().setVisible(true);
- _objectInput = newObject;
-
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
- provider.getChildren(_objectInput);
-
- computeLayout();
-
- // reset the filter
- setViewFilters(null);
-
- super.inputChanged(newObject, oldObject);
-
- }
- else if (newObject == null)
- {
- getTableTree().setVisible(false);
- _objectInput = null;
- computeLayout();
-
- setViewFilters(null);
- }
- }
-
- public Object getInput()
- {
- return _objectInput;
- }
-
- /**
- * Convenience method for retrieving the view adapter for an object
- */
- protected ISystemViewElementAdapter getViewAdapter(Object obj)
- {
- return SystemAdapterHelpers.getViewAdapter(obj, this);
- }
-
- public SystemTableViewColumnManager getColumnManager()
- {
- return _columnManager;
- }
-
- private IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter)
- {
- return _columnManager.getVisibleDescriptors(adapter);
- }
-
- public IPropertyDescriptor[] getUniqueDescriptors()
- {
- return _uniqueDescriptors;
- }
-
- /**
- * Used to determine what the columns should be on the table.
- */
- public IPropertyDescriptor[] getVisibleDescriptors(Object object)
- {
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
- Object[] children = provider.getChildren(object);
- return getVisibleDescriptors(children);
- }
-
- private IPropertyDescriptor[] getVisibleDescriptors(Object[] children)
- {
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
- ISystemViewElementAdapter adapter = getViewAdapter(child);
- adapter.setPropertySourceInput(child);
- return getCustomDescriptors(adapter);
- }
-
- return new IPropertyDescriptor[0];
- }
-
-
-
- public IPropertyDescriptor getNameDescriptor(Object object)
- {
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
- Object[] children = provider.getChildren(object);
- return getNameDescriptor(children);
- }
-
- private IPropertyDescriptor getNameDescriptor(Object[] children)
- {
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
- return getViewAdapter(child).getPropertyDescriptors()[0];
- }
-
- return null;
- }
-
- /**
- * Used to determine the formats of each descriptor.
- */
- private ArrayList getFormatsIn()
- {
- ArrayList results = new ArrayList();
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
- Object[] children = provider.getChildren(_objectInput);
-
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
-
- Object adapter = child.getAdapter(ISystemViewElementAdapter.class);
- if (adapter instanceof ISystemViewElementAdapter)
- {
- ISystemViewElementAdapter ad = (ISystemViewElementAdapter) adapter;
- ad.setPropertySourceInput(child);
- IPropertyDescriptor[] descriptors = ad.getUniquePropertyDescriptors();
- for (int i = 0; i < descriptors.length; i++)
- {
- IPropertyDescriptor descriptor = descriptors[i];
-
- try
- {
- Object key = descriptor.getId();
-
- Object propertyValue = ad.getPropertyValue(key, false);
- results.add(propertyValue.getClass());
- }
- catch (Exception e)
- {
- results.add(String.class);
- }
-
- }
- }
- }
-
- return results;
- }
- protected void computeLayout()
- {
- computeLayout(false);
- }
-
- private boolean sameDescriptors(IPropertyDescriptor[] descriptors1, IPropertyDescriptor[] descriptors2)
- {
- if (descriptors1 == null || descriptors2 == null)
- {
- return false;
- }
- if (descriptors1.length == descriptors2.length)
- {
- boolean same = true;
- for (int i = 0; i < descriptors1.length && same; i++)
- {
- same = descriptors1[i] == descriptors2[i];
- }
- return same;
- }
- else
- {
- return false;
- }
- }
-
- private CellEditor getCellEditor(Tree parent, IPropertyDescriptor descriptor)
- {
- CellEditor editor = descriptor.createPropertyEditor(parent);
- if (editor instanceof SystemInheritableTextCellEditor)
- {
- ((SystemInheritableTextCellEditor) editor).getInheritableEntryField().setAllowEditingOfInheritedText(true);
- }
-
- return editor;
- }
-
- /**
- * Determines what columns should be shown in this view. The columns may change
- * anytime the view input changes. The columns in the control are modified and
- * columns may be added or deleted as necessary to make it conform to the
- * new data.
- */
- public void computeLayout(boolean force)
- {
- if (_objectInput == null)
- return;
-
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
- if (provider == null)
- return;
- Object[] children = provider.getChildren(_objectInput);
-
- // if no children, don't update
- if (children == null || children.length == 0 || (children.length == 1 && children[0] instanceof PendingUpdateAdapter))
- {
- return;
- }
-
- IPropertyDescriptor[] descriptors = getVisibleDescriptors(children);
- IPropertyDescriptor nameDescriptor = getNameDescriptor(children);
-
- int n = descriptors.length; // number of columns we need (name column + other columns)
- if (nameDescriptor != null)
- n += 1;
- if (n == 0)
- return; // there is nothing to lay out!
-
-
- if (sameDescriptors(descriptors,_uniqueDescriptors) && !force)
- {
- setLastColumnWidths(getCurrentColumnWidths());
- return;
- }
- _uniqueDescriptors = descriptors;
- Tree tree = getTree();
- if (tree == null || tree.isDisposed())
- return;
-
- // set column attributes, create new columns if necessary
- TreeColumn[] columns = tree.getColumns();
- int numColumns = columns.length; // number of columns in the control
- CellEditor editors[] = new CellEditor[n];
- String headings[] = new String[n];
- String propertyIds[] = new String[n];
- ArrayList formats = getFormatsIn();
-
-
- _layout = new TableLayout();
- for (int i = 0; i < n; i++)
- { // for each column
- String name = null;
- String propertyId = null;
- CellEditor editor = null;
- int alignment = SWT.LEFT;
- int weight = 100;
- if (i == 0)
- {
- // this is the first column -- treat it special
- name = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL;
- if (nameDescriptor != null)
- {
- propertyId = (String) nameDescriptor.getId();
- editor = getCellEditor(tree, nameDescriptor);
- weight = 200;
- }
- }
- else
- { // these columns come from the regular descriptors
- IPropertyDescriptor descriptor = descriptors[i - 1];
-
- Class format = (Class) formats.get(i - 1);
- name = descriptor.getDisplayName();
- propertyId = (String) descriptor.getId();
- editor = getCellEditor(tree, descriptor);
- if (format != String.class)
- alignment = SWT.RIGHT;
- }
- TreeColumn tc = null;
- if (i >= numColumns)
- {
- tc = new TreeColumn(tree, alignment, i);
- tc.addSelectionListener(_columnSelectionListener);
-
- }
- else
- {
- tc = columns[i];
- tc.setAlignment(alignment);
- }
- _layout.addColumnData(new ColumnWeightData(weight));
- tc.setText(name);
- if (i == 0)
- {
- // tc.setImage(_downI);
- }
- headings[i] = name;
- editors[i] = editor;
- propertyIds[i] = propertyId;
- }
- setColumnProperties(propertyIds);
- setCellEditors(editors);
- setCellModifier(cellModifier);
-
- // dispose of any extra columns the tree control may have
- for (int i = n; i < numColumns; i++)
- {
- columns[i].dispose();
- columns[i] = null;
- }
-
- // compute column widths
- columns = tree.getColumns();
- numColumns = columns.length;
- Rectangle clientA = tree.getClientArea();
- int totalWidth = clientA.width - 5;
- if (totalWidth <= 0)
- {
- // find a default
- totalWidth = 500;
- }
-
-
- int[] lastWidths = getLastColumnWidths();
- if (numColumns > 1)
- {
- // check if previous widths can be used
- if (lastWidths != null && lastWidths.length == numColumns)
- {
-
- // use previously established widths
- setCurrentColumnWidths(lastWidths);
- }
- else
- {
- if (totalWidth > 0)
- {
- // no previous widths or number of columns has changed - need to calculate
- int averageWidth = totalWidth / numColumns;
- int firstWidth = Math.max(averageWidth, 150);
- averageWidth = (totalWidth - firstWidth) / (numColumns - 1);
- averageWidth = Math.max(averageWidth, 80);
- columns[0].setWidth(firstWidth);
- for (int i = 1; i < numColumns; i++)
- {
-
- columns[i].setWidth(averageWidth);
- }
- setLastColumnWidths(getCurrentColumnWidths());
- }
- }
- tree.setHeaderVisible(true);
- }
- else
- {
-
- if (numColumns == 1)
- {
- int width = totalWidth;
- if (lastWidths != null && lastWidths.length == 1)
- {
- width = (totalWidth > lastWidths[0]) ? totalWidth : lastWidths[0];
- }
-
-
- int maxWidth = provider.getMaxCharsInColumnZero() * _charWidth;
- if (maxWidth > width)
- {
- width = maxWidth;
- }
-
- if (width > 0)
- {
- columns[0].setWidth(width);
- }
- tree.setHeaderVisible(false);
- }
- }
- }
-
- public int[] getCurrentColumnWidths()
- {
- return new int[0];
- }
-
- public void setCurrentColumnWidths(int[] widths)
- {
- }
-
- public int[] getLastColumnWidths()
- {
- return _lastWidths;
- }
-
- public void setLastColumnWidths(int[] widths)
- {
- _lastWidths = widths;
- }
-
-
- protected void initDragAndDrop()
- {
- int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] dragtransfers = new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance(), FileTransfer.getInstance(), EditorInputTransfer.getInstance()};
- Transfer[] droptransfers = new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance(), FileTransfer.getInstance(), EditorInputTransfer.getInstance()};
-
- addDragSupport(ops, dragtransfers, new SystemViewDataDragAdapter(this));
- addDropSupport(ops | DND.DROP_DEFAULT, droptransfers, new SystemViewDataDropAdapter(this));
- }
- /**
- * Used to asynchronously update the view whenever properties change.
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
- try
- {
- Tree tree = getTree();
- boolean isDisposed = tree.isDisposed();
- if (isDisposed)
- {
- dispose();
- return;
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- boolean madeChange = false;
- Object parent = event.getParent();
- Object child = event.getSource();
- int eventType = event.getType();
- switch (eventType)
- {
- case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE :
- case ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE :
- {
- Widget w = findItem(child);
-
- if (w != null)
- {
- updateItem(w, child);
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_ADD :
- case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE :
- {
- boolean addingConnection = (child instanceof IHost);
- if (_objectInput instanceof ISystemRegistry && addingConnection)
- {
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
-
- if (provider != null)
- {
- if (!madeChange)
- {
- provider.flushCache();
- madeChange = true;
- }
-
- computeLayout();
- internalRefresh(_objectInput);
- }
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_REFRESH:
- {
- Widget w = findItem(parent);
- if (w != null)
- {
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
- if (!madeChange)
- {
- provider.flushCache();
- madeChange = true;
- }
- internalRefresh(parent);
- }
- }
- break;
- default :
- break;
-
- }
-
- if (child == _objectInput || parent == _objectInput)
- {
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
-
- if (provider != null)
- {
- if (!madeChange)
- {
- //provider.flushCache();
- madeChange = true;
- }
-
- computeLayout();
- try
- {
- internalRefresh(_objectInput);
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError(e.getMessage());
- }
- }
- }
- }
-
- /**
- * This is the method in your class that will be called when a remote resource
- * changes. You will be called after the resource is changed.
- * @see org.eclipse.rse.core.events.ISystemRemoteChangeEvent
- */
- public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
- {
- boolean madeChange = false;
- int eventType = event.getEventType();
- Object remoteResourceParent = event.getResourceParent();
- Object remoteResource = event.getResource();
- //boolean originatedHere = (event.getOriginatingViewer() == this);
- List remoteResourceNames = null;
- if (remoteResource instanceof List)
- {
- remoteResourceNames = (List) remoteResource;
- remoteResource = remoteResourceNames.get(0);
- }
- String remoteResourceParentName = getRemoteResourceAbsoluteName(remoteResourceParent);
- String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource);
- if (remoteResourceName == null)
- return;
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
-
- switch (eventType)
- {
- // --------------------------
- // REMOTE RESOURCE CHANGED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
- {
- if (remoteResourceParent == getInput())
- {
- Widget w = findItem(remoteResource);
- if (w != null)
- {
- updateItem(w, remoteResource);
- }
-
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE CREATED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
- {
- String inputResourceName = getRemoteResourceAbsoluteName(getInput());
- if (remoteResourceParentName != null && remoteResourceParentName.equals(inputResourceName))
- {
- if (provider == null)
- {
- return;
- }
- if (!madeChange)
- {
- provider.flushCache();
- madeChange = true;
- }
-
- refresh();
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE DELETED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
- {
- {
- Object dchild = remoteResource;
-
- ISystemViewElementAdapter dadapt = getViewAdapter(dchild);
- if (dadapt != null)
- {
- ISubSystem dSubSystem = dadapt.getSubSystem(dchild);
- String dkey = dadapt.getAbsoluteName(dchild);
-
- if (provider != null)
- {
- Object[] children = provider.getChildren(_objectInput);
- for (int i = 0; i < children.length; i++)
- {
- Object existingChild = children[i];
- if (existingChild != null)
- {
- ISystemViewElementAdapter eadapt = getViewAdapter(existingChild);
- ISubSystem eSubSystem = eadapt.getSubSystem(existingChild);
-
- if (dSubSystem == eSubSystem)
- {
- String ekey = eadapt.getAbsoluteName(existingChild);
- if (ekey.equals(dkey))
- {
- if (!madeChange)
- {
- provider.flushCache();
- madeChange = true;
-
- // do a full refresh
- refresh();
- }
- }
- }
-
- }
- }
- }
- }
- }
-
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
- {
- String oldName = event.getOldNames()[0]; // right now we're assuming that a rename event is for a single resource
- Object child = event.getResource();
-
- if (provider != null)
- {
- Object[] previousResults = provider.getCache();
- if (previousResults != null)
- {
- for (int i = 0; i < previousResults.length; i++)
- {
- Object previousResult = previousResults[i];
-
- if (previousResult == child)
- {
- Widget widget = findItem(previousResult);
- if (widget != null)
- {
- widget.setData(child);
- updateItem(widget, child);
- return;
- }
- }
- else
- {
- String previousName = getViewAdapter(previousResult).getAbsoluteName(previousResult);
-
- if (previousName != null && previousName.equals(oldName))
- {
- provider.flushCache();
- internalRefresh(_objectInput);
- return;
- }
- }
- }
-
- }
- }
- }
-
- break;
- }
- }
-
- /**
- * Turn a given remote object reference into a fully qualified absolute name
- */
- private String getRemoteResourceAbsoluteName(Object remoteResource)
- {
- if (remoteResource == null)
- return null;
- String remoteResourceName = null;
- if (remoteResource instanceof String)
- remoteResourceName = (String) remoteResource;
- else
- {
- ISystemViewElementAdapter ra = getViewAdapter(remoteResource);
- if (ra == null)
- return null;
- remoteResourceName = ra.getAbsoluteName(remoteResource);
- }
- return remoteResourceName;
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- _selectionFlagsUpdated = false;
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- Object firstSelection = sel.getFirstElement();
- if (firstSelection == null)
- return;
-
- _selectionFlagsUpdated = false;
- ISystemViewElementAdapter adapter = getViewAdapter(firstSelection);
- if (adapter != null)
- {
- displayMessage(adapter.getStatusLineText(firstSelection));
- if ((mouseButtonPressed == LEFT_BUTTON))
- adapter.selectionChanged(firstSelection);
- }
- else
- clearMessage();
- }
-
- public void dispose()
- {
- removeAsListener();
-
- Composite tree = getTableTree();
-
- boolean isDisposed = tree.isDisposed();
-
- // dispose control if not disposed
- if (!isDisposed) {
- tree.dispose();
- }
- }
-
- /**
- * Display a message/status on the message/status line
- */
- public void displayMessage(String msg)
- {
- if (_messageLine != null)
- _messageLine.setMessage(msg);
- }
-
- /**
- * Convenience method for retrieving the view adapter for an object's children
- */
- public ISystemViewElementAdapter getViewAdapterForContents()
- {
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider) getContentProvider();
- if (provider != null)
- {
- Object[] children = provider.getChildren(getInput());
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
- return getViewAdapter(child);
- }
- }
- return null;
- }
-
- /**
- * Clear message/status shown on the message/status line
- */
- public void clearMessage()
- {
- if (_messageLine != null)
- _messageLine.clearMessage();
- }
-
- /**
- * Remove as listener.
- */
- public void removeAsListener() {
-
- // remove listeners
- removeSelectionChangedListener(this);
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.removeSystemResourceChangeListener(this);
- sr.removeSystemRemoteChangeListener(this);
-
- // for debugging
- //Composite tree = getTableTree();
- //boolean isDisposed = tree.isDisposed();
- }
-
-
-
- /**
- * Rather than pre-defining this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected PropertyDialogAction getPropertyDialogAction()
- {
- if (_propertyDialogAction == null)
- {
- _propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this);
- //propertyDialogAction.setToolTipText(" ");
- }
- _propertyDialogAction.selectionChanged(getSelection());
- return _propertyDialogAction;
- }
-
- /**
- * Return the select All action
- */
- protected IAction getSelectAllAction()
- {
- if (_selectAllAction == null)
- _selectAllAction = new SystemCommonSelectAllAction(getShell(), this, this);
- return _selectAllAction;
- }
-
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected IAction getRenameAction()
- {
- if (_renameAction == null)
- _renameAction = new SystemCommonRenameAction(getShell(), this);
- return _renameAction;
- }
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected IAction getDeleteAction()
- {
- if (_deleteAction == null)
- _deleteAction = new SystemCommonDeleteAction(getShell(), this);
- return _deleteAction;
- }
-
- /**
- * Return the refresh action
- */
- protected IAction getRefreshAction()
- {
- if (_refreshAction == null)
- _refreshAction = new SystemRefreshAction(getShell());
- return _refreshAction;
- }
- /*
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- *
- protected SystemCascadingOpenToAction getOpenToAction()
- {
- if (openToAction == null)
- openToAction = new SystemCascadingOpenToAction(getShell(),getWorkbenchWindow());
- return openToAction;
- } NOT USED YET */
- /**
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- */
- protected SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
- {
- if (_openToPerspectiveAction == null)
- {
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchWindow win = desktop.getActiveWorkbenchWindow();
-
- _openToPerspectiveAction = new SystemOpenExplorerPerspectiveAction(getShell(), win);
- }
- //getWorkbenchWindow());
- return _openToPerspectiveAction;
- }
-
- protected SystemShowInTableAction getShowInTableAction()
- {
- if (_showInTableAction == null)
- {
- _showInTableAction = new SystemShowInTableAction(getShell());
- }
- //getWorkbenchWindow());
- return _showInTableAction;
- }
-
- public Shell getShell()
- {
- return getTableTree().getShell();
- }
-
- /**
- * Required method from ISystemDeleteTarget.
- * Decides whether to even show the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showDelete()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionShowDeleteAction;
- }
- /**
- * Required method from ISystemDeleteTarget
- * Decides whether to enable the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canDelete()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionEnableDeleteAction;
- }
-
- /*
- * Required method from ISystemDeleteTarget
- */
- public boolean doDelete(IProgressMonitor monitor)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- //int selectedCount = selection.size();
- //Object multiSource[] = new Object[selectedCount];
- //int idx = 0;
- Object element = null;
- //Object parentElement = getSelectedParent();
- ISystemViewElementAdapter adapter = null;
- boolean ok = true;
- boolean anyOk = false;
- Vector deletedVector = new Vector();
- try
- {
- while (ok && elements.hasNext())
- {
- element = elements.next();
- //multiSource[idx++] = element;
- adapter = getViewAdapter(element);
- ok = adapter.doDelete(getShell(), element, monitor);
- if (ok)
- {
- anyOk = true;
- deletedVector.addElement(element);
- }
- }
- }
- catch (SystemMessageException exc)
- {
- SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
- ok = false;
- }
- catch (Exception exc)
- {
- String msg = exc.getMessage();
- if ((msg == null) || (exc instanceof ClassCastException))
- msg = exc.getClass().getName();
- SystemMessageDialog.displayErrorMessage(getShell(), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element, msg));
- ok = false;
- }
- if (anyOk)
- {
- Object[] deleted = new Object[deletedVector.size()];
- for (int idx = 0; idx < deleted.length; idx++)
- deleted[idx] = deletedVector.elementAt(idx);
- if (_selectionIsRemoteObject)
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this);
- else
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvents.EVENT_DELETE_MANY, getInput()));
- }
- return ok;
- }
-
- // ---------------------------
- // ISYSTEMRENAMETARGET METHODS
- // ---------------------------
-
- /**
- * Required method from ISystemRenameTarget.
- * Decides whether to even show the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showRename()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionShowRenameAction;
- }
- /**
- * Required method from ISystemRenameTarget
- * Decides whether to enable the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canRename()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionEnableRenameAction;
- }
-
- // default implementation
- // in default table, parent is input
- protected Object getParentForContent(Object element)
- {
- return _objectInput;
- }
-
- /**
- * Required method from ISystemRenameTarget
- */
- public boolean doRename(String[] newNames)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- //int selectedCount = selection.size();
- Object element = null;
-
- ISystemViewElementAdapter adapter = null;
- ISystemRemoteElementAdapter remoteAdapter = null;
- String oldFullName = null;
- boolean ok = true;
- try
- {
- int nameIdx = 0;
- while (ok && elements.hasNext())
- {
- element = elements.next();
- adapter = getViewAdapter(element);
- Object parentElement = getParentForContent(element);
-
- remoteAdapter = getRemoteAdapter(element);
- if (remoteAdapter != null)
- oldFullName = remoteAdapter.getAbsoluteName(element);
- // pre-rename
- ok = adapter.doRename(getShell(), element, newNames[nameIdx++], null);
- if (ok)
- {
- if (remoteAdapter != null) {
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, remoteAdapter.getSubSystem(element), new String[]{oldFullName}, this);
- }
- else {
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(element, ISystemResourceChangeEvents.EVENT_RENAME, parentElement));
- }
- }
- }
- }
- catch (SystemMessageException exc)
- {
- SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
- ok = false;
- }
- catch (Exception exc)
- {
- //String msg = exc.getMessage();
- //if ((msg == null) || (exc instanceof ClassCastException))
- // msg = exc.getClass().getName();
- SystemMessageDialog.displayErrorMessage(getShell(), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_RENAMING).makeSubstitution(element, exc),
- //msg),
- exc);
- ok = false;
- }
- return ok;
- }
-
- /**
- * Returns the implementation of ISystemRemoteElementAdapter for the given
- * object. Returns null if this object is not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- ISystemRemoteElementAdapter adapter = null;
- if (!(o instanceof IAdaptable))
- adapter = (ISystemRemoteElementAdapter) Platform.getAdapterManager().getAdapter(o, ISystemRemoteElementAdapter.class);
- else
- adapter = (ISystemRemoteElementAdapter) ((IAdaptable) o).getAdapter(ISystemRemoteElementAdapter.class);
- if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
- ((ISystemViewElementAdapter) adapter).setViewer(this);
- return adapter;
- }
-
- /**
- * Returns the implementation of IRemoteObjectIdentifier for the given
- * object. Returns null if this object is not adaptable to this.
- *
- * @deprecated should use {@link #getViewAdapter(Object)} since
- * IRemoteObjectIdentifier is not defined in the adapter factories
- */
- protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o)
- {
- return (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class);
- }
-
- /**
- * Return true if select all should be enabled for the given object.
- * For a tree view, you should return true if and only if the selected object has children.
- * You can use the passed in selection or ignore it and query your own selection.
- */
- public boolean enableSelectAll(IStructuredSelection selection)
- {
- return true;
- }
- /**
- * When this action is run via Edit->Select All or via Ctrl+A, perform the
- * select all action. For a tree view, this should select all the children
- * of the given selected object. You can use the passed in selected object
- * or ignore it and query the selected object yourself.
- */
- public void doSelectAll(IStructuredSelection selection)
- {
-
- Composite tree = getTableTree();
-
- Tree theTree = (Tree) tree;
- theTree.setSelection(theTree.getItems());
- TreeItem[] items = theTree.getItems();
- Object[] objects = new Object[items.length];
- for (int idx = 0; idx < items.length; idx++)
- objects[idx] = items[idx].getData();
- fireSelectionChanged(new SelectionChangedEvent(this, new StructuredSelection(objects)));
-
- }
-
- public void menuAboutToShow(IMenuManager manager)
- {
- SystemView.createStandardGroups(manager);
-
- if (!menuListenerAdded)
- {
- if (manager instanceof MenuManager)
- {
- Menu m = ((MenuManager)manager).getMenu();
- if (m != null)
- {
- menuListenerAdded = true;
- SystemViewMenuListener ml = new SystemViewMenuListener();
- if (_messageLine != null)
- ml.setShowToolTipText(true, _messageLine);
- m.addMenuListener(ml);
- }
- }
- }
- fillContextMenu(manager);
- }
-
- public ISelection getSelection()
- {
- ISelection selection = super.getSelection();
- if (selection == null || selection.isEmpty())
- {
- // make the selection the parent
- ArrayList list = new ArrayList();
- if (_objectInput != null)
- {
- list.add(_objectInput);
- selection = new StructuredSelection(list);
- }
- }
-
- return selection;
- }
-
- public void fillContextMenu(IMenuManager menu) {
-
- IStructuredSelection selection = (IStructuredSelection) getSelection();
-
- boolean allSelectionsFromSameParent = true;
- int selectionCount = selection.size();
-
-
-
- if (selectionCount == 0) // nothing selected
- {
- return;
- }
- else
- {
-
- if (selectionCount == 1) {
-
- if (selection.getFirstElement() == getInput()) {
- //return;
- }
- }
-
- if (selectionCount > 1)
- {
- allSelectionsFromSameParent = sameParent();
-
- if (!allSelectionsFromSameParent)
- {
- if (selectionHasAncestryRelationship())
- {
- // don't show the menu because actions with
- // multiple select on objects that are ancestors
- // of each other is problematic
- // still create the standard groups
- SystemView.createStandardGroups(menu);
- return;
- }
- }
- }
-
- // Partition into groups...
- SystemView.createStandardGroups(menu);
-
- // ADD COMMON ACTIONS...
-
- // COMMON RENAME ACTION...
- if (canRename())
- {
- if (showRename())
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction());
- }
-
- // ADAPTER SPECIFIC ACTIONS
- SystemMenuManager ourMenu = new SystemMenuManager(menu);
-
- Iterator elements = selection.iterator();
- Hashtable adapters = new Hashtable();
- while (elements.hasNext())
- {
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- adapters.put(adapter, element); // want only unique adapters
- }
- Enumeration uniqueAdapters = adapters.keys();
- Shell shell = getShell();
- while (uniqueAdapters.hasMoreElements())
- {
- ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter) uniqueAdapters.nextElement();
- nextAdapter.addActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
-
- if (nextAdapter instanceof AbstractSystemViewAdapter)
- {
-
- AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)nextAdapter;
- // add remote actions
- aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
-
- // add dynamic menu popups
- aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS);
- }
- }
-
- // wail through all actions, updating shell and selection
- IContributionItem[] items = menu.getItems();
- for (int idx = 0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction());
- item.setInputs(getShell(), this, selection);
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager) items[idx];
- item.setInputs(getShell(), this, selection);
- }
- }
-
- // COMMON DELETE ACTION...
- if (canDelete() && showDelete())
- {
- //menu.add(getDeleteAction());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getDeleteAction());
- ((ISystemAction) getDeleteAction()).setInputs(getShell(), this, selection);
- menu.add(new Separator());
- }
-
- // PROPERTIES ACTION...
- // This is supplied by the system, so we pretty much get it for free. It finds the
- // registered propertyPages extension points registered for the selected object's class type.
- //propertyDialogAction.selectionChanged(selection);
-
- PropertyDialogAction pdAction = getPropertyDialogAction();
- if (pdAction.isApplicableForSelection())
- {
-
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
- }
- // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions())
- if (!_selectionIsRemoteObject)
- {
- //SystemCascadingOpenToAction openToAction = getOpenToAction();
- SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction();
- SystemShowInTableAction showInTableAction = getShowInTableAction();
- openToPerspectiveAction.setSelection(selection);
- showInTableAction.setSelection(selection);
- //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction);
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction);
-
- }
-
-
- }
- }
-
- /**
- * This is called to ensure all elements in a multiple-selection have the same parent in the
- * tree viewer. If they don't we automatically disable all actions.
- * <p>
- * Designed to be as fast as possible by going directly to the SWT widgets
- */
- public boolean sameParent()
- {
- boolean same = true;
-
- Tree tree = getTree();
-
- TreeItem[] items = tree.getSelection();
-
- if ((items == null) || (items.length ==0)) {
- return true;
- }
-
- TreeItem prevParent = null;
- TreeItem currParent = null;
-
- for (int idx = 0; idx < items.length; idx++)
- {
- currParent = items[idx].getParentItem();
-
- if ((idx>0) && (currParent != prevParent)) {
- same = false;
- break;
- }
- else
- {
- prevParent = currParent;
- }
- }
- return same;
- }
-
- private boolean selectionHasAncestryRelationship() {
- Tree tree = getTree();
-
- TreeItem[] items = tree.getSelection();
-
- for (int idx=0; idx<items.length; idx++)
- {
- TreeItem item = items[idx];
-
- for (int c=0; c < items.length; c++)
- {
- if (item != items[c])
- {
- if (isAncestorOf(item, items[c], false))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Returns whether an item is an ancestor of another item. The ancestor can be direct or indirect.
- * @param container the item which might be an ancestor.
- * @param item the child.
- * @param direct <code>true</code> if the container must be a direct ancestor of the child item,
- * <code>false</code> otherwise.
- * @return <code>true</code> if there is an ancestry relationship, <code>false</code> otherwise.
- */
- private boolean isAncestorOf(TreeItem container, TreeItem item, boolean direct)
- {
- TreeItem[] children = null;
-
- // does not have to be a direct ancestor
- if (!direct) {
- // get the children of the container's parent, i.e. the container's siblings
- // as well as itself
- TreeItem parent = container.getParentItem();
-
- // check if parent is null
- // parent is null if the container is a root item
- if (parent != null) {
- children = parent.getItems();
- }
- else {
- children = getTree().getItems();
- }
- }
- // must be a direct ancestor
- else {
- // get the children of the container
- children = container.getItems();
- }
-
- // go through all the children
- for (int i = 0; i < children.length; i++) {
-
- TreeItem child = children[i];
-
- // if one of the children matches the child item, return true
- if (child == item && direct) {
- return true;
- }
- // otherwise, go through children, and see if any of those are ancestors of
- // the child item
- else if (child.getItemCount() > 0) {
-
- // we check for direct ancestry
- if (isAncestorOf(child, item, true)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * --------------------------------------------------------------------------------
- * For many actions we have to walk the selection list and examine each selected
- * object to decide if a given common action is supported or not.
- * <p>
- * Walking this list multiple times while building the popup menu is a performance
- * hit, so we have this common method that does it only once, setting instance
- * variables for all of the decisions we are in interested in.
- * --------------------------------------------------------------------------------
- */
- protected void scanSelections()
- {
- // initial these variables to true. Then if set to false even once, leave as false always...
- _selectionShowRefreshAction = true;
- _selectionShowOpenViewActions = true;
- _selectionShowDeleteAction = true;
- _selectionShowRenameAction = true;
- _selectionEnableDeleteAction = true;
- _selectionEnableRenameAction = true;
- _selectionIsRemoteObject = true;
- _selectionFlagsUpdated = true;
-
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- while (elements.hasNext())
- {
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
-
- if (_selectionShowRefreshAction)
- _selectionShowRefreshAction = adapter.showRefresh(element);
-
- if (_selectionShowOpenViewActions)
- _selectionShowOpenViewActions = adapter.showOpenViewActions(element);
-
- if (_selectionShowDeleteAction)
- _selectionShowDeleteAction = adapter.showDelete(element);
-
- if (_selectionShowRenameAction)
- _selectionShowRenameAction = adapter.showRename(element);
-
- if (_selectionEnableDeleteAction)
- _selectionEnableDeleteAction = _selectionShowDeleteAction && adapter.canDelete(element);
- //System.out.println("ENABLE DELETE SET TO " + selectionEnableDeleteAction);
-
- if (_selectionEnableRenameAction)
- _selectionEnableRenameAction = _selectionShowRenameAction && adapter.canRename(element);
-
- if (_selectionIsRemoteObject)
- _selectionIsRemoteObject = (getRemoteAdapter(element) != null);
- }
-
- }
-
-
- public void positionTo(String name)
- {
- ArrayList selectedItems = new ArrayList();
- Tree tree = getTree();
- TreeItem topItem = null;
- for (int i = 0; i < tree.getItemCount(); i++)
- {
- TreeItem item = tree.getItem(i);
- Object data = item.getData();
- if (data instanceof IAdaptable)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(data);
- String itemName = adapter.getName(data);
-
- if (StringCompare.compare(name, itemName, false))
- {
- if (topItem == null)
- {
- topItem = item;
- }
- selectedItems.add(item);
- }
- }
- }
-
- if (selectedItems.size() > 0)
- {
- TreeItem[] tItems = new TreeItem[selectedItems.size()];
- for (int i = 0; i < selectedItems.size(); i++)
- {
- tItems[i] = (TreeItem) selectedItems.get(i);
- }
-
- tree.setSelection(tItems);
- tree.setTopItem(topItem);
- setSelection(getSelection(), true);
- }
- }
-
-
- protected void handleKeyPressed(KeyEvent event)
- {
- if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection) getSelection()).size() > 0))
- {
- scanSelections();
- if (showDelete() && canDelete())
- {
- SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction) getDeleteAction();
- dltAction.setShell(getShell());
- dltAction.setSelection(getSelection());
- dltAction.setViewer(this);
- dltAction.run();
- }
- }
- }
-
- /**
- * Overridden so that we can pass a wrapper IContextObject into the provider to get children instead
- * of the model object, itself
- */
- protected void createChildren(final Widget widget)
- {
- if (widget instanceof TreeItem)
- {
- final Item[] tis = getChildren(widget);
- if (tis != null && tis.length > 0) {
- Object data = tis[0].getData();
- if (data != null) {
- return; // children already there!
- }
- }
-
- BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
- public void run() {
- // fix for PR 1FW89L7:
- // don't complain and remove all "dummies" ...
- if (tis != null) {
- for (int i = 0; i < tis.length; i++) {
- if (tis[i].getData() != null) {
- disassociate(tis[i]);
- Assert.isTrue(tis[i].getData() == null,
- "Second or later child is non -null");//$NON-NLS-1$
-
- }
- tis[i].dispose();
- }
- }
- Object d = widget.getData();
- if (d != null)
- {
- Object parentElement = getContextObject((TreeItem)widget);
- Object[] children = getSortedChildren(parentElement);
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- createTreeItem(widget, children[i], -1);
- }
- }
- }
- }
-
- });
- }
- else
- {
- super.createChildren(widget);
- }
- }
-
-
- /**
- * Get the containing filter reference for an item
- * @param item the item to get the filter reference for
- * @return the filter reference
- */
- public ISystemFilterReference getContainingFilterReference(TreeItem item)
- {
- Object data = item.getData();
- if (data instanceof ISystemFilterReference)
- {
- return (ISystemFilterReference)data;
- }
- else
- {
- TreeItem parent = item.getParentItem();
- if (parent != null)
- {
- return getContainingFilterReference(parent);
- }
- else
- {
- Object input = getInput();
- if (input instanceof ISystemFilterReference)
- {
- return (ISystemFilterReference)input;
- }
- else
- {
- return null;
- }
- }
- }
- }
-
- /**
- * Get the containing subsystem from an item
- * @param item the item to get the subsystem for
- * @return the subsystem
- */
- public ISubSystem getContainingSubSystem(TreeItem item)
- {
- Object data = item.getData();
- if (data instanceof ISubSystem)
- {
- return (ISubSystem)data;
- }
- else
- {
- TreeItem parent = item.getParentItem();
- if (parent != null)
- {
- return getContainingSubSystem(parent);
- }
- else
- {
- Object input = getInput();
- if (input instanceof ISubSystem)
- {
- return (ISubSystem)input;
- }
- else
- {
- return null;
- }
- }
- }
- }
-
- /**
- * Get the context object from a tree item
- * @param item the item to get the context for
- * @return the context object
- */
- public IContextObject getContextObject(TreeItem item)
- {
- Object data = item.getData();
- ISystemFilterReference filterReference = getContainingFilterReference(item);
- if (filterReference != null)
- {
- return new ContextObject(data, filterReference.getSubSystem(), filterReference);
- }
- else
- {
- ISubSystem subSystem = getContainingSubSystem(item);
- if (subSystem != null)
- {
- return new ContextObject(data, subSystem);
- }
- else
- {
- return new ContextObject(data);
- }
- }
- }
-
- /**
- * Overrides the standard viewer method to get the model object from the context object
- */
- public void add(Object parentElementOrTreePath, Object[] childElements) {
- Assert.isNotNull(parentElementOrTreePath);
- assertElementsNotNull(childElements);
-
- if (parentElementOrTreePath instanceof IContextObject)
- {
- parentElementOrTreePath = ((IContextObject)parentElementOrTreePath).getModelObject();
- }
- super.add(parentElementOrTreePath, childElements);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeViewProvider.java
deleted file mode 100644
index bd0b1d177..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableTreeViewProvider.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-
-/**
- * This is the content and label provider for the SystemTableTreeView.
- * This class is used both to populate the SystemTableTreeView but also
- * to resolve the icon and labels for the cells in the table/tree.
- *
- */
-public class SystemTableTreeViewProvider implements ILabelProvider, ITableLabelProvider, ITreeContentProvider
-{
-
-
- private ListenerList listeners = new ListenerList(1);
-
- protected Object[] _lastResults = null;
- protected Object _lastObject = null;
- protected SimpleDateFormat _dateFormat = new SimpleDateFormat();
- protected Viewer _viewer = null;
- protected int _maxCharsInColumnZero = 0;
- private SystemDeferredTableTreeContentManager manager;
- private boolean _disableDeferredQueries = false;
-
- /**
- * The cache of images that have been dispensed by this provider.
- * Maps ImageDescriptor->Image.
- */
- private Map imageTable = new Hashtable(40);
- private SystemTableViewColumnManager _columnManager;
- private HashMap cache;
- /**
- * Constructor for table view provider where a column manager is present.
- * In this case, the columns are customizable by the user.
- * @param columnManager
- */
- public SystemTableTreeViewProvider(SystemTableViewColumnManager columnManager)
- {
- super();
- _columnManager= columnManager;
- cache = new HashMap();
- }
-
- public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
- {
- _viewer = visualPart;
- if (_viewer instanceof AbstractTreeViewer)
- {
- manager = new SystemDeferredTableTreeContentManager(this, (SystemTableTreeView)_viewer);
- }
- }
-
- public void setCache(Object[] newCache)
- {
- _lastResults = newCache;
- }
-
- public Object[] getCache()
- {
- return _lastResults;
- }
-
- public boolean flushCache()
- {
- if (_lastResults == null)
- {
- return false;
- }
- if (_lastObject instanceof ISystemContainer)
- {
- ((ISystemContainer)_lastObject).markStale(true);
- }
-
- _lastResults = null;
- return true;
- }
-
- public boolean isDeleted(Object element)
- {
- return false;
- }
-
- public Object[] getChildren(Object object)
- {
-
- return getElements(object);
- }
-
- public Object getParent(Object object)
- {
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- return adapter.getParent(object);
- }
- else
- {
- return null;
- }
- }
-
- public boolean hasChildren(Object object)
- {
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- return adapter.hasChildren((IAdaptable)object);
- }
- if (manager != null) {
- if (manager.isDeferredAdapter(object))
- return manager.mayHaveChildren(object);
- }
- return false;
- }
-
- public Object getElementAt(Object object, int i)
- {
-
- return null;
- }
-
-
-
- protected ISystemViewElementAdapter getAdapterFor(Object object)
- {
- ISystemViewElementAdapter result = null;
- if (_viewer != null)
- {
- result = SystemAdapterHelpers.getViewAdapter(object, _viewer);
- }
- else
- {
- result = SystemAdapterHelpers.getViewAdapter(object);
- }
- if (result == null)
- {
- return null;
- }
- result.setPropertySourceInput(object);
- return result;
- }
-
- public Object[] getElements(Object object)
- {
-
-
- Object[] results = null;
- if (object == _lastObject && _lastResults != null)
- {
- return _lastResults;
- }
- else
- {
- Object element = object;
- // object could either be a model object or a wrapper IContextObject
- if (object instanceof IContextObject)
- {
- element = ((IContextObject)object).getModelObject();
- }
- {
-
- ISystemViewElementAdapter adapter = getAdapterFor(element);
- adapter.setViewer(_viewer);
-
-
-
- if (adapter.hasChildren((IAdaptable)element))
- {
- if (supportsDeferredQueries())
- {
- if (manager != null)
- {
- ISubSystem ss = adapter.getSubSystem(object);
- if (ss != null && adapter.supportsDeferredQueries(ss))
- {
- // if (ss.isConnected())
- {
-
- results = manager.getChildren(object);
- }
- }
- }
- }
- else
- {
- if (object instanceof IContextObject)
- {
- results = adapter.getChildren((IContextObject)object, new NullProgressMonitor());
- }
- else
- {
- results = adapter.getChildren((IAdaptable)object, new NullProgressMonitor());
- }
- }
- if (adapter instanceof SystemViewRootInputAdapter && results != null)
- {
- ArrayList filterredResults = new ArrayList();
- for (int i = 0; i < results.length; i++)
- {
- Object result = results[i];
- ISystemViewElementAdapter cadapter = getAdapterFor(result);
- if (!(cadapter instanceof SystemViewPromptableAdapter))
- {
- filterredResults.add(result);
- }
- }
- results = filterredResults.toArray();
- }
-
- _lastResults = results;
- _lastObject = object;
- }
- }
- }
- if (results == null)
- {
- return new Object[0];
- }
-
- return results;
- }
-
-
- public String getText(Object object)
- {
- String result = null;
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- result = adapter.getText(object);
- }
- else
- {
- IWorkbenchAdapter wadapter = (IWorkbenchAdapter)((IAdaptable) object).getAdapter(IWorkbenchAdapter.class);
-
- if (wadapter == null)
- {
- return object.toString();
- }
- return wadapter.getLabel(object);
- }
- if (result != null)
- {
- int len = result.length();
- if (len > _maxCharsInColumnZero)
- {
- _maxCharsInColumnZero = len;
- }
- }
- else
- {
- result = ""; //$NON-NLS-1$
- }
- return result;
- }
-
- public int getMaxCharsInColumnZero()
- {
- return _maxCharsInColumnZero;
- }
-
- public Image getImage(Object object)
- {
- ImageDescriptor descriptor = null;
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- descriptor = adapter.getImageDescriptor(object);
- }
- else
- {
- IWorkbenchAdapter wadapter = (IWorkbenchAdapter)((IAdaptable) object).getAdapter(IWorkbenchAdapter.class);
- if (wadapter == null)
- {
- return null;
- }
- else
- {
- descriptor = wadapter.getImageDescriptor(object);
- }
- }
-
- Image image = null;
- if (descriptor != null)
- {
- Object iobj = imageTable.get(descriptor);
- if (iobj == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- else
- {
- image = (Image) iobj;
- }
- }
-
- return image;
- }
-
-
- public String getColumnText(Object obj, int index)
- {
- if (index == 0)
- {
- // get the first descriptor
- return getText(obj);
- }
- else
- {
-
- index = index - 1;
- ISystemViewElementAdapter adapter = getAdapterFor(obj);
- if (adapter == null)
- {
- return null;
- }
-
-
- IPropertyDescriptor[] descriptors = null;
- if (_columnManager != null)
- {
- descriptors = _columnManager.getVisibleDescriptors(adapter);
- }
- else
- {
- descriptors = adapter.getUniquePropertyDescriptors();
- }
-
- if (descriptors.length > index)
- {
- IPropertyDescriptor descriptor = descriptors[index];
-
- try
- {
- Object key = descriptor.getId();
-
- Object propertyValue = adapter.getPropertyValue(key);
-
- if (propertyValue instanceof String)
- {
- return (String) propertyValue;
- }
- else if (propertyValue instanceof Date)
- {
- return _dateFormat.format((Date)propertyValue);
- }
- else
- if (propertyValue != null)
- {
- return propertyValue.toString();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- return ""; //$NON-NLS-1$
- }
-
- }
-
- public Image getColumnImage(Object obj, int i)
- {
- if (i == 0)
- {
- return getImage(obj);
- }
- else
- {
- return null;
- }
- }
-
- public void addListener(ILabelProviderListener listener)
- {
- listeners.add(listener);
- }
-
- public boolean isLabelProperty(Object element, String property)
- {
- return true;
- }
-
- public void removeListener(ILabelProviderListener listener)
- {
- listeners.remove(listener);
- }
-
- /**
- * Cache the objects for the given parent.
- * @param parent the parent object.
- * @param children the children to cache.
- */
- public void setCachedObjects(Object parent, Object[] children) {
- cache.put(parent, children);
- _lastObject = parent;
- _lastResults = children;
- }
-
- /**
- * Returns the cached objects for the given parent.
- * @param parent the parent object.
- * @return the cached children.
- */
- public Object[] getCachedObjects(Object parent) {
- return (Object[])(cache.get(parent));
- }
-
- /**
- * The visual part that is using this content provider is about
- * to be disposed. Deallocate all allocated SWT resources.
- */
- public void dispose() {
- }
-
- public void disableDeferredQueries(boolean disable)
- {
- _disableDeferredQueries = disable;
- }
-
- protected boolean supportsDeferredQueries()
- {
- if (_disableDeferredQueries)
- return false;
- //IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- //return store.getBoolean(ISystemPreferencesConstants.USE_DEFERRED_QUERIES);
- return true; // DKM now enforcing deferred queries
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java
deleted file mode 100644
index 7f875bfd3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import java.util.HashMap;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.view.ISystemTableViewColumnManager;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-
-public class SystemTableViewColumnManager implements ISystemTableViewColumnManager
-{
- private Viewer _viewer;
- protected HashMap _descriptorCache;
- public SystemTableViewColumnManager(Viewer viewer)
- {
- _viewer = viewer;
- _descriptorCache = new HashMap();
- }
-
- protected IPropertyDescriptor[] getCachedDescriptors(ISystemViewElementAdapter adapter)
- {
- Object descriptors = _descriptorCache.get(adapter);
- if (descriptors != null && descriptors instanceof IPropertyDescriptor[])
- {
- return (IPropertyDescriptor[])descriptors;
- }
- return null;
- }
-
- protected void putCachedDescriptors(ISystemViewElementAdapter adapter, IPropertyDescriptor[] descriptors)
- {
- _descriptorCache.put(adapter, descriptors);
- }
-
- public void setCustomDescriptors(ISystemViewElementAdapter adapter, IPropertyDescriptor[] descriptors)
- {
- putCachedDescriptors(adapter, descriptors);
- String historyKey = getHistoryKey(adapter);
- String[] history = new String[descriptors.length];
- for (int i = 0; i < descriptors.length; i++)
- {
- history[i] = descriptors[i].getId().toString();
- }
-
- SystemPreferencesManager.setWidgetHistory(historyKey, history);
- }
-
- /**
- * Gets the property descriptors to display as columns in the table
- * The set of descriptors and their order may change depending on user customizations
- * @param adapter
- * @return the visible descriptors
- */
- public IPropertyDescriptor[] getVisibleDescriptors(ISystemViewElementAdapter adapter)
- {
- if (adapter != null)
- {
- IPropertyDescriptor[] descriptors = getCachedDescriptors(adapter);
- if (descriptors == null)
- {
- return getCustomDescriptors(adapter);
- }
- else
- {
- return descriptors;
- }
- }
-
- return new IPropertyDescriptor[0];
- }
-
- private String getHistoryKey(ISystemViewElementAdapter adapter)
- {
- String adapterName = adapter.getClass().getName();
- String viewName = _viewer.getClass().getName();
- return adapterName + ":" + viewName; //$NON-NLS-1$
- }
-
- protected IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter)
- {
- IPropertyDescriptor[] uniqueDescriptors = adapter.getUniquePropertyDescriptors();
-
- String historyKey = getHistoryKey(adapter);
- String[] history = SystemPreferencesManager.getWidgetHistory(historyKey);
-
- // determine the order and which of the uniqueDescriptors to use based on the history
- if (history != null && history.length > 0)
- {
- int len = history.length;
- if (uniqueDescriptors != null && uniqueDescriptors.length < len)
- {
- len = uniqueDescriptors.length;
- }
- IPropertyDescriptor[] customDescriptors = new IPropertyDescriptor[len];
- if (uniqueDescriptors != null)
- {
- for (int i = 0; i < len; i++)
- {
- String propertyName = history[i];
- // find the associated descriptor
- boolean found = false;
- for (int d = 0; d < uniqueDescriptors.length && !found; d++)
- {
- IPropertyDescriptor descriptor = uniqueDescriptors[d];
- if (propertyName.equals(descriptor.getId().toString()))
- {
- customDescriptors[i] = descriptor;
- found = true;
- }
- }
- // DKM - problem here - no such descriptor exists anymore
- if (found == false)
- {
- // invalidate the current history
- setCustomDescriptors(adapter, uniqueDescriptors);
- return uniqueDescriptors;
- }
- }
- }
- return customDescriptors;
- }
- else
- {
- setCustomDescriptors(adapter, uniqueDescriptors);
- }
-
- return uniqueDescriptors;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewFilter.java
deleted file mode 100644
index 28017c115..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewFilter.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.rse.services.clientserver.StringCompare;
-
-
-/**
- * This class is used for filtering in the SystemTableView. The filter
- * determines what objects to show in the view.
- *
- */
-public class SystemTableViewFilter extends ViewerFilter
-{
-
- private String[] _filters;
-
- public SystemTableViewFilter()
- {
- super();
-
- }
-
- public void setFilters(String[] filters)
- {
- _filters = filters;
- }
-
- public String[] getFilters()
- {
- return _filters;
- }
-
- public boolean select(Viewer viewer, Object parent, Object element)
- {
- boolean result = true;
- if (viewer instanceof TableViewer)
- {
- if (_filters != null)
- {
- TableViewer tviewer = (TableViewer) viewer;
- ITableLabelProvider labelProvider = (ITableLabelProvider) tviewer.getLabelProvider();
-
- for (int i = 0; i < _filters.length && result; i++)
- {
- String filter = _filters[i];
-
- if (filter != null && filter.length() > 0)
- {
- String text = labelProvider.getColumnText(element, i);
- if (!StringCompare.compare(filter, text, true))
- {
- result = false;
- }
- }
- }
- }
- }
- else if (viewer instanceof TreeViewer)
- {
- if (_filters != null)
- {
- TreeViewer tviewer = (TreeViewer) viewer;
- ITableLabelProvider labelProvider = (ITableLabelProvider) tviewer.getLabelProvider();
-
- for (int i = 0; i < _filters.length && result; i++)
- {
- String filter = _filters[i];
-
- if (filter != null && filter.length() > 0)
- {
- String text = labelProvider.getColumnText(element, i);
- if (!StringCompare.compare(filter, text, true))
- {
- result = false;
- }
- }
- }
- }
- }
-
- return result;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
deleted file mode 100644
index ec1c5d1d1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
+++ /dev/null
@@ -1,1993 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Michael Berger (IBM) - 146339 Added refresh action graphic.
- * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [189005] Changed setFocus() to setInput to SystemRegistryUI
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [191288] Up To Action doesn't go all the way back to the connections
- * Xuan Chen (IBM) - [192716] Refresh Error in Table View after Renaming folder shown in table
- * Xuan Chen (IBM) - [194838] Move the code for comparing two objects by absolute name to a common location
- * Kevin Doyle (IBM) - [193394] After Deleting the folder shown in Table get an error
- * Kevin Doyle (IBM) - [197971] NPE when table has no input and doing commands in Systems View
- * Martin Oberhuber (Wind River) - [199585] Fix NPE during testConnectionRemoval unit test
- * David McKnight (IBM) - [187543] use view filter to only show containers for set input dialog
- * David McKnight (IBM) - [210229] table refresh needs unique table-specific tooltip-text
- * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * Xuan Chen (IBM) - [225685] NPE when running archive testcases
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API type
- * Martin Oberhuber (Wind River) - [228774] Improve ElementComparer Performance
- * David McKnight (IBM) - [229116] NPE in when editing remote file in new workspace
- * David McKnight (IBM) - [231867] TVT34:TCT196: PLK: "Subset" window too narrow
- * David Dykstal (IBM) - [231867] TVT34:TCT196: PLK: "Subset" window too narrow
- * David Dykstal (IBM) - [188150] adding "go up one level" tooltip
- * David McKnight (IBM) - [232320] remote system details view restore problem
- * David McKnight (IBM) - [233578] Promptable Filter Displayed 3 times when clicking cancel
- * David Dykstal (IBM) - [233678] title string is constructed by concatenation, should be substituted
-*******************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemRemoteChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.internal.core.model.SystemRegistry;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAction;
-import org.eclipse.rse.ui.actions.SystemTablePrintAction;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.dialogs.SystemSelectAnythingDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.IRSEViewPart;
-import org.eclipse.rse.ui.view.ISystemTableViewColumnManager;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemTableView;
-import org.eclipse.rse.ui.view.SystemTableViewProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.layout.GridData;
-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.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.osgi.framework.Bundle;
-
-import com.ibm.icu.text.MessageFormat;
-
-/**
- * Comment goes here
- */
-public class SystemTableViewPart extends ViewPart
- implements ISelectionListener, ISelectionChangedListener,
- ISystemMessageLine, ISystemShellProvider,
- ISystemResourceChangeListener, ISystemRemoteChangeListener,
- IRSEViewPart
-{
-
- class BrowseAction extends Action
- {
-
- public BrowseAction()
- {
- }
-
- public BrowseAction(String label, ImageDescriptor des)
- {
- super(label, des);
-
- setToolTipText(label);
- }
-
- public void checkEnabledState()
- {
- if (_viewer != null && _viewer.getInput() != null)
- {
- setEnabled(true);
- }
- else
- {
- setEnabled(false);
- }
- }
-
- public void run()
- {
- }
- }
-
- class ForwardAction extends BrowseAction
- {
- public ForwardAction()
- {
- super(SystemResources.ACTION_HISTORY_MOVEFORWARD_LABEL, getEclipseImageDescriptor("elcl16/forward_nav.gif")); //$NON-NLS-1$
-
- setTitleToolTip(SystemResources.ACTION_HISTORY_MOVEFORWARD_TOOLTIP);
- setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/forward_nav.gif")); //$NON-NLS-1$
- }
-
- public void checkEnabledState()
- {
- if (_isLocked && _browseHistory != null && _browseHistory.size() > 0)
- {
- if (_browsePosition < _browseHistory.size() - 1)
- {
- setEnabled(true);
- return;
- }
- }
-
- setEnabled(false);
- }
-
- public void run()
- {
- _browsePosition++;
-
- HistoryItem historyItem = (HistoryItem) _browseHistory.get(_browsePosition);
- setInput(historyItem);
- }
- }
-
- class BackwardAction extends BrowseAction
- {
- public BackwardAction()
- {
- super(SystemResources.ACTION_HISTORY_MOVEBACKWARD_LABEL, getEclipseImageDescriptor("elcl16/backward_nav.gif")); //$NON-NLS-1$
- setTitleToolTip(SystemResources.ACTION_HISTORY_MOVEBACKWARD_TOOLTIP);
- setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/backward_nav.gif")); //$NON-NLS-1$
- }
-
- public void checkEnabledState()
- {
- if (_isLocked && _browseHistory != null && _browseHistory.size() > 0)
- {
- if (_browsePosition > 0)
- {
- setEnabled(true);
- return;
- }
- }
-
- setEnabled(false);
- }
-
- public void run()
- {
- _browsePosition--;
-
- HistoryItem historyItem = (HistoryItem) _browseHistory.get(_browsePosition);
- setInput(historyItem);
- }
- }
-
- class UpAction extends BrowseAction
- {
- private IAdaptable _parent;
- public UpAction()
- {
- super(SystemResources.ACTION_GOUPLEVEL_TOOLTIP, getEclipseImageDescriptor("elcl16/up_nav.gif")); //$NON-NLS-1$
- setDisabledImageDescriptor(getEclipseImageDescriptor("dlcl16/up_nav.gif")); //$NON-NLS-1$
- }
-
- public void checkEnabledState()
- {
- if (_viewer.getInput() != null)
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) _viewer.getContentProvider();
-
- // assume there is a parent
- if (provider != null)
- {
- Object parent = provider.getParent(_viewer.getInput());
- if (parent instanceof IAdaptable)
- {
- _parent = (IAdaptable) parent;
- setEnabled(true);
- }
- else
- {
- _parent = null;
- setEnabled(false);
- }
- }
- else
- {
- _parent = null;
- setEnabled(false);
- }
- }
- else
- {
- _parent = null;
- setEnabled(false);
- }
- }
-
- public void run()
- {
- if (_parent != null)
- {
- setInput(_parent);
- }
- }
- }
-
- class LockAction extends BrowseAction
- {
- public LockAction()
- {
- super();
- setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_LOCK_ID));
- String label = determineLabel();
- setText(label);
- setToolTipText(label);
- }
-
- /**
- * Sets as checked or unchecked, depending on the lock state. Also changes the text and tooltip.
- */
- public void checkEnabledState()
- {
- setChecked(_isLocked);
- String label = determineLabel();
- setText(label);
- setToolTipText(label);
- }
-
- public void run()
- {
- _isLocked = !_isLocked;
- showLock();
- }
-
- /**
- * Returns the label depending on lock state.
- * @return the label.
- */
- public String determineLabel() {
-
- if (!_isLocked) {
- return SystemResources.ACTION_LOCK_LABEL;
- }
- else {
- return SystemResources.ACTION_UNLOCK_LABEL;
- }
- }
-
- /**
- * Returns the tooltip depending on lock state.
- * @return the tooltip.
- */
- public String determineTooltip() {
-
- if (!_isLocked) {
- return SystemResources.ACTION_LOCK_TOOLTIP;
- }
- else {
- return SystemResources.ACTION_UNLOCK_TOOLTIP;
- }
- }
- }
-
- class RefreshAction extends BrowseAction
- {
- public RefreshAction()
- {
- super(SystemResources.ACTION_REFRESH_TABLE_LABLE,
- //RSEUIPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID));
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID));
- setToolTipText(SystemResources.ACTION_REFRESH_TABLE_TOOLTIP);
- }
-
- public void run()
- {
- Object inputObject = _viewer.getInput();
- if (inputObject instanceof ISystemContainer)
- {
- ((ISystemContainer)inputObject).markStale(true);
- }
- ((SystemTableViewProvider) _viewer.getContentProvider()).flushCache();
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.fireEvent(new SystemResourceChangeEvent(inputObject, ISystemResourceChangeEvents.EVENT_REFRESH, inputObject));
-
- //_viewer.refresh();
-
- // refresh layout too
- //_viewer.computeLayout(true);
-
- }
- }
-
- class SelectAllAction extends BrowseAction
- {
- public SelectAllAction()
- {
- super(SystemResources.ACTION_SELECT_ALL_LABEL, null);
- setToolTipText(SystemResources.ACTION_SELECT_ALL_TOOLTIP);
- }
-
- public void checkEnabledState()
- {
- if (_viewer != null && _viewer.getInput() != null)
- {
- setEnabled(true);
- }
- else
- {
- setEnabled(false);
- }
- }
- public void run()
- {
- _viewer.getTable().selectAll();
- // force viewer selection change
- _viewer.setSelection(_viewer.getSelection());
- }
- }
-
- class SelectInputAction extends BrowseAction
- {
- public SelectInputAction()
- {
- super(SystemResources.ACTION_SELECT_INPUT_LABEL, null);
- setToolTipText(SystemResources.ACTION_SELECT_INPUT_TOOLTIP);
- }
-
- public void checkEnabledState()
- {
- setEnabled(true);
- }
-
- public void run()
- {
-
- SystemSelectAnythingDialog dlg = new SystemSelectAnythingDialog(_viewer.getShell(), SystemResources.ACTION_SELECT_INPUT_DLG);
-
- SystemActionViewerFilter filter = new SystemActionViewerFilter();
- Class[] types = {Object.class};
- filter.addFilterCriterion(types, "hasChildren", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- dlg.setViewerFilter(filter);
-
- Object inputObject = _viewer.getInput();
- if (inputObject == null)
- {
- inputObject = RSECorePlugin.getTheSystemRegistry();
- }
- dlg.setInputObject(inputObject);
- if (dlg.open() == Window.OK)
- {
- Object selected = dlg.getSelectedObject();
- if (selected != null && selected instanceof IAdaptable)
- {
- IAdaptable adaptable = (IAdaptable)selected;
- ((ISystemViewElementAdapter)adaptable.getAdapter(ISystemViewElementAdapter.class)).setViewer(_viewer);
- setInput(adaptable);
- }
- }
- }
- }
-
- class PositionToAction extends BrowseAction
- {
- class PositionToDialog extends SystemPromptDialog
- {
- private String _name;
- private Combo _cbName;
- public PositionToDialog(Shell shell, String title, HistoryItem historyItem)
- {
- super(shell, title);
- }
-
- public String getPositionName()
- {
- return _name;
- }
-
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
- _name = _cbName.getText();
- close();
- }
-
- protected Control getInitialFocusControl()
- {
- return _cbName;
- }
-
- public Control createInner(Composite parent)
- {
- Composite c = SystemWidgetHelpers.createComposite(parent, 2);
-
- Label aLabel = new Label(c, SWT.NONE);
- aLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
-
- _cbName = SystemWidgetHelpers.createCombo(c, null);
- GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- _cbName.setLayoutData(textData);
- _cbName.setText("*"); //$NON-NLS-1$
- _cbName.setToolTipText(SystemResources.RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP);
-
- this.getShell().setText(SystemResources.RESID_TABLE_POSITIONTO_LABEL);
- setHelp();
- return c;
- }
-
- private void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX + "gnpt0000"); //$NON-NLS-1$
- }
- }
-
- public PositionToAction()
- {
- super(SystemResources.ACTION_POSITIONTO_LABEL, null);
- setToolTipText(SystemResources.ACTION_POSITIONTO_TOOLTIP);
- }
-
- public void run()
- {
-
- PositionToDialog posDialog = new PositionToDialog(getViewer().getShell(), getTitle(), _currentItem);
- if (posDialog.open() == Window.OK)
- {
- String name = posDialog.getPositionName();
-
- _viewer.positionTo(name);
- }
- }
- }
-
- class SubSetAction extends BrowseAction
- {
- class SubSetDialog extends SystemPromptDialog
- {
- private String[] _filters;
- private Text[] _controls;
- private IPropertyDescriptor[] _uniqueDescriptors;
- private HistoryItem _historyItem;
-
- public SubSetDialog(Shell shell, IPropertyDescriptor[] uniqueDescriptors, HistoryItem historyItem)
- {
- super(shell, SystemResources.RESID_TABLE_SUBSET_LABEL);
- _uniqueDescriptors = uniqueDescriptors;
- _historyItem = historyItem;
- }
-
- public String[] getFilters()
- {
- return _filters;
- }
-
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
-
- for (int i = 0; i < _controls.length; i++)
- {
- _filters[i] = _controls[i].getText();
- }
-
- close();
- }
-
- protected Control getInitialFocusControl()
- {
- return _controls[0];
- }
-
- public Control createInner(Composite parent)
- {
- Composite c = SystemWidgetHelpers.createComposite(parent, 2);
-
- int numberOfFields = _uniqueDescriptors.length;
- _controls = new Text[numberOfFields + 1];
- _filters = new String[numberOfFields + 1];
-
- Label nLabel = new Label(c, SWT.NONE);
- nLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
-
- String[] histFilters = null;
- if (_historyItem != null)
- {
- histFilters = _historyItem.getFilters();
- }
-
- _controls[0] = SystemWidgetHelpers.createTextField(c, null);
- GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- _controls[0].setLayoutData(textData);
- _controls[0].setText("*"); //$NON-NLS-1$
- _controls[0].setToolTipText(SystemResources.RESID_TABLE_SUBSET_ENTRY_TOOLTIP);
-
- if (histFilters != null)
- {
- _controls[0].setText(histFilters[0]);
- }
-
- for (int i = 0; i < numberOfFields; i++)
- {
- IPropertyDescriptor des = _uniqueDescriptors[i];
-
- Label aLabel = new Label(c, SWT.NONE);
- aLabel.setText(des.getDisplayName());
-
- _controls[i + 1] = SystemWidgetHelpers.createTextField(c, null);
- GridData textData3 = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- textData3.widthHint = 150;
- _controls[i + 1].setLayoutData(textData3);
- _controls[i + 1].setText("*"); //$NON-NLS-1$
-
- if (histFilters != null)
- {
- _controls[i + 1].setText(histFilters[i + 1]);
- _controls[i + 1].setToolTipText(SystemResources.RESID_TABLE_SUBSET_ENTRY_TOOLTIP);
- }
- }
-
- setHelp();
- return c;
- }
-
- private void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX + "gnss0000"); //$NON-NLS-1$
- }
- }
-
- public SubSetAction()
- {
- super(SystemResources.ACTION_SUBSET_LABEL, null);
- setToolTipText(SystemResources.ACTION_SUBSET_TOOLTIP);
- }
-
- public void run()
- {
- SubSetDialog subsetDialog = new SubSetDialog(getViewer().getShell(), _viewer.getVisibleDescriptors(_viewer.getInput()), _currentItem);
- if (subsetDialog.open() == Window.OK)
- {
- String[] filters = subsetDialog.getFilters();
- _currentItem.setFilters(filters);
- _viewer.setViewFilters(filters);
- }
- }
- }
-
- class HistoryItem
- {
- private String[] _filters;
- private IAdaptable _object;
-
- public HistoryItem(IAdaptable object, String[] filters)
- {
- _object = object;
- _filters = filters;
- }
-
- public IAdaptable getObject()
- {
- return _object;
- }
-
- public String[] getFilters()
- {
- return _filters;
- }
-
- public void setFilters(String[] filters)
- {
- _filters = filters;
- }
- }
-
- class RestoreStateRunnable extends Job
- {
- private IMemento _rmemento;
- public RestoreStateRunnable(IMemento memento)
- {
- super("Restore RSE Table"); //$NON-NLS-1$
- _rmemento = memento;
- }
-
- public IStatus run(final IProgressMonitor monitor)
- {
- try {
- IStatus wstatus = RSECorePlugin.waitForInitCompletion();
- if (!wstatus.isOK()){
- return wstatus;
- }
- }
- catch (InterruptedException e){
- return Status.CANCEL_STATUS;
- }
-
-
- final IMemento memento = _rmemento;
- String profileId = memento.getString(TAG_TABLE_VIEW_PROFILE_ID);
- String connectionId = memento.getString(TAG_TABLE_VIEW_CONNECTION_ID);
- String subsystemId = memento.getString(TAG_TABLE_VIEW_SUBSYSTEM_ID);
- final String filterID = memento.getString(TAG_TABLE_VIEW_FILTER_ID);
- final String objectID = memento.getString(TAG_TABLE_VIEW_OBJECT_ID);
-
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
-
- Object input = null;
- if (subsystemId == null)
- {
- if (connectionId != null)
- {
-
- ISystemProfile profile = registry.getSystemProfile(profileId);
- input = registry.getHost(profile, connectionId);
- }
- else
- {
- // 191288 we now use registry instead of registry ui as input
- input = registry;
- }
- }
- else
- {
- // from the subsystem ID determine the profile, system and subsystem
- final ISubSystem subsystem = registry.getSubSystem(subsystemId);
-
- if (subsystem != null) {
- if (filterID == null && objectID == null) {
- input = subsystem;
- }
- else {
- if (!subsystem.isConnected()) {
- try {
- final Object finInput = input;
- subsystem.connect(false, new IRSECallback() {
- public void done(IStatus status, Object result) {
- // this needs to be done on the main thread
- // so doing an asynchExec()
- Display.getDefault().asyncExec(new RunOnceConnectedOnMainThread(memento, finInput, subsystem, filterID, objectID));
- }
- });
- return Status.OK_STATUS;
- }
- catch (Exception e) {
- return Status.CANCEL_STATUS;
- }
- }
- return runOnceConnected(monitor, memento, input, subsystem, filterID, objectID);
- } // end else
- } // end if (subsystem != null)
- } // end else
- return runWithInput(monitor, input, memento);
- }
-
- private class RunOnceConnectedOnMainThread implements Runnable
- {
- private IMemento _inmemento;
- private Object _input;
- private ISubSystem _subSystem;
- private String _filterID;
- private String _objectID;
- public RunOnceConnectedOnMainThread(IMemento memento, Object input, ISubSystem subSystem, String filterID, String objectID)
- {
- _inmemento = memento;
- _input = input;
- _subSystem = subSystem;
- _filterID = filterID;
- _objectID = objectID;
- }
-
- public void run()
- {
- runOnceConnected(new NullProgressMonitor(), _inmemento, _input, _subSystem, _filterID, _objectID);
- }
- }
-
- public IStatus runOnceConnected(IProgressMonitor monitor, IMemento memento, Object input, ISubSystem subsystem, String filterID, String objectID)
- {
- if (subsystem.isConnected()) {
- if (filterID != null) {
- try {
- input = subsystem.getObjectWithAbsoluteName(filterID, monitor);
- }
- catch (Exception e) {
- //ignore
- }
- }
- else {
- if (objectID != null) {
- try {
- input = subsystem.getObjectWithAbsoluteName(objectID, monitor);
- }
- catch (Exception e) {
- return Status.CANCEL_STATUS;
- }
- }
- } // end else
- } // end if (subsystem.isConnected)
- return runWithInput(monitor, input, memento);
- }
-
- public IStatus runWithInput(IProgressMonitor monitor, Object input, IMemento memento)
- {
- if (input != null && input instanceof IAdaptable)
- {
- _mementoInput = (IAdaptable) input;
- if (_mementoInput != null && _viewer != null)
- {
- String columnWidths = memento.getString(TAG_TABLE_VIEW_COLUMN_WIDTHS_ID);
- if (columnWidths != null)
- {
- StringTokenizer tok = new StringTokenizer(columnWidths, ","); //$NON-NLS-1$
- int[] colWidths = new int[tok.countTokens()];
- int t = 0;
- while (tok.hasMoreTokens())
- {
- String columnStr = tok.nextToken();
- colWidths[t] = Integer.parseInt(columnStr);
- t++;
- }
-
- _viewer.setLastColumnWidths(colWidths);
- }
-
- // set input needs to be run on the main thread
- Display.getDefault().asyncExec(new Runnable()
- {
- public void run(){
- setInput(_mementoInput);
- }
- });
- }
- }
- return Status.OK_STATUS;
- }
-
- }
-
-
-
- private class SelectColumnsAction extends BrowseAction
- {
-
- class SelectColumnsDialog extends SystemPromptDialog
- {
- private ISystemViewElementAdapter _adapter;
- private ISystemTableViewColumnManager _columnManager;
- private IPropertyDescriptor[] _uniqueDescriptors;
- private ArrayList _currentDisplayedDescriptors;
- private ArrayList _availableDescriptors;
-
- private List _availableList;
- private List _displayedList;
-
- private Button _addButton;
- private Button _removeButton;
- private Button _upButton;
- private Button _downButton;
-
-
- public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, ISystemTableViewColumnManager columnManager)
- {
- super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
- setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_TOOLTIP);
- _adapter = viewAdapter;
- _columnManager = columnManager;
- _uniqueDescriptors = viewAdapter.getUniquePropertyDescriptors();
- IPropertyDescriptor[] initialDisplayedDescriptors = _columnManager.getVisibleDescriptors(_adapter);
- _currentDisplayedDescriptors = new ArrayList(initialDisplayedDescriptors.length);
- for (int i = 0; i < initialDisplayedDescriptors.length;i++)
- {
- if (!_currentDisplayedDescriptors.contains(initialDisplayedDescriptors[i]))
- _currentDisplayedDescriptors.add(initialDisplayedDescriptors[i]);
- }
- _availableDescriptors = new ArrayList(_uniqueDescriptors.length);
- for (int i = 0; i < _uniqueDescriptors.length;i++)
- {
- if (!_currentDisplayedDescriptors.contains(_uniqueDescriptors[i]))
- {
- _availableDescriptors.add(_uniqueDescriptors[i]);
- }
- }
- }
-
-
- public void handleEvent(Event e)
- {
- Widget source = e.widget;
- if (source == _addButton)
- {
- int[] toAdd = _availableList.getSelectionIndices();
- addToDisplay(toAdd);
- }
- else if (source == _removeButton)
- {
- int[] toAdd = _displayedList.getSelectionIndices();
- removeFromDisplay(toAdd);
- }
- else if (source == _upButton)
- {
- int index = _displayedList.getSelectionIndex();
- moveUp(index);
- _displayedList.select(index - 1);
- }
- else if (source == _downButton)
- {
- int index = _displayedList.getSelectionIndex();
- moveDown(index);
- _displayedList.select(index + 1);
- }
-
- // update button enable states
- updateEnableStates();
- }
-
- public IPropertyDescriptor[] getDisplayedColumns()
- {
- IPropertyDescriptor[] displayedColumns = new IPropertyDescriptor[_currentDisplayedDescriptors.size()];
- for (int i = 0; i< _currentDisplayedDescriptors.size();i++)
- {
- displayedColumns[i]= (IPropertyDescriptor)_currentDisplayedDescriptors.get(i);
- }
- return displayedColumns;
- }
-
- private void updateEnableStates()
- {
- boolean enableAdd = false;
- boolean enableRemove = false;
- boolean enableUp = false;
- boolean enableDown = false;
-
- int[] availableSelected = _availableList.getSelectionIndices();
- for (int i = 0; i < availableSelected.length; i++)
- {
- int index = availableSelected[i];
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
- if (!_currentDisplayedDescriptors.contains(descriptor))
- {
- enableAdd = true;
- }
- }
-
- if (_displayedList.getSelectionCount()>0)
- {
- enableRemove = true;
-
- int index = _displayedList.getSelectionIndex();
- if (index > 0)
- {
- enableUp = true;
- }
- if (index < _displayedList.getItemCount()-1)
- {
- enableDown = true;
- }
- }
-
- _addButton.setEnabled(enableAdd);
- _removeButton.setEnabled(enableRemove);
- _upButton.setEnabled(enableUp);
- _downButton.setEnabled(enableDown);
-
- }
-
- private void moveUp(int index)
- {
- Object obj = _currentDisplayedDescriptors.remove(index);
- _currentDisplayedDescriptors.add(index - 1, obj);
- refreshDisplayedList();
- }
-
- private void moveDown(int index)
- {
- Object obj = _currentDisplayedDescriptors.remove(index);
- _currentDisplayedDescriptors.add(index + 1, obj);
-
- refreshDisplayedList();
- }
-
- private void addToDisplay(int[] toAdd)
- {
- ArrayList added = new ArrayList();
- for (int i = 0; i < toAdd.length; i++)
- {
- int index = toAdd[i];
-
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
-
- if (!_currentDisplayedDescriptors.contains(descriptor))
- {
- _currentDisplayedDescriptors.add(descriptor);
- added.add(descriptor);
- }
- }
-
- for (int i = 0; i < added.size(); i++)
- {
- _availableDescriptors.remove(added.get(i));
- }
-
-
- refreshAvailableList();
- refreshDisplayedList();
-
- }
-
- private void removeFromDisplay(int[] toRemove)
- {
- for (int i = 0; i < toRemove.length; i++)
- {
- int index = toRemove[i];
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_currentDisplayedDescriptors.get(index);
- _currentDisplayedDescriptors.remove(index);
- _availableDescriptors.add(descriptor);
- }
- refreshDisplayedList();
- refreshAvailableList();
- }
-
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
-
- close();
- }
-
- protected Control getInitialFocusControl()
- {
- return _availableList;
- }
-
- public Control createInner(Composite parent)
- {
- Composite main = SystemWidgetHelpers.createComposite(parent, 1);
-
-
- Composite c = SystemWidgetHelpers.createComposite(main, 4);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
- _availableList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL, this, true);
-
- Composite addRemoveComposite = SystemWidgetHelpers.createComposite(c, 1);
- addRemoveComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
- _addButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_LABEL,
- this);
- _addButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP);
-
- _removeButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL,
- this);
- _removeButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_TOOLTIP);
-
- _displayedList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL, this, false);
-
- Composite upDownComposite = SystemWidgetHelpers.createComposite(c, 1);
- upDownComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
- _upButton = SystemWidgetHelpers.createPushButton(upDownComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_LABEL,
- this);
- _upButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_TOOLTIP);
-
- _downButton = SystemWidgetHelpers.createPushButton(upDownComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_LABEL,
- this);
- _downButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_TOOLTIP);
-
- initLists();
-
- setHelp();
- return c;
- }
-
- private void initLists()
- {
- refreshAvailableList();
- refreshDisplayedList();
- updateEnableStates();
- }
-
- private void refreshAvailableList()
- {
- _availableList.removeAll();
- // initialize available list
- for (int i = 0; i < _availableDescriptors.size(); i++)
- {
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(i);
- _availableList.add(descriptor.getDisplayName());
- }
- }
-
- private void refreshDisplayedList()
- {
- _displayedList.removeAll();
- // initialize display list
- for (int i = 0; i < _currentDisplayedDescriptors.size(); i++)
- {
-
- Object obj = _currentDisplayedDescriptors.get(i);
- if (obj != null && obj instanceof IPropertyDescriptor)
- {
- _displayedList.add(((IPropertyDescriptor)obj).getDisplayName());
- }
- }
- }
-
- private void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX + "gntc0000"); //$NON-NLS-1$
- }
- }
-
- public SelectColumnsAction()
- {
- super(SystemResources.ACTION_SELECTCOLUMNS_LABEL, null);
- setToolTipText(SystemResources.ACTION_SELECTCOLUMNS_TOOLTIP);
- setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID));
- }
-
- public void checkEnabledState()
- {
- if (_viewer != null && _viewer.getInput() != null)
- {
- setEnabled(true);
- }
- else
- {
- setEnabled(false);
- }
- }
- public void run()
- {
- ISystemTableViewColumnManager mgr = _viewer.getColumnManager();
- ISystemViewElementAdapter adapter = _viewer.getAdapterForContents();
- SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
- if (dlg.open() == Window.OK)
- {
- mgr.setCustomDescriptors(adapter, dlg.getDisplayedColumns());
- _viewer.computeLayout(true);
- _viewer.refresh();
- }
- }
- }
-
- private HistoryItem _currentItem;
-
- private SystemTableView _viewer;
-
- protected ArrayList _browseHistory;
- protected int _browsePosition;
-
- private ForwardAction _forwardAction = null;
- private BackwardAction _backwardAction = null;
- private UpAction _upAction = null;
-
- private LockAction _lockAction = null;
- private RefreshAction _refreshAction = null;
- private SystemRefreshAction _refreshSelectionAction = null;
-
- private SelectInputAction _selectInputAction = null;
- private PositionToAction _positionToAction = null;
- private SubSetAction _subsetAction = null;
- private SystemTablePrintAction _printTableAction = null;
- private SelectColumnsAction _selectColumnsAction = null;
-
- // common actions
- private SystemCopyToClipboardAction _copyAction;
- private SystemPasteFromClipboardAction _pasteAction;
- private SystemCommonDeleteAction _deleteAction;
- private SystemCommonRenameAction _renameAction;
-
- private IMemento _memento = null;
- private IAdaptable _mementoInput = null;
- private Object _lastSelection = null;
-
- private boolean _isLocked = false;
-
- // for ISystemMessageLine
- private String _message, _errorMessage;
- private SystemMessage sysErrorMessage;
- private IStatusLineManager _statusLine = null;
-
- // constants
- public static final String ID = "org.eclipse.rse.ui.view.systemTableView"; // matches id in plugin.xml, view tag //$NON-NLS-1$
-
- // Restore memento tags
- public static final String TAG_TABLE_VIEW_PROFILE_ID = "tableViewProfileID"; //$NON-NLS-1$
- public static final String TAG_TABLE_VIEW_CONNECTION_ID = "tableViewConnectionID"; //$NON-NLS-1$
- public static final String TAG_TABLE_VIEW_SUBSYSTEM_ID = "tableViewSubsystemID"; //$NON-NLS-1$
- public static final String TAG_TABLE_VIEW_OBJECT_ID = "tableViewObjectID"; //$NON-NLS-1$
- public static final String TAG_TABLE_VIEW_FILTER_ID = "tableViewFilterID"; //$NON-NLS-1$
-
- // Subset memento tags
- public static final String TAG_TABLE_VIEW_SUBSET = "subset"; //$NON-NLS-1$
-
- // layout memento tags
- public static final String TAG_TABLE_VIEW_COLUMN_WIDTHS_ID = "columnWidths"; //$NON-NLS-1$
-
- public void setFocus()
- {
- if (_viewer.getInput() == null)
- {
- if (_memento != null)
- {
- restoreState(_memento);
- }
- else
- {
- setInput(RSECorePlugin.getTheSystemRegistry());
- }
- }
-
- _viewer.getControl().setFocus();
- }
-
- public SystemTableView getViewer()
- {
- return _viewer;
- }
-
- public Viewer getRSEViewer()
- {
- return _viewer;
- }
-
- public void createPartControl(Composite parent)
- {
- //Want to register SystemTableViewPart as resouce change listener first, since it may update the _inputObject
- //of the SystemTableView, which will affect the behaviour of the resource change event handling of SystemTableView.
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.addSystemResourceChangeListener(this);
- registry.addSystemRemoteChangeListener(this);
-
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- _viewer = new SystemTableView(table, this);
-
- table.setLinesVisible(true);
-
- ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.addSelectionListener(this);
- _viewer.addSelectionChangedListener(this);
- getSite().setSelectionProvider(_viewer);
-
- _viewer.addDoubleClickListener(new IDoubleClickListener()
- {
- public void doubleClick(DoubleClickEvent event)
- {
- handleDoubleClick(event);
- }
- });
-
- _isLocked = true;
- fillLocalToolBar();
-
- _browseHistory = new ArrayList();
- _browsePosition = 0;
-
- // register global edit actions
- Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
-
- CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
-
- _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard);
- _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard);
- _deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer);
- _renameAction = new SystemCommonRenameAction(_viewer.getShell(), _viewer);
-
- editorActionHandler.setCopyAction(_copyAction);
- editorActionHandler.setPasteAction(_pasteAction);
- editorActionHandler.setDeleteAction(_deleteAction);
- editorActionHandler.setSelectAllAction(new SelectAllAction());
-
- // register rename action as a global handler
- getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.RENAME.getId(), _renameAction);
-
-
- SystemWidgetHelpers.setHelp(_viewer.getControl(), RSEUIPlugin.HELPPREFIX + "sysd0000"); //$NON-NLS-1$
-
- getSite().registerContextMenu(_viewer.getContextMenuManager(), _viewer);
- }
-
- public void selectionChanged(IWorkbenchPart part, ISelection sel)
- {
- if (part != this && (part instanceof SystemViewPart))
- {
- if (!_isLocked)
- {
- if (sel instanceof IStructuredSelection)
- {
- Object first = ((IStructuredSelection) sel).getFirstElement();
- if (_lastSelection != first)
- {
- _lastSelection = first;
- if (first instanceof IAdaptable)
- {
- {
- IAdaptable adapt = (IAdaptable) first;
- ISystemViewElementAdapter va = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class);
- if (va != null && !(va instanceof SystemViewPromptableAdapter))
- {
- if (va.hasChildren(adapt) && adapt != _viewer.getInput())
- {
- setInput(adapt);
- }
- }
- }
- }
- }
- }
- }
- }
- else
- if (part == this)
- {
- updateActionStates();
- }
- }
-
- public void dispose()
- {
- ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.removeSelectionListener(this);
- _viewer.removeSelectionChangedListener(this);
-
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.removeSystemRemoteChangeListener(this);
- registry.removeSystemResourceChangeListener(this);
-
- if (_viewer != null)
- {
- _viewer.dispose();
- }
-
- super.dispose();
- }
-
- private void handleDoubleClick(DoubleClickEvent event)
- {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (element == null)
- return;
-
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element).getAdapter(ISystemViewElementAdapter.class);
- boolean alreadyHandled = false;
- if (adapter != null)
- {
- alreadyHandled = adapter.handleDoubleClick(element);
- if (!alreadyHandled)
- {
- if (adapter.isPromptable(element))
- {
- adapter.getChildren((IAdaptable)element, new NullProgressMonitor());
- }
- else if (adapter.hasChildren((IAdaptable)element))
- {
- setInput((IAdaptable) element);
- }
- }
- }
- }
-
- public void updateActionStates()
- {
- if (_refreshAction == null)
- fillLocalToolBar();
-
- _backwardAction.checkEnabledState();
- _forwardAction.checkEnabledState();
- _upAction.checkEnabledState();
- _lockAction.checkEnabledState();
- _refreshAction.checkEnabledState();
-
- _selectInputAction.checkEnabledState();
- _positionToAction.checkEnabledState();
- _subsetAction.checkEnabledState();
-
- _printTableAction.checkEnabledState();
- _selectColumnsAction.checkEnabledState();
- }
-
- private ImageDescriptor getEclipseImageDescriptor(String relativePath)
- {
- String iconPath = "icons/full/"; //$NON-NLS-1$
- try
- {
- Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
- URL installURL = bundle.getEntry("/"); //$NON-NLS-1$
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e)
- {
- return null;
- }
- }
-
- public void fillLocalToolBar()
- {
-
- if (_refreshAction == null)
- {
- // refresh action
- _refreshAction = new RefreshAction();
-
- // history actions
- _backwardAction = new BackwardAction();
- _forwardAction = new ForwardAction();
-
- // parent/child actions
- _upAction = new UpAction();
-
- // lock action
- _lockAction = new LockAction();
-
- _selectInputAction = new SelectInputAction();
- _positionToAction = new PositionToAction();
- _subsetAction = new SubSetAction();
-
- _printTableAction = new SystemTablePrintAction(getTitle(), _viewer);
- _selectColumnsAction = new SelectColumnsAction();
- }
-
- updateActionStates();
-
- IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolBarManager = actionBars.getToolBarManager();
- IMenuManager menuMgr = actionBars.getMenuManager();
-
-
- _refreshSelectionAction = new SystemRefreshAction(getShell());
- actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), _refreshSelectionAction);
- _refreshSelectionAction.setSelectionProvider(_viewer);
-
- _statusLine = actionBars.getStatusLineManager();
-
- addToolBarItems(toolBarManager);
- addToolBarMenuItems(menuMgr);
- }
-
- private void addToolBarMenuItems(IMenuManager menuManager)
- {
- menuManager.removeAll();
- menuManager.add(_selectColumnsAction);
- menuManager.add(new Separator("View")); //$NON-NLS-1$
- menuManager.add(_selectInputAction);
- menuManager.add(new Separator("Filter")); //$NON-NLS-1$
- menuManager.add(_positionToAction);
- menuManager.add(_subsetAction);
-
- //DKM - this action is useless - remove it
- // menuManager.add(new Separator("Print"));
- // menuManager.add(_printTableAction);
-
- }
-
- private void addToolBarItems(IToolBarManager toolBarManager)
- {
- toolBarManager.removeAll();
-
- _lockAction.setChecked(_isLocked);
-
- toolBarManager.add(_lockAction);
- toolBarManager.add(_refreshAction);
-
-
- toolBarManager.add(new Separator("Navigate")); //$NON-NLS-1$
- // only support history when we're locked
- if (_isLocked)
- {
- toolBarManager.add(_backwardAction);
- toolBarManager.add(_forwardAction);
- }
-
- toolBarManager.add(_upAction);
-
- toolBarManager.add(new Separator("View")); //$NON-NLS-1$
- toolBarManager.add(_selectColumnsAction);
- }
-
- public void showLock()
- {
- if (_upAction != null)
- {
- IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
- toolBarManager.removeAll();
-
- updateActionStates();
-
- addToolBarItems(toolBarManager);
- }
- }
-
- public void selectionChanged(SelectionChangedEvent e)
- {
- // listener for this view
- updateActionStates();
-
- IStructuredSelection sel = (IStructuredSelection) e.getSelection();
- _copyAction.setEnabled(_copyAction.updateSelection(sel));
- _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
- _deleteAction.setEnabled(_deleteAction.updateSelection(sel));
- }
-
- public void setInput(IAdaptable object)
- {
- String[] filters = null;
- if (_currentItem != null)
- {
- IAdaptable item = _currentItem.getObject();
-
- ISystemViewElementAdapter adapter1 = (ISystemViewElementAdapter)object.getAdapter(ISystemViewElementAdapter.class);
- ISystemViewElementAdapter adapter2 = (ISystemViewElementAdapter)item.getAdapter(ISystemViewElementAdapter.class);
- if (adapter1 == adapter2)
- {
- filters = _currentItem.getFilters();
- }
- else
- {
- _viewer.setViewFilters(null);
- }
- }
- setInput(object, filters, _isLocked);
-
- if (!_isLocked)
- {
- _currentItem = new HistoryItem(object, null);
- }
- }
-
- public void setInput(HistoryItem historyItem)
- {
- setInput(historyItem.getObject(), historyItem.getFilters(), false);
-
- _currentItem = historyItem;
-
- }
-
- public void setInput(IAdaptable object, String[] filters, boolean updateHistory)
- {
- if (_viewer != null /*&& object != null*/)
- {
- setTitle(object);
- _viewer.setInput(object);
-
- if (_refreshSelectionAction != null)
- {
- _refreshSelectionAction.updateSelection(new StructuredSelection(object));
- }
- if (filters != null)
- {
- _viewer.setViewFilters(filters);
- }
-
- if (updateHistory)
- {
- while (_browsePosition < _browseHistory.size() - 1)
- {
- _browseHistory.remove(_browseHistory.get(_browseHistory.size() - 1));
- }
-
- _currentItem = new HistoryItem(object, filters);
-
-
- _browseHistory.add(_currentItem);
- _browsePosition = _browseHistory.lastIndexOf(_currentItem);
- }
-
- updateActionStates();
-
- }
- }
-
- public void setTitle(IAdaptable object)
- {
- if (object == null)
- {
- setContentDescription(""); //$NON-NLS-1$
- }
- else
- {
- ISystemViewElementAdapter va = (ISystemViewElementAdapter) object.getAdapter(ISystemViewElementAdapter.class);
- if (va != null)
- {
- String type = va.getType(object);
- String name = va.getName(object);
- String title = MessageFormat.format(SystemResources.SystemTableViewPart_title, new String[] {type, name});
- setContentDescription(title);
- }
- }
- }
-
- /**
- * Used to asynchronously update the view whenever properties change.
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
- Object child = event.getSource();
- Object input = _viewer.getInput();
- switch (event.getType())
- {
- case ISystemResourceChangeEvents.EVENT_RENAME:
- if (child == input)
- {
- setTitle((IAdaptable) child);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE:
- removeFromHistory(event.getSource());
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
- Object[] multi = event.getMultiSource();
- for (int i = 0; i < multi.length; i++) {
- // Update the history to remove all references to object
- removeFromHistory(multi[i]);
- }
- break;
- default:
- break;
- }
- }
-
- protected void removeFromHistory(Object c)
- {
- // if the object is in history, remove it since it's been deleted
- // and remove all objects whose parent is the deleted object
- for (int i = 0; i < _browseHistory.size(); i++)
- {
- HistoryItem hist = (HistoryItem)_browseHistory.get(i);
- Object historyObj = hist.getObject();
- if (historyObj == c || historyObj.equals(c) || isParentOf(c,historyObj))
- {
- _browseHistory.remove(hist);
- if (_browsePosition >= i)
- {
- _browsePosition--;
- if (_browsePosition < 0)
- {
- _browsePosition = 0;
- }
- }
- // Since we are removing an item the size decreased by one so i
- // needs to decrease by one or we will skip elements in _browseHistory
- i--;
- }
- }
-
- if (_currentItem != null) {
- Object currentObject = _currentItem.getObject();
-
- // Update the input of the viewer to the closest item in the history
- // that still exists if the current viewer item has been deleted.
- if (c == currentObject || c.equals(currentObject) || isParentOf(c,currentObject))
- {
- if (_browseHistory.size() > 0)
- {
- _currentItem = (HistoryItem)_browseHistory.get(_browsePosition);
- setInput(_currentItem.getObject(), null, false);
- }
- else
- {
- _currentItem = null;
- setInput(RSECorePlugin.getTheSystemRegistry(), null, true);
- }
- }
- }
- }
-
- protected boolean isParentOf(Object parent, Object child) {
- if (parent instanceof IAdaptable && child instanceof IAdaptable) {
- ISystemDragDropAdapter adapterParent = (ISystemDragDropAdapter) ((IAdaptable)parent).getAdapter(ISystemDragDropAdapter.class);
- ISystemDragDropAdapter adapterChild = (ISystemDragDropAdapter) ((IAdaptable)child).getAdapter(ISystemDragDropAdapter.class);
- // Check that both parent and child are from the same SubSystem
- if (adapterParent != null && adapterChild != null &&
- adapterParent.getSubSystem(parent) == adapterChild.getSubSystem(child)) {
- String parentAbsoluteName = adapterParent.getAbsoluteName(parent);
- String childAbsoluteName = adapterChild.getAbsoluteName(child);
- // Check if the child's absolute name starts with the parents absolute name
- // if it does then parent is the parent of child.
- if(childAbsoluteName != null && childAbsoluteName.startsWith(parentAbsoluteName)) {
- return true;
- }
- }
- }
- return false;
- }
-
-
- /**
- * This is the method in your class that will be called when a remote resource
- * changes. You will be called after the resource is changed.
- * @see org.eclipse.rse.core.events.ISystemRemoteChangeEvent
- */
- public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
- {
- int eventType = event.getEventType();
- Object remoteResource = event.getResource();
- java.util.List remoteResourceNames = null;
- if (remoteResource instanceof java.util.List)
- {
- remoteResourceNames = (java.util.List) remoteResource;
- remoteResource = remoteResourceNames.get(0);
- }
-
- Object child = event.getResource();
-
-
- Object input = _viewer.getInput();
-
- String[] oldNames = event.getOldNames();
- // right now assuming only one resource
- String oldName = (oldNames == null) ? null : oldNames[0];
- boolean referToSameObject = false;
- if (input != null && oldName != null){
- referToSameObject = SystemRegistry.isSameObjectByAbsoluteName(input, null, child, oldName);
- }
-
- if (input == child || child instanceof java.util.List || referToSameObject)
- {
- switch (eventType)
- {
- // --------------------------
- // REMOTE RESOURCE CHANGED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
- break;
-
- // --------------------------
- // REMOTE RESOURCE CREATED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
- break;
-
- // --------------------------
- // REMOTE RESOURCE DELETED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
- {
- if (child instanceof java.util.List)
- {
- java.util.List list = (java.util.List)child;
- for (int v = 0; v < list.size(); v++)
- {
- Object c = list.get(v);
-
- removeFromHistory(c);
- /*
- if (c == input)
- {
- setInput((IAdaptable)null, null, false);
-
- return;
- }
- */
- }
- }
- else
- {
- removeFromHistory(child);
- //setInput((IAdaptable)null);
-
- return;
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
- {
- setInput((IAdaptable)child);
- }
-
- break;
- }
- }
- }
-
- public Shell getShell()
- {
- return _viewer.getShell();
- }
-
- private void restoreState(IMemento memento)
- {
- RestoreStateRunnable rsr = new RestoreStateRunnable(memento);
- rsr.setRule(RSECorePlugin.getTheSystemRegistry());
- rsr.setSystem(true);
- rsr.schedule();
-
- }
-
- /**
- * Initializes this view with the given view site. A memento is passed to
- * the view which contains a snapshot of the views state from a previous
- * session. Where possible, the view should try to recreate that state
- * within the part controls.
- * <p>
- * The parent's default implementation will ignore the memento and initialize
- * the view in a fresh state. Subclasses may override the implementation to
- * perform any state restoration as needed.
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException
- {
- super.init(site, memento);
-
- if (memento != null && SystemPreferencesManager.getRememberState())
- {
- _memento = memento;
-
- }
- }
-
- /**
- * Method declared on IViewPart.
- */
- public void saveState(IMemento memento)
- {
- super.saveState(memento);
-
- if (!SystemPreferencesManager.getRememberState())
- return;
-
- if (_viewer != null)
- {
- Object input = _viewer.getInput();
-
- if (input != null)
- {
- if (input instanceof ISystemRegistry)
- {
-
- }
- else if (input instanceof IHost)
- {
- IHost connection = (IHost) input;
- String connectionID = connection.getAliasName();
- String profileID = connection.getSystemProfileName();
- memento.putString(TAG_TABLE_VIEW_CONNECTION_ID, connectionID);
- memento.putString(TAG_TABLE_VIEW_PROFILE_ID, profileID);
- }
- else
- {
- ISystemViewElementAdapter va = (ISystemViewElementAdapter) ((IAdaptable) input).getAdapter(ISystemViewElementAdapter.class);
-
- ISubSystem subsystem = va.getSubSystem(input);
- if (subsystem != null)
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- String subsystemID = registry.getAbsoluteNameForSubSystem(subsystem);
- String profileID = subsystem.getHost().getSystemProfileName();
- String connectionID = subsystem.getHost().getAliasName();
- String objectID = va.getAbsoluteName(input);
-
- memento.putString(TAG_TABLE_VIEW_PROFILE_ID, profileID);
- memento.putString(TAG_TABLE_VIEW_CONNECTION_ID, connectionID);
- memento.putString(TAG_TABLE_VIEW_SUBSYSTEM_ID, subsystemID);
-
- if (input instanceof ISystemFilterReference)
- {
- memento.putString(TAG_TABLE_VIEW_FILTER_ID, objectID);
- memento.putString(TAG_TABLE_VIEW_OBJECT_ID, null);
- }
- else
- if (input instanceof ISubSystem)
- {
- memento.putString(TAG_TABLE_VIEW_OBJECT_ID, null);
- memento.putString(TAG_TABLE_VIEW_FILTER_ID, null);
- }
- else
- {
- memento.putString(TAG_TABLE_VIEW_OBJECT_ID, objectID);
- memento.putString(TAG_TABLE_VIEW_FILTER_ID, null);
- }
- }
- }
-
- Table table = _viewer.getTable();
- if (table != null && !table.isDisposed())
- {
- String columnWidths = new String();
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < columns.length; i++)
- {
- TableColumn column = columns[i];
- int width = column.getWidth();
- if (i == columns.length - 1)
- {
- columnWidths += width;
- }
- else
- {
- columnWidths += width + ","; //$NON-NLS-1$
- }
- }
- memento.putString(TAG_TABLE_VIEW_COLUMN_WIDTHS_ID, columnWidths);
- }
- }
- }
- }
-
-
-// -------------------------------
- // ISystemMessageLine interface...
- // -------------------------------
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- _errorMessage = null;
- sysErrorMessage = null;
- if (_statusLine != null)
- _statusLine.setErrorMessage(_errorMessage);
- }
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- _message = null;
- if (_statusLine != null)
- _statusLine.setMessage(_message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage()
- {
- return _errorMessage;
- }
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage()
- {
- return _message;
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- this._errorMessage = message;
- if (_statusLine != null)
- _statusLine.setErrorMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- return sysErrorMessage;
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- sysErrorMessage = message;
- setErrorMessage(message.getLevelOneText());
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(Throwable exc)
- {
- setErrorMessage(exc.getMessage());
- }
-
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- this._message = message;
- if (_statusLine != null)
- _statusLine.setMessage(message);
- }
- /**
- *If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- setMessage(message.getLevelOneText());
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java
deleted file mode 100644
index beb554584..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewSorter.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-/**
- * This class is used for sorting in the SystemTableView. The sorter
- * determines what and how to sort based on property descriptors.
- *
- */
-public class SystemTableViewSorter extends ViewerSorter
-{
-
-
- private boolean _reverseSort;
-
- private int _columnNumber;
-
- private StructuredViewer _view;
- private SystemTableViewColumnManager _columnManager;
-
- public SystemTableViewSorter(int columnNumber, StructuredViewer view, SystemTableViewColumnManager columnManager)
- {
- super();
- _reverseSort = false;
- _columnNumber = columnNumber;
- _view = view;
- _columnManager = columnManager;
- }
-
- public boolean isSorterProperty(java.lang.Object element, java.lang.Object property)
- {
- return true;
- }
-
- public int category(Object element)
- {
- return 0;
- }
-
- public int getColumnNumber()
- {
- return _columnNumber;
- }
-
- public boolean isReversed()
- {
- return _reverseSort;
- }
-
- public void setReversed(boolean newReversed)
- {
- _reverseSort = newReversed;
- }
-
- public int compare(Viewer v, Object e1, Object e2)
- {
- Object name1 = getValueFor(e1, _columnNumber);
- Object name2 = getValueFor(e2, _columnNumber);
-
- try
- {
- Object n1 = name1;
- Object n2 = name2;
-
- if (n1.toString().length() == 0)
- return 1;
-
- if (isReversed())
- {
- n1 = name2;
- n2 = name1;
- }
-
- if (n1 instanceof String)
- {
- return ((String) n1).compareTo((String) n2);
- }
- else if (n1 instanceof Date)
- {
- return ((Date) n1).compareTo((Date) n2);
- }
- else if (n1 instanceof Long)
- {
- return ((Long) n1).compareTo((Long) n2);
- }
- else if (n1 instanceof Integer)
- {
- return ((Integer) n1).compareTo((Integer) n2);
- }
- else
- {
- return collator.compare(n1, n2);
- }
- }
- catch (Exception e)
- {
- return 0;
- }
-
- }
-
- private Object getValueFor(Object obj, int index)
- {
- ISystemViewElementAdapter adapter = getAdapterFor(obj);
- if (index == 0)
- {
- return adapter.getText(obj);
- }
-
- Widget widget = _view.testFindItem(obj);
- if (widget != null)
- {
-
- }
-
- index = index - 1;
- IPropertyDescriptor[] descriptors = null;
- if (_columnManager != null)
- {
- descriptors = _columnManager.getVisibleDescriptors(adapter);
- }
- else
- {
- descriptors = adapter.getUniquePropertyDescriptors();
- }
- if (descriptors.length > index)
- {
- IPropertyDescriptor descriptor = descriptors[index];
-
- try
- {
- Object key = descriptor.getId();
-
- Object propertyValue = adapter.getPropertyValue(key, false);
- return propertyValue;
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- return ""; //$NON-NLS-1$
- }
-
- private ISystemViewElementAdapter getAdapterFor(Object object)
- {
- IAdaptable adapt = (IAdaptable) object;
- if (adapt != null)
- {
- ISystemViewElementAdapter result = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class);
- result.setPropertySourceInput(object);
-
- return result;
- }
-
- return null;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java
deleted file mode 100644
index d1ba7aed3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTestFilterStringAPIProviderImpl.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David Dykstal (IBM) - [226561] Add API markup to RSE javadocs for extend / implement
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is used when the contents are used to show the resolution of a single filter string.
- */
-public class SystemTestFilterStringAPIProviderImpl
- extends SystemAbstractAPIProvider
-{
-
-
- protected String filterString = null;
- protected ISubSystem subsystem = null;
-
- /**
- * Constructor
- * @param subsystem The subsystem that will resolve the filter string
- * @param filterString The filter string to test
- */
- public SystemTestFilterStringAPIProviderImpl(ISubSystem subsystem, String filterString)
- {
- super();
- this.subsystem = subsystem;
- this.filterString = filterString;
- }
-
- /**
- * Change the input subsystem
- */
- public void setSubSystem(ISubSystem subsystem)
- {
- this.subsystem = subsystem;
- }
- /**
- * Change the input filter string
- */
- public void setFilterString(String filterString)
- {
- this.filterString = filterString;
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- * We return the result of asking the subsystem to resolve the filter string.
- */
- public Object[] getSystemViewRoots()
- {
- Object[] children = emptyList;
- if (subsystem == null)
- return children;
- try
- {
- children = subsystem.resolveFilterString(filterString, new NullProgressMonitor());
- children = checkForEmptyList(children, null, true);
- } catch (InterruptedException exc)
- {
- children = getCancelledMessageObject();
- } catch (Exception exc)
- {
- children = getFailedMessageObject();
- SystemBasePlugin.logError("Error in SystemTestFilterStringAPIProviderImpl#getSystemViewRoots()",exc); //$NON-NLS-1$
- }
- return children;
- }
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- * We return true on the assumption the filter string will resolve to something.
- */
- public boolean hasSystemViewRoots()
- {
- return true;
- }
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- * <p>NOT APPLICABLE TO US
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- return null; //
- }
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- * <p>NOT APPLICABLE TO US
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return true;
- }
-
-
- // ----------------------------------
- // OUR OWN METHODS...
- // ----------------------------------
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java
deleted file mode 100644
index 0f8a3b7ab..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemView.java
+++ /dev/null
@@ -1,6625 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Kevin Doyle (IBM) - [180875] - Removed part of double click listener that opens files
- * Michael Berger (IBM) - Patch to remove non-standard expand/collapse from menu.
- * Tobias Schwarz (Wind River) - Fix 166343 getChildCount() counts invalid items
- * Martin Oberhuber (Wind River) - Improve fix for 166343 getChildCount()
- * Uwe Stieber (Wind River) - [172492] Use SafeTreeViewer
- * - [177537] [api] Dynamic system type provider need a hook to add dynamic system type specific menu groups
- * - Several bugfixes.
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- * Martin Oberhuber (Wind River) - [186964] Fix adapter actions for multiselect, and and NPE
- * Martin Oberhuber (Wind River) - [186991] Avoid remote refresh if no element is remote
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Kevin Doyle (IBM) - [194602] handleDoubleClick does expand/collapse on treepath instead of element
- * David McKnight (IBM) - [194897] Should not remote refresh objects above subsystem.
- * Kevin Doyle - [193380] Deleting connection Refresh's Entire Remote Systems view
- * Kevin Doyle - [195537] Move ElementComparer to Separate File
- * Martin Oberhuber (Wind River) - [196936] Hide disabled system types
- * David McKnight (IBM) - [187205] Prevented expansion of non-expanded on remote refresh
- * David McKnight (IBM) - [196930] Don't add the connection when it's not supposed to be shown
- * Tobias Schwarz (Wind River) - [197484] Provide ContextObject for queries on all levels
- * David McKnight (IBM) - [196662] Avoid main thread query to check exists when remote refreshing
- * Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
- * Kevin Doyle (IBM) - [196582] Deprecated getRemoteObjectIdentifier
- * Martin Oberhuber (Wind River) - [198650] Fix assertion when restoring workbench state
- * Martin Oberhuber (Wind River) - [183176] Fix "widget is disposed" during Platform shutdown
- * David McKnight (IBM) - [204684] CheckExistsJob used for determining if a remote object exists after a query of it's children
- * David McKnight (IBM) - [205592] CheckExistsJob should use the context model object to get adapter
- * David McKnight (IBM) - [205819] Need to use input stream copy when EFS files are the src
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David McKnight (IBM) - [199424] api to create tree items after query complete
- * David McKnight (IBM) - [187711] expandTo to handle filters specially
- * Martin Oberhuber (Wind River) - [218524][api] Remove deprecated ISystemViewInputProvider#getShell()
- * David Dykstal (IBM) - [222376] NPE if starting on a workspace with an old mark and a renamed default profile
- * David McKnight (IBM) - [224380] system view should only fire property sheet update event when in focus
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- * David Dykstal (IBM) - [225911] Exception received after deleting a profile containing a connection
- * David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
- * David McKnight (IBM) - [231903] TVT34:TCT198: PLK: problems with "Show prompt" checkbox and "New connection prompt"
- * David McKnight (IBM) - [233530] Not Prompted on Promptable Filters after using once by double click
- * David McKnight (IBM) - [233570] ClassCastException when moving filter after "go into" action
- * David Dykstal (IBM) - [233530] Backing out previous change for this bug
- * David McKnight (IBM) - [223461] [Refresh][api] Refresh expanded folder under filter refreshes Filter
- * David McKnight (IBM) - [236874] NPE upon selecting an item that is not associated with subsystem
- * David McKnight (IBM) - [238363] Performance improvement for refresh in system view.
- * David McKnight (IBM) - [241722] New -> File doesn't select the newly created file
- * David McKnight (IBM) - [187739] [refresh] Sub Directories are collapsed when Parent Directory is Refreshed on Remote Systems
- * David Dykstal (IBM) - [233530] Not Prompted on Promptable Filters after using once by double click
- * David McKnight (IBM) - [249245] not showing inappropriate popup actions for: Refresh, Show In Table, Go Into, etc.
- * David McKnight (IBM) - [251851] Backport Widget disposed exception when renaming/pasting a folder
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.IPostSelectionProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ITreePathContentProvider;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.SameShellProvider;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemRemoteChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterContainer;
-import org.eclipse.rse.core.filters.ISystemFilterContainerReference;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IRSECallback;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
-import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingGoToAction;
-import org.eclipse.rse.internal.ui.actions.SystemCollapseAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonSelectAllAction;
-import org.eclipse.rse.internal.ui.actions.SystemExpandAction;
-import org.eclipse.rse.internal.ui.actions.SystemImportConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemOpenExplorerPerspectiveAction;
-import org.eclipse.rse.internal.ui.actions.SystemShowInMonitorAction;
-import org.eclipse.rse.internal.ui.actions.SystemShowInTableAction;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemDeleteTarget;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemRenameTarget;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAction;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.model.ISystemPromptableObject;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.model.SystemRemoteElementResourceSet;
-import org.eclipse.rse.ui.model.SystemResourceChangeEventUI;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.TreeEvent;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.internal.progress.ProgressMessages;
-import org.eclipse.ui.part.EditorInputTransfer;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.ResourceTransfer;
-import org.eclipse.ui.progress.PendingUpdateAdapter;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-import org.eclipse.ui.views.framelist.GoIntoAction;
-
-/**
- * This subclass of the standard JFace tree viewer is used to show a tree
- * view of connections to remote systems, which can be manipulated and expanded
- * to access remote objects in the remote system.
- */
-/*
- * At one time implemented the following as well: MenuListener, IDoubleClickListener, ArmListener, IWireEventTarget
- */
-public class SystemView extends SafeTreeViewer
- implements ISystemTree, ISystemShellProvider,
- ISystemResourceChangeListener, ISystemRemoteChangeListener,
- IMenuListener, IPostSelectionProvider,
- ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget,
- ISelectionChangedListener, ITreeViewerListener
-{
-
- // for deferred queries
- class ExpandRemoteObjects implements IRSECallback {
- private List _toExpand;
-
- public ExpandRemoteObjects(List toExpand){
- _toExpand = toExpand;
- }
-
- public void done(IStatus status, Object result) {
-
- if (Display.getCurrent() != null){ // on main thread
- execute();
- }
- else {
- // need to run this code on main thread
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
- {
- public void run() {
- execute();
- }
- });
- }
- }
-
- private void execute()
- {
- // expand each previously expanded sub-node, recursively
- for (int idx = 0; idx < _toExpand.size(); idx++) {
- ExpandedItem itemToExpand = (ExpandedItem) _toExpand.get(idx);
- if (itemToExpand.isRemote()) {
- // find remote item based on its original name and unchanged root parent
- Item item = null;
- item = findFirstRemoteItemReference(itemToExpand.remoteName, itemToExpand.subsystem, itemToExpand.parentItem);
-
- // if found, re-expand it
- if (item != null && !item.isDisposed()) {
- IRSECallback callback = getCallbackForSubChildren(itemToExpand, _toExpand);
- createChildren(item, callback);
- ((TreeItem) item).setExpanded(true);
- }
- } else if (itemToExpand.data!=null) {
- setExpandedState(itemToExpand.data, true);
- }
- }
- }
-
- private IRSECallback getCallbackForSubChildren(ExpandedItem remoteParent, List itemsToExpand){
- List subChildren = new ArrayList();
-
-
- String parentName = remoteParent.remoteName;
- Object parent = remoteParent.data;
- String absoluteParentName = remoteParent.remoteAdapter.getAbsoluteName(parent);
-
- for (int i = 0; i < itemsToExpand.size(); i++){
- ExpandedItem itemToExpand = (ExpandedItem) itemsToExpand.get(i);
- if (parentName.equals(itemToExpand.remoteName)){
- // same item
- }
- else if (itemToExpand.remoteName != null && itemToExpand.remoteName.startsWith(parentName)){
- // child item
- subChildren.add(itemToExpand);
- }
- else {
- // some objects might need explicit comparison
- Object object = itemToExpand.data;
- ISystemRemoteElementAdapter adapter = itemToExpand.remoteAdapter;
- String childParentName = adapter.getAbsoluteParentName(object);
- if (absoluteParentName.equals(childParentName)){
- subChildren.add(itemToExpand);
- }
- }
- }
-
- if (subChildren.size() > 0){
- return new ExpandRemoteObjects(subChildren);
- }
- else {
- return null;
- }
- }
- }
- protected Shell shell; // shell hosting this viewer: TODO can be removed
- protected ISystemViewInputProvider inputProvider; // who is supplying our tree root elements?
- protected ISystemViewInputProvider previousInputProvider; // who is supplying our tree root elements?
- protected Object previousInput;
- protected IHost previousInputConnection;
- // protected actions initialized on demand:
- // should be accessed by getters only
- private SystemNewConnectionAction _newConnectionAction;
- private SystemImportConnectionAction _importConnectionAction;
- private SystemRefreshAction _refreshAction;
- private PropertyDialogAction _propertyDialogAction;
- private SystemCollapseAction _collapseAction; // defect 41203
- private SystemExpandAction _expandAction; // defect 41203
- private SystemOpenExplorerPerspectiveAction _openToPerspectiveAction;
-
- private SystemShowInTableAction _showInTableAction;
- private SystemShowInMonitorAction _showInMonitorAction;
- private GoIntoAction _goIntoAction;
- private SystemCascadingGoToAction _gotoActions;
- // global actions: to be accessed by getters only
- // Note the Edit menu actions are set in SystemViewPart. Here we use these
- // actions from our own popup menu actions.
- private SystemCommonDeleteAction _deleteAction; // for global delete menu item
- private SystemCommonRenameAction _renameAction; // for common rename menu item
- private SystemCommonSelectAllAction _selectAllAction; // for common Ctrl+A select-all
- // special flags needed when building popup menu, set after examining selections
- protected boolean selectionShowPropertiesAction;
- protected boolean selectionShowRefreshAction;
- protected boolean selectionShowOpenViewActions;
- protected boolean selectionShowGenericShowInTableAction;
- protected boolean selectionShowDeleteAction;
- protected boolean selectionShowRenameAction;
- protected boolean selectionEnableDeleteAction;
- protected boolean selectionEnableRenameAction;
- protected boolean selectionIsRemoteObject;
- protected boolean selectionHasAncestorRelation;
- protected boolean selectionFlagsUpdated = false;
- // misc
- protected MenuManager menuMgr;
- protected boolean showActions = true;
- protected boolean hardCodedConnectionSelected = false;
- protected boolean mixedSelection = false;
- protected boolean specialMode = false;
- protected boolean menuListenerAdded = false;
- protected boolean fromSystemViewPart = false;
- protected boolean areAnyRemote = false;
- protected boolean enabledMode = true;
- protected Widget previousItem = null;
- protected int searchDepth = 0;
- //protected Vector remoteItemsToSkip = null;
- protected Cursor busyCursor;
- protected TreeItem inputTreeItem = null;
- protected static final int SEARCH_INFINITE = 10; // that's far enough down to search!
- public boolean debug = false;
- public boolean debugRemote = false;
- public boolean debugProperties = debug && false;
- // for support of Expand To actions ... transient filters really.
- // we need to record these per tree node they are applied to.
- protected Hashtable expandToFiltersByObject; // most efficient way to find these is by binary object
- protected Hashtable expandToFiltersByTreePath; // however, we lose that after a refresh so we also record by tree path
-
- // message line
- protected ISystemMessageLine messageLine = null;
- // button pressed
- protected static final int LEFT_BUTTON = 1;
- protected int mouseButtonPressed = LEFT_BUTTON; //d40615
- protected boolean expandingTreeOnly = false; //d40615
- protected ViewerFilter[] initViewerFilters = null;
-
- protected List _setList;
-
- /**
- * Constructor
- * @param shell The shell hosting this tree viewer widget
- * @param parent The composite widget into which to place this widget
- * @param inputProvider The input object which will supply the initial root objects in the tree.
- * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
- * @param msgLine Where to display messages and tooltip text
- */
- public SystemView(Shell shell, Composite parent, ISystemViewInputProvider inputProvider, ISystemMessageLine msgLine) {
- super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); // DKM - putting style here to avoid SWT.BORDER (defect 168972)
- assert shell == parent.getShell();
- this.shell = shell;
- this.inputProvider = inputProvider;
- this.messageLine = msgLine;
- init();
- }
-
- /**
- * Constructor to use when you want to specify styles for the tree widget
- * @param shell The shell hosting this tree viewer widget
- * @param parent The composite widget into which to place this widget
- * @param style The style to give the tree widget
- * @param inputProvider The input object which will supply the initial root objects in the tree.
- * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
- * @param msgLine Where to display messages and tooltip text
- */
- public SystemView(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, ISystemMessageLine msgLine) {
- super(parent, style);
- assert shell == parent.getShell();
- this.shell = shell;
- this.inputProvider = inputProvider;
- this.messageLine = msgLine;
- init();
- }
-
- /**
- * Constructor to use when you want to specify styles for the tree widget
- * @param shell The shell hosting this tree viewer widget
- * @param parent The composite widget into which to place this widget
- * @param style The style to give the tree widget
- * @param inputProvider The input object which will supply the initial root objects in the tree.
- * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
- * @param msgLine Where to display messages and tooltip text
- * @param initViewerFilters the initial viewer filters to apply.
- */
- public SystemView(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider, ISystemMessageLine msgLine, ViewerFilter[] initViewerFilters) {
- super(parent, style);
- assert shell == parent.getShell();
- this.shell = shell;
- this.inputProvider = inputProvider;
- this.messageLine = msgLine;
- this.initViewerFilters = initViewerFilters;
- init();
- }
-
- /**
- * Constructor to use when you create your own tree widget.
- * @param shell The shell hosting this tree viewer widget
- * @param tree The Tree widget you created.
- * @param inputProvider The input object which will supply the initial root objects in the tree.
- * Can be null initially, but be sure to call #setInputProvider(ISystemViewInputProvider) later.
- * @param msgLine Where to display messages and tooltip text
- */
- public SystemView(Shell shell, Tree tree, ISystemViewInputProvider inputProvider, ISystemMessageLine msgLine) {
- super(tree);
- assert shell == tree.getShell();
- this.shell = shell;
- this.inputProvider = inputProvider;
- this.messageLine = msgLine;
- init();
- }
-
- /**
- * Set the input provider. Sometimes this is delayed, or can change.
- * @param inputProvider the input provider for this view.
- */
- public void setInputProvider(ISystemViewInputProvider inputProvider) {
- this.inputProvider = inputProvider;
- inputProvider.setViewer(this);
- setInput(inputProvider);
- }
-
- /**
- * Get the SystemViewPart that encapsulates us.
- * Will be null unless fromSystemViewPart is true.
- */
- public SystemViewPart getSystemViewPart() {
- if (fromSystemViewPart)
- return ((SystemViewPart) messageLine);
- else
- return null;
- }
-
- /**
- * Get the workbench window containing this view part. Will only be non-null for the explorer view part,
- * not when used within, say, a dialog
- */
- protected IWorkbenchWindow getWorkbenchWindow() {
- if (fromSystemViewPart)
- return getSystemViewPart().getSite().getWorkbenchWindow();
- else
- return null;
- }
-
- /**
- * Get the workbench part containing this view. Will only be non-null for the explorer view part,
- * not when used within, say, a dialog
- */
- protected IWorkbenchPart getWorkbenchPart() {
- return getSystemViewPart();
- }
-
- /**
- * Disable/Enable the viewer. We do this by blocking keystrokes without visually greying out
- */
- public void setEnabled(boolean enabled) {
- enabledMode = enabled;
- }
-
- /**
- * Sets the label and content provider for the system view.
- * This can be called externally if a custom RSE label and content provider is desired
- * @param lcProvider the provider
- */
- public void setLabelAndContentProvider(SystemViewLabelAndContentProvider lcProvider) {
- ILabelDecorator decorator = null;
- if (PlatformUI.isWorkbenchRunning()) {
- IWorkbench wb = PlatformUI.getWorkbench();
- decorator = wb.getDecoratorManager().getLabelDecorator();
- }
- setLabelProvider(new DecoratingLabelProvider(lcProvider, decorator));
- setContentProvider(lcProvider);
- }
-
- protected void init() {
- _setList = new ArrayList();
- busyCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
-
- setUseHashlookup(true); // new for our 2nd release. Attempt to fix 38 minutes to refresh for 15K elements
- setComparer(new ElementComparer());
-
-
-
- // set content provider
- SystemViewLabelAndContentProvider lcProvider = new SystemViewLabelAndContentProvider();
- setLabelAndContentProvider(lcProvider);
-
- // set initial viewer filters
- if (initViewerFilters != null) {
-
- for (int i = 0; i < initViewerFilters.length; i++) {
- addFilter(initViewerFilters[i]);
- }
- }
-
- fromSystemViewPart = ((messageLine != null) && (messageLine instanceof SystemViewPart));
-
- // set the tree's input. Provides initial roots.
- if (inputProvider != null) {
- inputProvider.setViewer(this);
- setInput(inputProvider);
- if (fromSystemViewPart) {
- previousInputConnection = getInputConnection(getWorkbenchPart().getSite().getPage().getInput());
- }
- }
- //addDoubleClickListener(this);
- addSelectionChangedListener(this);
- addTreeListener(this);
- // ----------------------------------------
- // register with system registry for events
- // ----------------------------------------
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.addSystemResourceChangeListener(this);
- sr.addSystemRemoteChangeListener(this);
- // -----------------------------
- // Enable right-click popup menu
- // -----------------------------
- menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(this);
- Menu menu = menuMgr.createContextMenu(getTree());
- getTree().setMenu(menu);
- // -------------------------------------------
- // Enable specific keys: dbl-click, Delete, F5
- // -------------------------------------------
- addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
- getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- handleKeyPressed(e);
- }
- });
- getControl().addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- mouseButtonPressed = e.button; //d40615
- if (!enabledMode) {
- //e.doit = false;
- return;
- }
- }
- });
-
- initRefreshKey();
-
- // initialize drag and drop
- initDragAndDrop();
- }
-
- /**
- * Create the KeyListener for doing the refresh on the viewer.
- */
- protected void initRefreshKey() {
- /* DKM - no need for explicit key listener since we
- * have global action
- getControl().addKeyListener(new KeyAdapter()
- {
- public void keyReleased(KeyEvent event)
- {
- if (!enabledMode)
- return;
- if (event.keyCode == SWT.F5)
- {
- //if (debug)
- // System.out.println("F5 pressed");
- refreshAll();
- }
- }
- });
- */
- }
-
- /**
- * Handles double clicks in viewer.
- * Expands/Collapses selected item if it can be expanded/collapsed
- */
- protected void handleDoubleClick(DoubleClickEvent event) {
- if (!enabledMode) {
- //event.doit = false;
- return;
- }
- ITreeSelection s = (ITreeSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (element == null) return;
- // Get the path for the element and use it for setting expanded state,
- // so the proper TreeItem is expanded/collapsed
- TreePath[] paths = s.getPathsFor(element);
- if (paths == null || paths.length == 0 || paths[0] == null) return;
- TreePath elementPath = paths[0];
- if (isExpandable(elementPath)) {
- boolean expandedState = getExpandedState(elementPath);
- setExpandedState(elementPath, !expandedState);
- // DWD: fire collapse / expand event
- Event baseEvent = new Event();
- baseEvent.item = findItem(element);
- baseEvent.widget = baseEvent.item;
- TreeEvent treeEvent = new TreeEvent(baseEvent);
- if (expandedState) {
- handleTreeCollapse(treeEvent);
- } else {
- handleTreeExpand(treeEvent);
- }
- return;
- }
- }
-
- /**
- * Handles key events in viewer.
- */
- void handleKeyPressed(KeyEvent event) {
- if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection) getSelection()).size() > 0)) {
- scanSelections("handleKeyPressed"); //$NON-NLS-1$
- /* DKM - 53694
- if (showDelete() && canDelete())
- {
-
- SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction)getDeleteAction();
- dltAction.setShell(getShell());
- dltAction.setSelection(getSelection());
- dltAction.setViewer(this);
- dltAction.run();
-
- }
- */
- } else if ((event.character == '-') && (event.stateMask == SWT.CTRL)) {
- collapseAll();
- } else if ((event.character == 1) && // for some reason Ctrl+A comes in as Ctrl plus the number 1!
- (event.stateMask == SWT.CTRL) && !fromSystemViewPart) {
- //System.out.println("Inside Ctrl+A processing");
- if (enableSelectAll(null)) doSelectAll(null);
- } else if ((event.character == '-') && (((IStructuredSelection) getSelection()).size() > 0)) {
- //System.out.println("Inside Ctrl+- processing");
- collapseSelected();
- } else if ((event.character == '+') && (((IStructuredSelection) getSelection()).size() > 0)) {
- //System.out.println("Inside Ctrl++ processing");
- expandSelected();
- }
-
- }
-
- /**
- * Handles a collapse-selected request
- */
- public void collapseSelected() {
- TreeItem[] selectedItems = ((Tree) getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length > 0)) {
- for (int idx = 0; idx < selectedItems.length; idx++)
- selectedItems[idx].setExpanded(false);
- }
- }
-
- /**
- * Handles an expand-selected request
- */
- public void expandSelected() {
- TreeItem[] selectedItems = ((Tree) getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length > 0)) {
- for (int idx = 0; idx < selectedItems.length; idx++) {
- if (!selectedItems[idx].getExpanded()) {
- createChildren(selectedItems[idx]);
- }
- selectedItems[idx].setExpanded(true);
- }
- }
- }
-
- /**
- * Display a message/status on the message/status line
- */
- public void displayMessage(String msg) {
- if (messageLine != null) messageLine.setMessage(msg);
- }
-
- /**
- * Clear message/status shown on the message/status line
- */
- public void clearMessage() {
- if (messageLine != null) messageLine.clearMessage();
- }
-
- /**
- * Turn off right-click actions
- */
- public void setShowActions(boolean show) {
- this.showActions = show;
- }
-
- /**
- * Return the input provider
- */
- public ISystemViewInputProvider getInputProvider() {
- inputProvider.setViewer(this); // just in case. Added by Phil in V5.0
- return inputProvider;
- }
-
- /**
- * Return the popup menu for the tree
- */
- public Menu getContextMenu() {
- return getTree().getMenu();
- }
-
- /**
- * Return the popup menu for the tree
- */
- public MenuManager getContextMenuManager() {
- return menuMgr;
- }
-
- /**
- * Rather than pre-defining this common action we wait until it is first needed,
- * for performance reasons.
- */
- public IAction getNewConnectionAction() {
- if (_newConnectionAction == null) _newConnectionAction = new SystemNewConnectionAction(getShell(), true, this); // true=>from popup menu
- return _newConnectionAction;
- }
-
- /**
- * Rather than pre-defining this common action we wait until it is first needed,
- * for performance reasons.
- */
- private IAction getImportConnectionAction() {
- if (_importConnectionAction == null) {
- _importConnectionAction = new SystemImportConnectionAction(); // true=>from popup menu
- _importConnectionAction.setShell(getShell());
- _importConnectionAction.setText(SystemResources.RESID_IMPORT_CONNECTION_LABEL_LONG);
- }
- return _importConnectionAction;
- }
-
- /**
- * Return the refresh action
- */
- public IAction getRefreshAction() {
- if (_refreshAction == null) _refreshAction = new SystemRefreshAction(getShell());
- _refreshAction.setId(ActionFactory.REFRESH.getId());
- _refreshAction.setActionDefinitionId("org.eclipse.ui.file.refresh"); //$NON-NLS-1$
- return _refreshAction;
- }
-
- /**
- * @return the collapse action. Lazily creates it.
- */
- public IAction getCollapseAction() {
- if (_collapseAction == null) _collapseAction = new SystemCollapseAction(getShell());
- return _collapseAction;
- }
-
- /**
- * @return the expand action. Lazily creates it.
- */
- public IAction getExpandAction() {
- if (_expandAction == null) _expandAction = new SystemExpandAction(getShell());
- return _expandAction;
- }
-
- /**
- * Rather than pre-defining this common action we wait until it is first needed,
- * for performance reasons.
- */
- public PropertyDialogAction getPropertyDialogAction() {
- if (_propertyDialogAction == null) {
- _propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this);
- _propertyDialogAction.setId(ActionFactory.PROPERTIES.getId());
- _propertyDialogAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PROPERTIES);
- }
-
-
- _propertyDialogAction.selectionChanged(getSelection());
-
- return _propertyDialogAction;
- }
-
-
- /**
- * Return the select All action
- */
- public IAction getSelectAllAction() {
- if (_selectAllAction == null) _selectAllAction = new SystemCommonSelectAllAction(getShell(), this, this);
- return _selectAllAction;
- }
-
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- public IAction getRenameAction() {
- if (_renameAction == null) _renameAction = new SystemCommonRenameAction(getShell(), this);
- _renameAction.setId(ActionFactory.RENAME.getId());
- _renameAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.RENAME);
- return _renameAction;
- }
-
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- public IAction getDeleteAction() {
- if (_deleteAction == null) _deleteAction = new SystemCommonDeleteAction(getShell(), this);
- _deleteAction.setId(ActionFactory.DELETE.getId());
- _deleteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
- return _deleteAction;
- }
-
- /*
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- *
- protected SystemCascadingOpenToAction getOpenToAction()
- {
- if (openToAction == null)
- openToAction = new SystemCascadingOpenToAction(getShell(),getWorkbenchWindow());
- return openToAction;
- } NOT USED YET */
-
- /**
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- */
- public SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction() {
- if (_openToPerspectiveAction == null) _openToPerspectiveAction = new SystemOpenExplorerPerspectiveAction(getShell(), getWorkbenchWindow());
- return _openToPerspectiveAction;
- }
-
- public SystemShowInTableAction getShowInTableAction() {
- if (_showInTableAction == null) _showInTableAction = new SystemShowInTableAction(getShell());
- return _showInTableAction;
- }
-
- public SystemShowInMonitorAction getShowInMonitorAction() {
- if (_showInMonitorAction == null) _showInMonitorAction = new SystemShowInMonitorAction(getShell());
- return _showInMonitorAction;
- }
-
- /**
- * Get the common "Go Into" action for drilling down in the Remote System Explorer view,
- * scoped to the currently selected object.
- */
- public GoIntoAction getGoIntoAction() {
- if (_goIntoAction == null) {
- _goIntoAction = new GoIntoAction(getSystemViewPart().getFrameList());
- _goIntoAction.setText(SystemResources.ACTION_CASCADING_GOINTO_LABEL);
- _goIntoAction.setToolTipText(SystemResources.ACTION_CASCADING_GOINTO_TOOLTIP);
- }
- return _goIntoAction;
- }
-
- /**
- * Get the common "Go To->" cascading menu action for navigating the frame list.
- */
- public SystemCascadingGoToAction getGoToActions() {
- if (_gotoActions == null) _gotoActions = new SystemCascadingGoToAction(getShell(), getSystemViewPart());
- return _gotoActions;
- }
-
- /**
- * Helper method to collapse a node in the tree.
- * Called when a currently expanded subsystem is disconnected.
- * @param forceRefresh true if children should be deleted from memory so re-expand forces refresh.
- */
- public void collapseNode(Object element, boolean forceRefresh) {
- // First, collapse this element and all its children.
- collapseToLevel(element, ALL_LEVELS);
-
- // Collapsed just changes expanded state but leaves existing child
- // widgets in memory so they are re-shown on next expansion.
- // To force the next expand to re-get the children, we have to delete the
- // children.
- if (forceRefresh) {
- refresh(element); // look at AbstractTreeViewer.updateChildren which this
- // will call. If the element is collapsed (which we just
- // did) then its children are simply disposed of, and
- // not re-queried. Just what we want!
- }
- }
-
- /**
- * This is method is called to populate the popup menu
- */
- public void fillContextMenu(IMenuManager menu) {
-
- if (!showActions) return;
- //SystemViewPlugin.getDefault().logMessage("inside fillContextMenu");
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- boolean allSelectionsFromSameParent = true;
- int selectionCount = selection.size();
-
- if (selectionCount == 0) // nothing selected
- {
- menu.add(getNewConnectionAction());
- menu.add(getImportConnectionAction());
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
- } else {
- if (selectionCount > 1) {
- allSelectionsFromSameParent = sameParent();
- if (!allSelectionsFromSameParent) {
- if (selectionHasAncestryRelationship()) {
- // don't show the menu because actions with
- // multiple select on objects that are ancestors
- // of each other is problematic
- // still create the standard groups
- createStandardGroups(menu);
- return;
- }
- }
- }
- // Partition into groups...
- createStandardGroups(menu);
-
- // PRESET INSTANCE VARIABLES ABOUT WHAT COMMON ACTIONS ARE TO BE SHOWN...
- // PERFORMANCE TWEAK: OUR GLOBAL DELETE ACTION LISTENS FOR SELECTION CHANGES, AND
- // WHEN THAT CHANGES, WILL CALL CANDELETE() HERE. THAT IN TURN WILL CALL SCANSELECTIONS.
- // THIS MEANS SCAN SELECTIONS GETS CALL TWICE ON MOST RIGHT CLICK ACTIONS.
- if (!selectionFlagsUpdated) // might already be called by the global delete action wh
- scanSelections("fillContextMenu"); //$NON-NLS-1$
-
- // ADD COMMON ACTIONS...
-
- // COMMON REFRESH ACTION...
- if (showRefresh()) {
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction());
-
- // MJB: Removed as per bugzilla entry # 145843
- //menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getExpandAction()); // defect 41203
- //menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getCollapseAction()); // defect 41203
- }
-
- // COMMON RENAME ACTION...
- if (showRename()) {
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction());
- ((ISystemAction) getRenameAction()).setInputs(getShell(), this, selection);
- }
-
- // COMMON DELETE ACTION...
- if (showDelete()) {
- //menu.add(getDeleteAction());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getDeleteAction());
- ((ISystemAction) getDeleteAction()).setInputs(getShell(), this, selection);
- menu.add(new Separator());
- }
-
- // PROPERTIES ACTION...
- // This is supplied by the system, so we pretty much get it for free. It finds the
- // registered propertyPages extension points registered for the selected object's class type.
- //_propertyDialogAction.selectionChanged(selection);
- if (showProperties()) {
- PropertyDialogAction pdAction = getPropertyDialogAction();
- if (pdAction.isApplicableForSelection()) menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
- }
-
- // GO INTO ACTION...
- // OPEN IN NEW WINDOW ACTION...
- if (fromSystemViewPart) {
-
- Object selectedObject = selection.getFirstElement();
- ISystemViewElementAdapter adapter = getViewAdapter(selectedObject);
- boolean hasChildren = adapter.hasChildren((IAdaptable)selectedObject);
- if (!selectionIsRemoteObject)
- {
- GoIntoAction goIntoAction = getGoIntoAction();
- boolean singleSelection = selection.size() == 1;
- goIntoAction.setEnabled(singleSelection);
- if (singleSelection) {
- // dkm - first find out if the selection will have children
- // only add this action if there are children
- if (hasChildren && showOpenViewActions())
- {
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, goIntoAction);
- }
- }
-
-
- if (showOpenViewActions()) {
- SystemOpenExplorerPerspectiveAction opa = getOpenToPerspectiveAction();
- opa.setSelection(selection);
- menu.appendToGroup(opa.getContextMenuGroup(), opa);
- }
- }
-
- if (showGenericShowInTableAction() && hasChildren) {
- SystemShowInTableAction showInTableAction = getShowInTableAction();
- showInTableAction.setSelection(selection);
- menu.appendToGroup(getOpenToPerspectiveAction().getContextMenuGroup(), showInTableAction);
-
- SystemShowInMonitorAction showInMonitorAction = getShowInMonitorAction();
- showInMonitorAction.setSelection(selection);
- menu.appendToGroup(getOpenToPerspectiveAction().getContextMenuGroup(), showInMonitorAction);
-
- }
- }
-
- // GO TO CASCADING ACTIONS...
- if (fromSystemViewPart && (selectionIsRemoteObject || showOpenViewActions())) {
- SystemCascadingGoToAction gotoActions = getGoToActions();
- gotoActions.setSelection(selection);
- menu.appendToGroup(gotoActions.getContextMenuGroup(), gotoActions.getSubMenu());
- }
-
- // ADAPTER SPECIFIC ACTIONS (Must be the last actions added to the menu!!!)
- SystemMenuManager ourMenu = new SystemMenuManager(menu);
-
- // yantzi:artemis 6.0 (defect 53970), do not show adapter specific actions when
- // there is not a common adapter for all selected elements (i.e. there are 2 or
- // more selected elements that have different adapters
- Iterator elements = selection.iterator();
- //Hashtable adapters = new Hashtable();
- ISystemViewElementAdapter adapter = null;
- boolean skipAdapterActions = false;
-
- // can we ask adapters to contribute menu items?
- // This can be done consistently only if all elements
- // in the (multi) selection adapt to the same adapter instance.
- // otherwise, adapters will not be allowed to contribute.
- while (elements.hasNext() && !skipAdapterActions) {
- Object element = elements.next();
- if (adapter == null) {
- adapter = getViewAdapter(element);
- } else if (adapter != getViewAdapter(element)) {
- // selected elements have different adapters
- skipAdapterActions = true;
- }
- //if (adapter != null)
- // adapters.put(adapter,element); // want only unique adapters
- }
-
- //Enumeration uniqueAdapters = adapters.keys();
- if (adapter != null && !skipAdapterActions) {
- Shell shell = getShell();
-
- //while (uniqueAdapters.hasMoreElements())
- //{
- // ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter)uniqueAdapters.nextElement();
- adapter.addActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
-
- if (adapter instanceof AbstractSystemViewAdapter)
- {
-
- AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)adapter;
-
- // add dynamic menu popups
- aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS);
-
- // add remote actions
- aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
- }
- //}
- }
-
-
- // whale through all actions, updating shell and selection
- IContributionItem[] items = menu.getItems();
- for (int idx = 0; idx < items.length; idx++) {
- if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction)) {
- ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction());
- try {
- item.setInputs(getShell(), this, selection);
- } catch (Exception e) {
- SystemBasePlugin.logError("Error configuring action " + item.getClass().getName(), e); //$NON-NLS-1$
- }
- } else if (items[idx] instanceof SystemSubMenuManager) {
- SystemSubMenuManager item = (SystemSubMenuManager) items[idx];
- item.setInputs(getShell(), this, selection);
- }
- }
-
- // ***** DO NOT ADD ANY ACTIONS AFTER HERE *****
-
- }
-
- }
-
-
- /**
- * Called when the context menu is about to open.
- * Calls {@link #fillContextMenu(IMenuManager)}
- */
- public void menuAboutToShow(IMenuManager menu) {
- if (!enabledMode) return;
- fillContextMenu(menu);
- if (!menuListenerAdded) {
- if (menu instanceof MenuManager) {
- Menu m = ((MenuManager) menu).getMenu();
- if (m != null) {
- menuListenerAdded = true;
- SystemViewMenuListener ml = new SystemViewMenuListener();
- if (messageLine != null) ml.setShowToolTipText(true, messageLine);
- m.addMenuListener(ml);
- }
- }
- }
- //System.out.println("Inside menuAboutToShow: menu null? "+( ((MenuManager)menu).getMenu()==null));
- }
-
- /**
- * Creates the Systems plugin standard groups in a context menu.
- */
- public static IMenuManager createStandardGroups(IMenuManager menu) {
- if (!menu.isEmpty()) return menu;
- // simply sets partitions in the menu, into which actions can be directed.
- // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
- // Deleted groups are not used yet.
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW)); // new->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO)); // goto into, go->
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO)); // expand to->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND)); // expand, collapse
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN)); // open xxx
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH)); // open with->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH)); // open with->
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH)); // work with->
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_SHOW)); // show->type hierarchy, in-navigator
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD)); // build, rebuild, refresh
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE)); // update, change
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); // rename,move,copy,delete,bookmark,refactoring
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); // move up, move down
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE)); // getters/setters, etc. Typically in editor
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH)); // search
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION)); // connection-related actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_STARTSERVER)); // start/stop remote server actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT)); // get or put actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS)); // actions queried from adapters
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_VIEWER_SETUP)); // ? Probably View->by xxx, yyy
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM)); // Team
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_COMPAREWITH));
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_REPLACEWITH));
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES)); // Properties
-
- // [177537] [api] Dynamic system type provider need a hook to add dynamic system type specific menu groups.
- IRSESystemType[] systemTypes = SystemWidgetHelpers.getValidSystemTypes(null);
- for (int i = 0; i < systemTypes.length; i++) {
- IRSESystemType systemType = systemTypes[i];
- Object adapter = systemType.getAdapter(RSESystemTypeAdapter.class);
- if (adapter instanceof RSESystemTypeAdapter) {
- ((RSESystemTypeAdapter)adapter).addCustomMenuGroups(menu);
- }
- }
-
- return menu;
- }
-
- /**
- * protected helper method to add an Action to a given menu.
- * To give the action the opportunity to grey out, we call selectionChanged, but
- * only if the action implements ISelectionChangedListener
- */
- protected void menuAdd(MenuManager menu, IAction action) {
- if (action instanceof ISelectionChangedListener) ((ISelectionChangedListener) action).selectionChanged(new SelectionChangedEvent(this, getSelection()));
- }
-
- /**
- * Determines whether the view has an ancestor relation selection so
- * that actions can be enable/disabled appropriately.
- * For example, delete needs to be disabled when a parent and it's child
- * are both selected.
- * @return true if the selection has one or more ancestor relations
- */
- protected boolean hasAncestorRelationSelection() {
- return selectionHasAncestryRelationship();
- /*
- TreeItem[] elements = getTree().getSelection();
-
-
- //Item[] elements = getSelection(getControl());
- for (int i = 0; i < elements.length; i++) {
- TreeItem parentItem = elements[i];
- //for (int j = 0; j < elements.length; j++) {
- //if (j != i) {
- if (isAncestorOf(parentItem, elements))
- {
- return true;
- }
- //}
- // }
- }
- return false;
- */
- }
-
- /**
- * Handles selection changed in viewer.
- * Updates global actions.
- * Links to editor (if option enabled)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- selectionFlagsUpdated = false;
- _setList = new ArrayList();
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- Object firstSelection = sel.getFirstElement();
- if (firstSelection == null) return;
-
- // added by Phil. Noticed Edit->Delete not enabled when it should be
- boolean enableDelete = true;
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
-
- while (enableDelete && elements.hasNext()) {
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter == null) continue;
- if (enableDelete) enableDelete = adapter.showDelete(element) && adapter.canDelete(element);
- }
- //System.out.println("Enabling delete action: "+enableDelete);
- //System.out.println("Enabling selectAll action: "+enableSelectAll(sel));
- ((SystemCommonDeleteAction) getDeleteAction()).setEnabled(enableDelete);
- ((SystemCommonSelectAllAction) getSelectAllAction()).setEnabled(enableSelectAll(sel)); // added by Phil. Noticed Edit->Select All not enabled when it should be
-
- ISystemViewElementAdapter adapter = getViewAdapter(firstSelection);
- if (adapter != null) {
- displayMessage(adapter.getStatusLineText(firstSelection));
- if ((mouseButtonPressed == LEFT_BUTTON) && (!expandingTreeOnly)) //d40615
- adapter.selectionChanged(firstSelection); //d40615
- } else
- clearMessage();
- //System.out.println("Inside selectionChanged in SystemView");
- expandingTreeOnly = false; //d40615
- }
-
- protected void logMyDebugMessage(String prefix, String msg) {
- if (!debugProperties) return;
- //RSEUIPlugin.logDebugMessage(prefix, msg);
- System.out.println(prefix + " " + msg); //$NON-NLS-1$
- }
-
- /**
- * Convenience method for returning the shell of this viewer.
- */
- public Shell getShell() {
- //getShell() can lead to "widget is disposed" errors, but avoiding them here does not really help
- if (!getTree().isDisposed()) {
- return getTree().getShell();
- }
- return shell;
- }
-
- /**
- * Helper method to determine if a given object is currently selected.
- * Does not consider if a child node of the given object is currently selected.
- */
- protected boolean isSelected(Object element) {
- return isSelected(element, (IStructuredSelection) getSelection());
- }
-
- /**
- * Helper method to determine if a given tree item is currently selected.
- * Does not consider if a child node of the given object is currently selected.
- */
- protected boolean isTreeItemSelected(Widget w) {
- boolean match = false;
- TreeItem[] items = getTree().getSelection();
- if ((items != null) && (items.length > 0)) {
- for (int idx = 0; !match && (idx < items.length); idx++)
- if (items[idx] == w) match = true;
- }
- return match;
- }
-
- /**
- * Helper method to determine if any of a given array of objects is currently selected
- * Does not consider if a child node of the given object is currently selected.
- */
- protected boolean isSelected(Object[] elementArray) {
- return isSelected(elementArray, (IStructuredSelection) getSelection());
- }
-
- /**
- * Helper method to determine if a given object is in given selection
- * Does not consider if a child node of the given object is currently selected.
- */
- protected boolean isSelected(Object element, IStructuredSelection selection) {
- boolean isSelected = false;
- Iterator elements = selection.iterator();
- while (!isSelected && elements.hasNext()) {
- if (element.equals(elements.next())) isSelected = true;
- }
- return isSelected;
- }
-
- /**
- * Helper method to determine if any of a given array of objects is in given selection
- * Does not consider if a child node of the given object is currently selected.
- */
- protected boolean isSelected(Object[] elementArray, IStructuredSelection selection) {
- boolean isSelected = false;
- Iterator elements = selection.iterator();
- while (!isSelected && elements.hasNext()) {
- Object nextSelection = elements.next();
- for (int idx = 0; !isSelected && (idx < elementArray.length); idx++) {
- if (elementArray[idx].equals(nextSelection)) isSelected = true;
- }
- }
- return isSelected;
- }
-
- /**
- * Helper method to determine if a given object is currently selected.
- * Does consider if a child node of the given object is currently selected.
- */
- protected boolean isSelectedOrChildSelected(Object[] parentElements) {
- boolean isSelected = false;
- if ((parentElements == null) || (parentElements.length == 0)) return false;
- for (int idx = 0; !isSelected && (idx < parentElements.length); idx++)
- isSelected = isSelectedOrChildSelected(parentElements[idx]);
- return isSelected;
- }
-
- protected boolean searchToRoot(TreeItem selectedItem, TreeItem searchItem) {
- boolean found = false;
- boolean done = false;
- while (!found && !done) {
- if (selectedItem == searchItem)
- found = true;
- else {
- if (selectedItem != null)
- {
- selectedItem = selectedItem.getParentItem();
- if (selectedItem == null) done = true;
- }
- }
- }
- return found;
- }
-
- /**
- * Called after tree item collapsed. Updates the children of the tree item being
- * collapsed by removing the widgets associated with any transient message objects
- * that were in the tree.
- * @param event the event that caused the collapse. The event data will include the
- * tree element being collapsed.
- */
- public void treeCollapsed(TreeExpansionEvent event) {
- final Object element = event.getElement(); // get parent node being collapsed
- // we always allow adapters opportunity to show a different icon depending on collapsed state
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- String[] allProps = { IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE };
- update(element, allProps); // for refreshing non-structural properties in viewer when model changes
- }
- });
- }
-
- /**
- * Called after tree item expanded.
- * We need this hook to potentially undo user expand request.
- * @param event the SWT TreeExpansionEvent that caused the expansion.
- */
- public void treeExpanded(TreeExpansionEvent event) {
- expandingTreeOnly = true;
- final Object element = event.getElement();
- // we always allow adapters opportunity to show a different icon depending on expanded state
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- updatePropertySheet();
- String[] allProps = { IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE };
- update(element, allProps); // for refreshing non-structural properties in viewer when model changes
- }
- });
- }
-
- /* (non-Javadoc)
- * Here only for observability.
- * @see org.eclipse.jface.viewers.AbstractTreeViewer#handleTreeCollapse(org.eclipse.swt.events.TreeEvent)
- */
- protected void handleTreeCollapse(TreeEvent event) {
- super.handleTreeCollapse(event);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.AbstractTreeViewer#handleTreeExpand(org.eclipse.swt.events.TreeEvent)
- */
- protected void handleTreeExpand(TreeEvent event) {
- TreeItem item = (TreeItem) event.item;
- removeTransientMessages(item);
- Shell shell = getShell();
- Object data = item.getData();
- boolean showBusy = (data instanceof IHost) && ((IHost)data).isOffline();
- if (showBusy) SystemPromptDialog.setDisplayCursor(shell, busyCursor);
- super.handleTreeExpand(event);
- if (showBusy) SystemPromptDialog.setDisplayCursor(shell, null);
- }
-
- /**
- * Remove the transient messages from this item.
- * @param item The tree item whose children should be examined for transient messages.
- */
- private void removeTransientMessages(TreeItem item) {
- // Remove any transient messages prior to finding children. They will be regenerated if they are needed.
- Item[] children = getItems(item);
- if (children != null) {
- for (int i = 0; i < children.length; i++) {
- Item child = children[i];
- Object data = child.getData();
- if (data instanceof ISystemMessageObject) {
- ISystemMessageObject message = (ISystemMessageObject) data;
- if (message.isTransient()) {
- remove(message);
- }
- }
- }
- }
- }
-
-
- /**
- * Clear current selection. Ignore widget disposed message.
- */
- protected void clearSelection() {
- try {
- setSelection((ISelection) null);
- } catch (Exception exc) {
- }
- }
-
-
-
- /**
- * Returns the implementation of ISystemViewElementAdapter for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o) {
-
- ISystemViewInputProvider provider = getInputProvider();
-
- // should never be null, but we check just to be safe
- // the input provider should be set because for things like connections, the select
- // dialogs may set a different input provider for the connection adapter which is subsequently
- // not updated when selecting a connection in the Remote Systems view.
- // This ensures that the input provider for the Remote Systems view is set for the adapter.
- if (provider != null) {
- return SystemAdapterHelpers.getViewAdapter(o, this, provider);
- } else {
- return SystemAdapterHelpers.getViewAdapter(o, this);
- }
- }
-
- /**
- * Returns the implementation of IRemoteObjectIdentifier for the given
- * object. Returns null if this object is not adaptable to this.
- *
- * @deprecated should use {@link #getViewAdapter(Object)} since IRemoteObjectIdentifier
- * is not defined in the adapter factories
- */
- protected IRemoteObjectIdentifier getRemoteObjectIdentifier(Object o)
- {
- return (IRemoteObjectIdentifier)((IAdaptable)o).getAdapter(IRemoteObjectIdentifier.class);
- }
-
- /**
- * Returns the implementation of ISystemRemoteElementAdapter for the given
- * object. Returns null if this object is not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- if (o instanceof IAdaptable)
- {
- return (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
- }
- return null;
- }
-
-
- /**
- *
- */
- public void handleDispose(DisposeEvent event) {
- //if (debug)
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"Inside handleDispose for SystemView");
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.removeSystemResourceChangeListener(this);
- sr.removeSystemRemoteChangeListener(this);
- busyCursor.dispose();
- super.handleDispose(event);
- }
-
- /**
- * Return the connection of the selected object, whatever it is.
- */
- public IHost getSelectedConnection() {
- Object firstSelection = ((StructuredSelection) getSelection()).getFirstElement();
- if (firstSelection == null)
- return null;
- else if (firstSelection instanceof IHost)
- return (IHost) firstSelection;
- else if (firstSelection instanceof ISubSystem)
- return ((ISubSystem) firstSelection).getHost();
- else if (firstSelection instanceof ISystemFilterPoolReference)
- return ((ISubSystem) (((ISystemFilterPoolReference) firstSelection).getProvider())).getHost();
- else if (firstSelection instanceof ISystemFilterReference)
- return ((ISubSystem) (((ISystemFilterReference) firstSelection).getProvider())).getHost();
- else if (getViewAdapter(firstSelection) != null) {
- ISubSystem ss = getViewAdapter(firstSelection).getSubSystem(firstSelection);
- if (ss != null)
- return ss.getHost();
- else
- return null;
- } else
- return null;
- }
-
- /**
- * We override getSelection(Control) so that a list of items
- * under the same parent always gets returned in the order in which
- * they appear in the tree view. Otherwise, after a "move up" or
- * "move down", the order of selection can come back wrong.
- */
- protected Item[] getSelection(Control widget) {
- Tree tree = (Tree) widget;
- Item[] oldResult = tree.getSelection();
- if (oldResult != null && oldResult.length > 0) {
- if (oldResult[0] instanceof TreeItem) {
- Widget parentItem = ((TreeItem) oldResult[0]).getParentItem();
- if (parentItem == null) {
- parentItem = tree;
- }
- if (itemsShareParent(parentItem, oldResult)) {
- Item[] newResult = sortSelection(parentItem, oldResult);
- return newResult;
- }
- }
- }
- return oldResult;
- }
-
- protected boolean itemsShareParent(Widget parentItem, Item[] items) {
- for (int i = 0; i < items.length; i++) {
- Widget itemParent = ((TreeItem) items[i]).getParentItem();
- if (parentItem instanceof TreeItem) {
- if (itemParent != parentItem) {
- return false;
- }
- } else if (itemParent != null) {
- return false;
- }
- }
-
- return true;
- }
-
- protected Item[] sortSelection(Widget parentItem, Item[] oldResult) {
- Item[] children = null;
- Item[] newResult = new Item[oldResult.length];
- if (parentItem instanceof Item) {
- children = oldResult;
- } else
- children = getChildren(parentItem);
-
- for (int i = 0; i < oldResult.length; i++)
- {
- Item first = removeFirstItem(oldResult, children);
- newResult[i] = first;
- }
-
- return newResult;
-
- }
-
-
- protected Item removeFirstItem(Item[] items, Item[] children)
- {
- if (items != null)
- {
- for (int i = 0; i < items.length; i++)
- {
- if (items[i] != null)
- {
- Item current = items[i];
- items[i] = null;
- return current;
- }
- }
- }
- return null;
- }
-
-
-
- /**
- * Move one tree item to a new location
- */
- protected void moveTreeItem(Widget parentItem, Item item, Object src, int newPosition) {
- if (item==null) {
- //Null items during RSECombinedTestSuite - put debugBreak here to investigate
- assert item!=null;
- return;
- }
- if (getExpanded(item)) {
- setExpanded(item, false);
- refresh(src); // flush items from memory
- }
-
- createTreeItem(parentItem, src, newPosition);
-
- //createTreeItem(parentItem, (new String("New")), newPosition);
- //remove(src);
-
- disassociate(item);
- item.dispose();
- // TODO: make this work so the selection order doesn't get screwed up!
- }
-
- /**
- * Move existing items a given number of positions within the same node.
- * If the delta is negative, they are all moved up by the given amount. If
- * positive, they are all moved down by the given amount.<p>
- */
- protected void moveTreeItems(Widget parentItem, Object[] src, int delta) {
- int[] oldPositions = new int[src.length];
- Item[] oldItems = new Item[src.length];
-
- for (int idx = 0; idx < src.length; idx++)
- oldItems[idx] = (Item) internalFindRelativeItem(parentItem, src[idx], 1);
-
- Item[] children = null;
- if (parentItem instanceof Item) {
- children = getItems((Item) parentItem);
- } else
- children = getChildren(parentItem);
-
- for (int idx = 0; idx < src.length; idx++)
- {
- oldPositions[idx] = getTreeItemPosition(oldItems[idx], children) + 1;
- }
-
- if (delta > 0) // moving down, process backwards
- {
- for (int idx = src.length - 1; idx >= 0; idx--) {
- moveTreeItem(parentItem, oldItems[idx], src[idx], oldPositions[idx] + delta);
- }
- } else // moving up, process forewards
- {
- for (int idx = 0; idx < src.length; idx++) {
- moveTreeItem(parentItem, oldItems[idx], src[idx], oldPositions[idx] + delta - 1);
- }
- }
- }
-
-
-
- /**
- * Get the position of a tree item within its parent
- */
- /*
- protected int getTreeItemPosition(Widget parentItem, Item childItem, Item[] items) {
- int pos = -1;
- Item[] children = null;
- if (parentItem instanceof Item) {
- if (items == null)
- children = getItems((Item) parentItem);
- else
- children = items;
- } else
- children = getChildren(parentItem);
- for (int idx = 0; (pos == -1) && (idx < children.length); idx++) {
- if (children[idx] == childItem) pos = idx;
- }
- return pos;
- }
- */
-
-
- /**
- * Get the position of a tree item within its parent
- */
- protected int getTreeItemPosition(Item childItem, Item[] children) {
- int pos = -1;
- for (int idx = 0; (pos == -1) && (idx < children.length); idx++) {
- if (children[idx] == childItem) pos = idx;
- }
- return pos;
- }
-
-
- /**
- * Expand a given filter, given a subsystem that contains a reference to the filter's pool.
- * This will expand down to the filter if needed
- * @param parentSubSystem - the subsystem containing a reference to the filter's parent pool
- * @param filter - the filter to find, reveal, and expand within the subsystem context
- * @return the filter reference to the filter if found and expanded. This is a unique binary address
- * within the object's in this tree, so can be used in the viewer methods to affect this particular
- * node.
- */
- public ISystemFilterReference revealAndExpand(ISubSystem parentSubSystem, ISystemFilter filter) {
- setExpandedState(parentSubSystem.getHost(), true); // expand the connection
- setExpandedState(parentSubSystem, true); // expand the subsystem
- Object filterParentInTree = parentSubSystem; // will be case unless in show filter pool mode
- // if showing filter pools, expand parent filter pool reference...
- if (SystemPreferencesManager.getShowFilterPools()) {
- ISystemFilterPoolReference poolRef = parentSubSystem.getFilterPoolReferenceManager().getReferenceToSystemFilterPool(filter.getParentFilterPool());
- setExpandedState(poolRef, true);
- filterParentInTree = poolRef;
- }
- // now, find the filter reference, and expand it...
- Widget parentItem = findItem(filterParentInTree); // find tree widget of parent
- if ((parentItem == null) || !(parentItem instanceof Item)) return null;
- TreeItem child = (TreeItem) internalFindReferencedItem(parentItem, filter, 1);
- if (child == null) return null;
- // found it! Now expand it...
- setExpandedState(child.getData(), true);
- return (ISystemFilterReference) child.getData();
- }
-
- // ------------------------------------
- // ISYSTEMRESOURCEChangeListener METHOD
- // ------------------------------------
-
- /**
- * Called when something changes in the model
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event) {
- if (!getControl().isDisposed()) {
- ResourceChangedJob job = new ResourceChangedJob(event, this);
- job.setPriority(Job.INTERACTIVE);
- //job.setUser(true);
- job.schedule();
- /*
- Display display = Display.getCurrent();
- try {
- while (job.getResult() == null) {
- while (display != null && display.readAndDispatch()) {
- //Process everything on event queue
- }
- if (job.getResult() == null) Thread.sleep(200);
- }
- } catch (InterruptedException e) {
- }
- */
- } else {
- trace("resource changed while shutting down"); //$NON-NLS-1$
- }
- }
-
- public void trace(String str) {
- String id = RSEUIPlugin.getDefault().getBundle().getSymbolicName();
- String val = Platform.getDebugOption(id + "/debug"); //$NON-NLS-1$
- if ("true".equals(val)) { //$NON-NLS-1$
- try {
- throw new IllegalStateException(str);
- } catch(IllegalStateException e) {
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Inner class which extends UIJob to connect this connection
- * on the UI Thread when no Shell is available from
- * the caller
- */
- public class ResourceChangedJob extends UIJob {
-
- protected ISystemResourceChangeEvent _event;
- protected SystemView _originatingViewer;
- //public Exception _originatingThread; //for debugging
-
- public ResourceChangedJob(ISystemResourceChangeEvent event, SystemView originatingViewer) {
- super("Resource Changed..."); //$NON-NLS-1$
- //FIXME Shouldn't the originatingViewer be taken from the event if possible, if it is instanceof ISystemResourceChangeEventUI?
- //See also originatedHere, below
- _originatingViewer = originatingViewer;
- _event = event;
- //_originatingThread = new Exception();
- //_originatingThread.fillInStackTrace();
- ////_originatingThread.printStackTrace();
- ////System.out.println("<<<<<<<<<<<<<");
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (getControl().isDisposed()) {
- trace("SystemView: refresh after disposed"); //$NON-NLS-1$
- return Status.CANCEL_STATUS;
- }
- int type = _event.getType();
- Object src = _event.getSource();
- Object parent = _event.getParent();
-
- String[] properties = new String[1];
- if (parent == RSECorePlugin.getTheSystemRegistry()) parent = inputProvider;
- ISubSystem ss = null;
- Widget item = null;
- Widget parentItem = null;
- Object[] multiSource = null;
- Object previous = null;
- boolean wasSelected = false;
- boolean originatedHere = true;
- if (_event instanceof SystemResourceChangeEventUI) {
- Viewer viewer = ((SystemResourceChangeEventUI)_event).getOriginatingViewer();
- if (viewer!=null && viewer!=_originatingViewer) {
- originatedHere = false;
- }
- Object viewerItem = ((SystemResourceChangeEventUI)_event).getViewerItem();
- if (viewerItem instanceof TreeItem) {
- inputTreeItem = (TreeItem)viewerItem;
- } else {
- inputTreeItem = null;
- }
- } else {
- inputTreeItem = null;
- }
-
- //logDebugMsg("INSIDE SYSRESCHGD: " + type + ", " + src + ", " + parent);
- switch (type) {
- // SPECIAL CASES: ANYTHING TO DO WITH FILTERS!!
- case ISystemResourceChangeEvents.EVENT_RENAME_FILTER_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_CHANGE_FILTER_REFERENCE:
- findAndUpdateFilter(_event, type);
- break;
- case ISystemResourceChangeEvents.EVENT_CHANGE_FILTERSTRING_REFERENCE:
- findAndUpdateFilterString(_event, type);
- break;
-
- case ISystemResourceChangeEvents.EVENT_ADD_FILTERSTRING_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_DELETE_FILTERSTRING_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_MOVE_FILTERSTRING_REFERENCES:
- //findAndUpdateFilterStringParent(event, type);
- //break;
- case ISystemResourceChangeEvents.EVENT_ADD_FILTER_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_DELETE_FILTER_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_MOVE_FILTER_REFERENCES:
- // are we a secondary perspective, and our input or parent of our input was deleted?
- if ((
- (type == ISystemResourceChangeEvents.EVENT_DELETE_FILTERSTRING_REFERENCE)
- || (type == ISystemResourceChangeEvents.EVENT_DELETE_FILTER_REFERENCE)
- )
- && affectsInput(src)
- ) {
- close();
- return Status.OK_STATUS;
- }
-
- findAndUpdateFilterParent(_event, type);
- break;
-
- case ISystemResourceChangeEvents.EVENT_ADD:
- case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE:
- if (debug) {
- logDebugMsg("SV event: EVENT_ADD "); //$NON-NLS-1$
- }
- clearSelection();
- //refresh(parent);t
- parentItem = findItem(parent);
- if (parentItem == null) return Status.OK_STATUS;
- if ((parentItem instanceof Item) && !getExpanded((Item) parentItem)) {
- refresh(parent); // flush cached stuff so next call will show new item
- } else if ((parentItem instanceof Item) || // regular node
- (parent == inputProvider)) // root node. Hmm, hope this is going to work in all cases
- {
- boolean addingConnection = (src instanceof IHost);
- if (addingConnection)
- {
- // 196930 - don't add the connection when it's not supposed to be shown
- IHost con = (IHost)src;
- IRSESystemType sysType = con.getSystemType();
- if (sysType != null) { // sysType can be null if workspace contains a host that is no longer defined by the workbench
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(sysType.getAdapter(RSESystemTypeAdapter.class));
-
- if (adapter == null || !adapter.isEnabled(sysType))
- {
- // don't add this if our src is not enabled
- return Status.OK_STATUS;
- }
- }
- else {
- return Status.OK_STATUS;
- }
- }
-
- //System.out.println("ADDING CONNECTIONS.........................: " + addingConnection);
- //System.out.println("event.getParent() instanceof SystemRegistry: " + (event.getParent() instanceof SystemRegistry));
- //System.out.println("inputProvider.showingConnections().........: " + (inputProvider.showingConnections()));
- if ((parent == inputProvider) && addingConnection && (_event.getParent() instanceof ISystemRegistry) && !inputProvider.showingConnections()) return Status.OK_STATUS; // only reflect new connections in main perspective. pc42742
- int pos = -1;
- if (type == ISystemResourceChangeEvents.EVENT_ADD_RELATIVE) {
- previous = _event.getRelativePrevious();
- if (previous != null) pos = getItemIndex(parentItem, previous);
- if (pos >= 0) pos++; // want to add after previous
- } else
- pos = _event.getPosition();
-
- Item[] currentItems = null;
- if (parentItem instanceof Tree)
- {
- currentItems = ((Tree)parentItem).getItems();
- }
- else
- {
- currentItems = getItems((Item)parentItem);
- }
- boolean exists = false;
- // check for src
- for (int i = 0; i < currentItems.length && !exists; i++)
- {
- Item cur = currentItems[i];
- if (cur.getData() == src)
- {
- exists = true;
- }
- }
-
- //logDebugMsg("ADDING CONN? "+ addingConnection + ", position="+pos);
- if (!exists)
- {
- createTreeItem(parentItem, src, pos);
- }
- setSelection(new StructuredSelection(src), true);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_ADD_MANY:
- if (debug) {
- logDebugMsg("SV event: EVENT_ADD_MANY"); //$NON-NLS-1$
- }
- multiSource = _event.getMultiSource();
- clearSelection();
- parentItem = findItem(parent);
- if (parentItem == null) return Status.OK_STATUS;
- if ((parentItem instanceof Item) && !getExpanded((Item) parentItem)) {
- refresh(parent); // flush cached stuff so next call will show new items
- } else if (multiSource.length > 0) {
- boolean addingConnections = (multiSource[0] instanceof IHost);
- // are we restoring connections previously removed due to making a profile inactive,
- // and is one of these connections the one we were opened with?
- if (addingConnections && (_event.getParent() instanceof ISystemRegistry) && (inputProvider instanceof SystemEmptyListAPIProviderImpl)) {
- boolean done = false;
- for (int idx = 0; !done && (idx < multiSource.length); idx++) {
- if (multiSource[idx] == previousInputConnection) {
- done = true;
- setInputProvider(previousInputProvider);
- previousInput = null;
- previousInputProvider = null;
- }
- }
- if (done) return Status.OK_STATUS;
- }
- // are we adding connections and yet we are not a secondary perspective?
- // If so, this event does not apply to us.
- else if (addingConnections && (_event.getParent() instanceof ISystemRegistry) && !inputProvider.showingConnections()) return Status.OK_STATUS;
-
- for (int idx = 0; idx < multiSource.length; idx++) {
- if (debug && addingConnections) logDebugMsg("... new connection " + ((IHost) multiSource[idx]).getAliasName()); //$NON-NLS-1$
- createTreeItem(parentItem, multiSource[idx], -1);
- }
- setSelection(new StructuredSelection(multiSource), true);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_REPLACE_CHILDREN:
- if (debug) {
- logDebugMsg("SV event: EVENT_REPLACE_CHILDREN"); //$NON-NLS-1$
- }
- multiSource = _event.getMultiSource();
- //logDebugMsg("MULTI-SRC LENGTH : " + multiSource.length);
- clearSelection();
- parentItem = findItem(parent);
- if (parentItem == null) return Status.OK_STATUS;
- if (multiSource.length > 0 && parentItem instanceof Item) {
- getControl().setRedraw(false);
- collapseNode(parent, true); // collapse and flush gui widgets from memory
- //setExpandedState(parent, true); // expand the parent
- setExpanded((Item) parentItem, true); // expand the parent without calling resolveFilterString
- TreeItem[] kids = ((TreeItem) parentItem).getItems(); // any kids? Like a dummy node?
- if (kids != null) for (int idx = 0; idx < kids.length; idx++)
- kids[idx].dispose();
- //boolean addingConnections = (multiSource[0] instanceof SystemConnection);
- for (int idx = 0; idx < multiSource.length; idx++) {
- //if (debug && addingConnections)
- // logDebugMsg("... new connection " + ((SystemConnection)multiSource[idx]).getAliasName());
- createTreeItem(parentItem, multiSource[idx], -1);
- }
- getControl().setRedraw(true);
- //setSelection(new StructuredSelection(multiSource),true);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_CHANGE_CHILDREN:
- if (debug) {
- logDebugMsg("SV event: EVENT_CHANGE_CHILDREN. src=" + src + ", parent=" + parent); //$NON-NLS-1$ //$NON-NLS-2$
- //Exception e = new Exception();
- //e.fillInStackTrace();
- //e.printStackTrace();
- }
- // I HAVE DECIDED TO CHANGE THE SELECTION ALGO TO ONLY RESELECT IF THE CURRENT
- // SELECTION IS A CHILD OF THE PARENT... PHIL
- boolean wasSrcSelected = false;
- if (src != null) {
- wasSrcSelected = isSelectedOrChildSelected(src);
- //System.out.println("WAS SELECTED? " + wasSrcSelected);
- }
- item = findItem(parent);
- //logDebugMsg(" parent = " + parent);
- //logDebugMsg(" item = " + item);
- // INTERESTING BUG HERE. GETEXPANDED WILL RETURN TRUE IF THE TREE ITEM HAS EVER BEEN
- // EXPANDED BUT IS NOW COLLAPSED! I CANNOT FIND ANY API IN TreeItem or TreeViewer THAT
- // WILL TELL ME IF A TREE ITEM IS SHOWING OR NOT!
- if ((item != null) && (item instanceof TreeItem) && ((TreeItem) item).getExpanded()) {
- if (wasSrcSelected) {
- //System.out.println("...Clearing selection");
- clearSelection();
- }
- //refresh(parent);
- if (debug) System.out.println("Found item and it was expanded for " + parent); //$NON-NLS-1$
- getControl().setRedraw(false);
- collapseNode(parent, true); // collapse and flush gui widgets from memory
- setExpandedState(parent, true); // expand the parent
- getControl().setRedraw(true);
- if (wasSrcSelected) {
- //System.out.println("Setting selection to " + src);
- setSelection(new StructuredSelection(src), true);
- }
- } else
- collapseNode(parent, true);
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE:
- if (debug) logDebugMsg("SV event: EVENT_DELETE "); //$NON-NLS-1$
- // are we a secondary perspective, and our input or parent of our input was deleted?
- if (affectsInput(src)) {
- close();
- return Status.OK_STATUS;
- }
- parentItem = findItem(parent);
- if (parentItem == null) return Status.OK_STATUS;
- if ((parentItem instanceof Item) && !getExpanded((Item) parentItem))
- refresh(parent); // flush memory
- else {
- wasSelected = isSelectedOrChildSelected(src);
- if (wasSelected) clearSelection();
- _originatingViewer.remove(src);
- if (wasSelected) setSelection(new StructuredSelection(parent), true);
- }
- break;
-
- case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
- if (debug) {
- logDebugMsg("SV event: EVENT_DELETE_MANY "); //$NON-NLS-1$
- }
- multiSource = _event.getMultiSource();
- // are we a secondary perspective, and our input or parent of our input was deleted?
- if (affectsInput(multiSource)) {
- close();
- return Status.OK_STATUS;
- }
- if (parent != null) {
- parentItem = findItem(parent);
- } else {
- // find first parentItem for source
- if (multiSource != null && multiSource.length > 0) {
- Widget sitem = findItem(multiSource[0]);
- if (sitem instanceof TreeItem) {
- parentItem = ((TreeItem)sitem).getParentItem();
- if (parentItem == null) {
- parentItem = ((TreeItem)sitem).getParent();
- }
- }
- }
- }
- if (parentItem == null) {
- return Status.OK_STATUS;
- }
- if ((parentItem instanceof Item) && !getExpanded((Item) parentItem)) {
- refresh(parent); // flush memory
- } else if (parentItem instanceof Tree) {
- if (_originatingViewer != null) {
- _originatingViewer.remove(multiSource);
- }
- } else {
- wasSelected = isSelectedOrChildSelected(multiSource);
- if (wasSelected) {
- clearSelection();
- }
- if (_originatingViewer != null) {
- _originatingViewer.remove(multiSource);
- }
- if (wasSelected) {
- setSelection(parent != null ? new StructuredSelection(parent) : null, true);
- }
- }
- break;
- /* Now done below in systemRemoteResourceChanged
- case EVENT_DELETE_REMOTE:
- if (debug)
- logDebugMsg("SV event: EVENT_DELETE_REMOTE ");
- deleteRemoteObject(src);
- break;
-
- case EVENT_DELETE_REMOTE_MANY:
- // multi-source: array of objects to delete
- if (debug)
- logDebugMsg("SV event: EVENT_DELETE_REMOTE_MANY ");
- multiSource = event.getMultiSource();
- //remoteItemsToSkip = null; // reset
- if ((multiSource == null) || (multiSource.length==0))
- return;
- for (int idx=0; idx<multiSource.length; idx++)
- deleteRemoteObject(multiSource[idx]);
- break;
- */
- case ISystemResourceChangeEvents.EVENT_RENAME:
- if (debug) logDebugMsg("SV event: EVENT_RENAME "); //$NON-NLS-1$
- properties[0] = IBasicPropertyConstants.P_TEXT;
- update(src, properties); // for refreshing non-structural properties in viewer when model changes
- updatePropertySheet();
- break;
- /* Now done below in systemRemoteResourceChanged
- case EVENT_RENAME_REMOTE:
- // SRC: the updated remote object, after the rename
- // PARENT: the String from calling getAbsoluteName() on the remote adapter BEFORE updating the remote object's name
- if (debug)
- logDebugMsg("SV event: EVENT_RENAME_REMOTE ");
-
- renameRemoteObject(src, (String)parent);
- break;
- */
- case ISystemResourceChangeEvents.EVENT_ICON_CHANGE:
- if (debug) logDebugMsg("SV event: EVENT_ICON_CHANGE "); //$NON-NLS-1$
-
- if (initViewerFilters != null && initViewerFilters.length > 0) {
- Widget w = findItem(src);
- if (w == null) {
- refresh(parent);
- } else {
- properties[0] = IBasicPropertyConstants.P_IMAGE;
- update(src, properties); // for refreshing non-structural properties in viewer when model changes
-
- }
- } else {
- properties[0] = IBasicPropertyConstants.P_IMAGE;
- update(src, properties); // for refreshing non-structural properties in viewer when model changes
- }
-
- //updatePropertySheet();
- break;
- //case EVENT_CHANGE:
- //if (debug)
- //logDebugMsg("SV event: EVENT_CHANGE ");
- //refresh(src); THIS IS AN EVIL OPERATION: CAUSES ALL EXPANDED NODES TO RE-REQUEST THEIR CHILDREN. OUCH!
- //updatePropertySheet();
- //break;
- case ISystemResourceChangeEvents.EVENT_REFRESH:
- if (debug) logDebugMsg("SV event: EVENT_REFRESH "); //$NON-NLS-1$
- //if (src != null)
- // refresh(src); // ONLY VALID WHEN USER TRULY WANTS TO REQUERY CHILDREN FROM HOST
- //else
- // refresh(); // refresh entire tree
- if ((src == null) || (src == RSEUIPlugin.getTheSystemRegistryUI()))
- refreshAll();
- else {
- //FIXME Why do we forceRemote here? EVENT_REFRESH_SELECTED also does not do forceRemote.
- //smartRefresh(src, false);
- smartRefresh(src, true);
- }
- updatePropertySheet();
- break;
- // refresh the parent of the currently selected items.
- // todo: intelligently re-select previous selections
- case ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED_PARENT:
- if (debug) logDebugMsg("SV event: EVENT_REFRESH_SELECTED_PARENT "); //$NON-NLS-1$
- TreeItem[] items = getTree().getSelection();
- if ((items != null) && (items.length > 0) && (items[0] != null)) {
- //System.out.println("Selection not empty");
- parentItem = getParentItem(items[0]); // get parent of first selection. Only allowed to select items of same parent.
- if ((parentItem != null) && (parentItem instanceof Item)) {
- //System.out.println("parent of selection not empty: "+parentItem.getData());
- smartRefresh(new TreeItem[] { (TreeItem) parentItem });
- }
- //else
- //System.out.println("parent of selection is empty");
- }
- //else
- //System.out.println("Selection is empty");
- break;
- case ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED:
- if (debug) logDebugMsg("SV event: EVENT_REFRESH_SELECTED "); //$NON-NLS-1$
- IStructuredSelection selected = (IStructuredSelection) getSelection();
- Iterator i = selected.iterator();
- // the following is a tweak. Refresh only re-queries the children. If the selected item has no
- // childen, then refresh does nothing. Instead of that outcome, we re-define it to mean refresh
- // the parent. The tricky part is to prevent multiple refreshes on multiple selections so we have
- // to pre-scan for this scenario.
- // We also want to re-select any remote objects currently selected. They lose their selection as their
- // memory address changes.
- Item parentElementItem = null;
- List selectedRemoteObjects = new Vector();
- items = getTree().getSelection();
- int itemIdx = 0;
- //System.out.println("Inside EVENT_REFRESH_SELECTED. FIRST SELECTED OBJECT = " + items[0].handle);
- while (i.hasNext()) {
-
- Object element = i.next();
- ISystemViewElementAdapter adapter = _originatingViewer.getViewAdapter(element);
- if ((parentElementItem == null) && (adapter != null) && (!adapter.hasChildren((IAdaptable)element))) {
- //parentItem = getParentItem((Item)findItem(element));
- parentItem = getParentItem(items[itemIdx]);
- if ((parentItem != null) && (parentItem instanceof Item)) parentElementItem = (Item) parentItem; //.getData();
- }
- if (getViewAdapter(element) != null) {
- selectedRemoteObjects.add(element);
- if (ss == null) ss = getViewAdapter(element).getSubSystem(element);
- }
- itemIdx++;
- }
- if (parentElementItem != null) {
- //refresh(parentElement);
- //FIXME IF a multi-select contains elements with a different parent than the one found, they will be ignored.
- smartRefresh(new TreeItem[] { (TreeItem) parentElementItem });
- if (selectedRemoteObjects.size() > 0) {
- selectRemoteObjects(selectedRemoteObjects, ss, parentElementItem);
- }
- }
- // the following is another tweak. If an expanded object is selected for refresh, which has remote children,
- // and any of those children are expanded, then on refresh the resulting list may be in a different
- // order and the silly algorithm inside tree viewer will simply re-expand the children at the previous
- // relative position. If that position has changed, the wrong children are re-expanded!
- // How to fix this? Ugly code to get the query the list of expanded child elements prior to refresh,
- // collapse them, do the refresh, then re-expand them based on absolute name versus tree position.
- // Actually, to do this right we need to test if the children of the selected item are remote objects
- // versus just the selected items because they may have selected a filter!
- // We go straight the TreeItem level for performance and ease of programming.
- else {
- smartRefresh(getTree().getSelection());
- }
- //else
- //{
- //i = selected.iterator();
- //while (i.hasNext())
- //refresh(i.next());
- //}
-
- updatePropertySheet();
- break;
- case ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED_FILTER:
- if (debug) logDebugMsg("SV event: EVENT_REFRESH_SELECTED_FILTER "); //$NON-NLS-1$
- IStructuredSelection selectedItems = (IStructuredSelection) getSelection();
- Iterator j = selectedItems.iterator();
- // We climb up the tree here until we find a SystemFilterReference data member in the tree.
- // If we do find a reference of SystemFilterReference we refresh on it.
- // If we do not find a reference of SystemFilterReference we.....TODO: WHAT DO WE DO???
- // We also want to re-select any remote objects currently selected. They lose their selection as their
- // memory address changes.
- Item parentElemItem = null;
- List selRemoteObjects = new Vector();
- if (j.hasNext()) {
- Object element = j.next();
- ISystemViewElementAdapter adapter = _originatingViewer.getViewAdapter(element);
- if (adapter != null) {
- Item parItem = getParentItem((Item) findItem(element));
-
- if (parItem != null) parentElemItem = parItem; //.getData();
-
- while (parItem != null && !(parItem.getData() instanceof ISystemFilterReference)) {
- parItem = getParentItem(parItem);
-
- if (parItem != null) parentElemItem = parItem; //.getData();
- }
- }
- if (getViewAdapter(element) != null) {
- selRemoteObjects.add(element);
- ss = getViewAdapter(element).getSubSystem(element);
- }
- }
-
- if (parentElemItem != null && (parentElemItem.getData() instanceof ISystemFilterReference)) {
- smartRefresh(new TreeItem[] { (TreeItem) parentElemItem });
- if (selRemoteObjects.size() > 0) {
- selectRemoteObjects(selRemoteObjects, ss, parentElemItem);
- }
-
- updatePropertySheet();
- } else {
- // if we cannot find a parent element that has a system filter reference then we refresh
- // everything since the explorer must be within a filter
- _event.setType(ISystemResourceChangeEvents.EVENT_REFRESH);
- systemResourceChanged(_event);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE:
- if (debug) logDebugMsg("SV event: EVENT_REFRESH_REMOTE: src = " + src); //$NON-NLS-1$
-
- // Fake expanded is set to the item for the src object if the object is in a collapsed state and
- // resides directly under a filter. The item is artificially expanded in order to allow
- // refreshRemoteObject() to go through with a query of the item. After the query is kicked off,
- // fakeExpanded is contracted in order to retain the original tree expand state.
- TreeItem fakeExpanded = null;
-
- ISystemViewElementAdapter adapter = getViewAdapter(src);
- if (adapter != null)
- {
- // we need to refresh filters
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- // if this is a filter reference, we just need to refresh it
- if (src instanceof ISystemFilterReference)
- {
- refresh(src);
- break;
- }
-
- // need to find filter references contain this object
- List filterReferences = sr.findFilterReferencesFor(src, adapter.getSubSystem(src), false);
-
- // first, find out if src is a container or not
- // if it's a container, just pass into refreshRemoteObject
- // if it's NOT a container, pass in it's parent
- boolean hasChildren = adapter.hasChildren((IAdaptable)src);
- if (!hasChildren && !(src instanceof ISubSystem))
- {
- // make the src the parent of the src
- Object srcParent = adapter.getParent(src);
- if (srcParent != null)
- {
- if (filterReferences.size() > 0){
- for (int r = 0; r < filterReferences.size(); r++){
- ISystemFilterReference ref = (ISystemFilterReference)filterReferences.get(r);
- refresh(ref);
- }
- break;
- }
- else {
- src = srcParent;
- }
-
- }
- }
- else
- {
- // only do this if the object is "remote"
- if (adapter.isRemote(src))
- {
- // get up-to-date version of the container (need to make sure it still exists)
- if (ss == null)
- {
- ss = adapter.getSubSystem(src);
- }
- if (ss != null)
- {
- // for bug 196662
- // if we're refreshing a previously unexpanded node, then a query will not happen
- // so we should refresh it's parent in this case
- Widget w = findItem(src);
- if (w instanceof TreeItem)
- {
- TreeItem titem = (TreeItem)w;
- TreeItem[] titems = titem.getItems();
- if (titems.length > 0 && !titem.getExpanded())
- {
- // the item is artificially expanded in order to allow the query to go through in
- // refreshRemoteObject()
- titem.setExpanded(true);
-
- // we set this so that after calling refreshRemoteObject(), the item can be re-collapsed
- fakeExpanded = titem;
- }
- }
- }
- }
- }
- }
-
- refreshRemoteObject(src, parent, originatedHere);
- if (fakeExpanded != null){
- fakeExpanded.setExpanded(false);
- }
-
- break;
- case ISystemResourceChangeEvents.EVENT_SELECT_REMOTE:
- if (debug) logDebugMsg("SV event: EVENT_SELECT_REMOTE: src = " + src); //$NON-NLS-1$
- //remoteItemsToSkip = null; // reset
- selectRemoteObjects(src, (ISubSystem) null, parent);
- break;
-
- case ISystemResourceChangeEvents.EVENT_MOVE_MANY:
- if (debug) logDebugMsg("SV event: EVENT_MOVE_MANY "); //$NON-NLS-1$
- multiSource = _event.getMultiSource();
- if ((multiSource == null) || (multiSource.length == 0)) return Status.OK_STATUS;
- parentItem = findItem(parent);
- if (parentItem == null) return Status.OK_STATUS;
- if ((parentItem instanceof Item) && !getExpanded((Item) parentItem))
- refresh(parent); // flush memory
- else {
- clearSelection();
- moveTreeItems(parentItem, multiSource, _event.getPosition());
- setSelection(new StructuredSelection(multiSource), true);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE:
- if (debug) logDebugMsg("SV event: EVENT_PROPERTY_CHANGE "); //$NON-NLS-1$
- String[] allProps = { IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE };
- ISystemRemoteElementAdapter ra = (ISystemRemoteElementAdapter)((IAdaptable)src).getAdapter(ISystemRemoteElementAdapter.class);
- if (ra != null) {
- updateRemoteObjectProperties(src);
- } else
- update(src, allProps); // for refreshing non-structural properties in viewer when model changes
- updatePropertySheet();
- break;
- case ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE:
- if (debug) logDebugMsg("SV event: EVENT_PROPERTYSHEET_UPDATE "); //$NON-NLS-1$
- updatePropertySheet();
- break;
- case ISystemResourceChangeEvents.EVENT_MUST_COLLAPSE:
- if (debug) logDebugMsg("SV event: EVENT_MUST_COLLAPSE "); //$NON-NLS-1$
- collapseNode(src, true); // collapse and flush gui widgets from memory
- break;
- case ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL:
- if (debug) logDebugMsg("SV event: EVENT_COLLAPSE_ALL "); //$NON-NLS-1$
- collapseAll(); // collapse all
- if ((src != null) && (src instanceof String) && ((String) src).equals("false")) // defect 41203 //$NON-NLS-1$
- {
- } else
- refresh(); // flush gui widgets from memory
- break;
- case ISystemResourceChangeEvents.EVENT_COLLAPSE_SELECTED: // defect 41203
- if (debug) logDebugMsg("SV event: EVENT_COLLAPSE_SELECTED "); //$NON-NLS-1$
- collapseSelected();
- break;
- case ISystemResourceChangeEvents.EVENT_EXPAND_SELECTED: // defect 41203
- if (debug) logDebugMsg("SV event: EVENT_EXPAND_SELECTED "); //$NON-NLS-1$
- expandSelected();
- break;
-
- case ISystemResourceChangeEvents.EVENT_REVEAL_AND_SELECT:
- if (debug) logDebugMsg("SV event: EVENT_REVEAL_AND_SELECT "); //$NON-NLS-1$
- parentItem = findItem(parent);
- if (parentItem == null) return Status.OK_STATUS;
- if ((parentItem instanceof Item) && !getExpanded((Item) parentItem)) {
- setExpandedState(parent, true);
- Object toSelect = src;
- //if (event.getMultiSource() != null)
- //toSelect = event.getMultiSource();
- //clearSelection();
- if (toSelect != null) {
- if (parent instanceof IRSEBaseReferencingObject) {
- TreeItem child = (TreeItem) internalFindReferencedItem(parentItem, toSelect, 1);
- if (child != null) toSelect = child.getData();
- } else if ((parent instanceof ISystemFilterPoolReferenceManagerProvider) && !(src instanceof IRSEBaseReferencingObject)) {
- // we are in "don't show filter pools" mode and a new filter was created
- // (we get the actual filter, vs on pool ref creation when we get the pool ref)
- TreeItem child = (TreeItem) internalFindReferencedItem(parentItem, toSelect, 1);
- if (child != null) toSelect = child.getData();
- }
- setSelection(new StructuredSelection(toSelect), true);
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_SELECT:
- if (debug) logDebugMsg("SV event: EVENT_SELECT "); //$NON-NLS-1$
- item = findItem(src);
- if (item == null) // if not showing item, this is a no-op
- return Status.OK_STATUS;
- setSelection(new StructuredSelection(src), true);
- break;
- case ISystemResourceChangeEvents.EVENT_SELECT_EXPAND:
- if (debug) logDebugMsg("SV event: EVENT_SELECT_EXPAND "); //$NON-NLS-1$
- item = findItem(src);
- if (item == null) // if not showing item, this is a no-op
- return Status.OK_STATUS;
- if (!getExpanded((Item) item)) setExpandedState(src, true);
- setSelection(new StructuredSelection(src), true);
- break;
-
- }
- return Status.OK_STATUS;
- }
- }
-
- // ------------------------------------
- // ISYSTEMREMOTEChangeListener METHOD
- // ------------------------------------
-
-
- private static class CheckPending implements Runnable
- {
- private boolean _notReady = true;
- private TreeItem _item;
-
- public CheckPending(TreeItem item)
- {
- _item = item;
- }
-
- public void run()
- {
- if (_item.isDisposed()) {
- // Parent was deleted in the meantime
- _notReady = false;
- } else {
- Item[] items = _item.getItems();
- // We know that a child must appear eventualy, because the
- // REMOTE_RESOURCE_CREATED event is only sent in case of
- // successful creation of the element.
- _notReady = (items.length <= 0 || ProgressMessages.PendingUpdateAdapter_PendingLabel.equals(items[0].getText()));
- }
- }
-
- public boolean isNotReady()
- {
- return _notReady;
- }
- }
-
- /**
- * This is the method in your class that will be called when a remote resource
- * changes. You will be called after the resource is changed.
- * @see org.eclipse.rse.core.events.ISystemRemoteChangeEvent
- */
- public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event) {
- int eventType = event.getEventType();
- Object remoteResourceParent = event.getResourceParent();
- Object remoteResource = event.getResource();
- boolean originatedHere;
-
- if (event instanceof SystemResourceChangeEventUI) {
- Viewer viewer = ((SystemResourceChangeEventUI)event).getOriginatingViewer();
- originatedHere = (viewer==this);
- }
- else if (event instanceof SystemRemoteChangeEvent){
- Object viewer = ((SystemRemoteChangeEvent)event).getOriginatingViewer();
- originatedHere = (viewer==this);
- }
- else {
- originatedHere = false;
- }
-
- List remoteResourceNames = null;
- if (remoteResource instanceof List) {
- remoteResourceNames = (List) remoteResource;
- remoteResource = remoteResourceNames.get(0);
- }
- // getRemoteResourceAbsoluteName(remoteResourceParent); // DWD may not be necessary
- String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource);
- if (remoteResourceName == null) return;
-
- ISubSystem ss = getSubSystem(event, remoteResource, remoteResourceParent);
-
- List filterMatches = null;
-
- switch (eventType) {
- // --------------------------
- // REMOTE RESOURCE CHANGED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED:
- updatePropertySheet(); // just in case
- break;
- // --------------------------
- // REMOTE RESOURCE CREATED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED:
- // we can easily lose our original selection so we need save and restore it if needed
- List prevSelection = null;
- TreeItem parentSelectionItem = null;
- if (originatedHere) {
- prevSelection = getRemoteSelection();
- parentSelectionItem = getSelectedParentItem();
- }
-
- // when a new remote resource is created, we need to interrogate all filters
- // within connections to the same hostname, to see if the filter results are
- // affected by this change. If so, we refresh the filter.
- filterMatches = findAllRemoteItemFilterReferences(remoteResourceName, ss, null);
- ArrayList selectedFilters = null;
- if (filterMatches != null) {
- for (int idx = 0; idx < filterMatches.size(); idx++) {
- FilterMatch match = (FilterMatch) filterMatches.get(idx);
- TreeItem filterItem = match.getTreeItem();
- if (isTreeItemSelected(filterItem)) // if this filter is currently selected, we will lose that selection!
- {
- if (selectedFilters == null) selectedFilters = new ArrayList();
- selectedFilters.add(filterItem);
- }
- smartRefresh(new TreeItem[] { filterItem }, null, true);
- }
- }
- // now, refresh all occurrences of the remote parent object.
- refreshRemoteObject(remoteResourceParent, null, false);
- // restore selected filters...
- if (selectedFilters != null) setSelection(selectedFilters);
- // if the create event originated here, then expand the selected node and
- // select the new resource under it.
- if (originatedHere){
- // first, restore previous selection...
- if (prevSelection != null) selectRemoteObjects(prevSelection, ss, parentSelectionItem);
- TreeItem selectedItem = getFirstSelectedTreeItem();
- if (selectedItem != null)
- {
- Object data = selectedItem.getData();
- boolean allowExpand = true;
- ISystemViewElementAdapter adapter = getViewAdapter(data);
-
- if (adapter != null && data instanceof IAdaptable)
- {
- allowExpand = adapter.hasChildren((IAdaptable)data);
- }
- if (allowExpand && !selectedItem.getExpanded()) // if the filter is expanded, then we already refreshed it...
- {
- createChildren(selectedItem);
- selectedItem.setExpanded(true);
- }
- if (adapter.supportsDeferredQueries(ss))
- {
- final List names = remoteResourceNames;
- final String name = remoteResourceName;
- final ISubSystem subsys = ss;
- final TreeItem item = selectedItem;
- final IWorkbench wb = RSEUIPlugin.getDefault().getWorkbench();
-
- // do the selection after the query triggered via refreshRemoteObject() completes
- Job job = new Job("select resource") //$NON-NLS-1$
- {
- public IStatus run(IProgressMonitor monitor) {
-
- boolean notReady = true;
- while (notReady && !wb.isClosing())
- {
- try {
- Thread.sleep(100);
- }
- catch (InterruptedException e){}
-
- CheckPending checkRunnable = new CheckPending(item);
- wb.getDisplay().syncExec(checkRunnable);
- notReady = checkRunnable.isNotReady();
- }
-
- wb.getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- if (!wb.isClosing() && !item.isDisposed()) {
- if (names != null)
- selectRemoteObjects(names, subsys, item);
- else
- selectRemoteObjects(name, subsys, item);
- }
- }
- });
-
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.schedule();
- }
- else {
- if (remoteResourceNames != null)
- selectRemoteObjects(remoteResourceNames, ss, selectedItem);
- else
- selectRemoteObjects(remoteResourceName, ss, selectedItem);
- }
- }
- //else
- //System.out.println("Hmm, nothing selected");
- }
- break;
- // --------------------------
- // REMOTE RESOURCE DELETED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED:
- // delete all existing references to the remote object(s)...
- if (remoteResourceNames != null) {
- for (int idx = 0; idx < remoteResourceNames.size(); idx++)
- deleteRemoteObject(remoteResourceNames.get(idx), ss);
- } else
- deleteRemoteObject(remoteResourceName, ss);
-
- // now, find all filters that either list this remote resource or list the contents of it,
- // if it is a container... for expediency we only test for the first resource, even if given
- // a list of them...
- filterMatches = findAllRemoteItemFilterReferences(remoteResourceName, ss, null);
- if (filterMatches != null) {
- for (int idx = 0; idx < filterMatches.size(); idx++) {
- FilterMatch match = (FilterMatch) filterMatches.get(idx);
- TreeItem filterItem = match.getTreeItem();
- if (match.listsElement()) {
- // if the filter is expanded, we are ok. If not, we need to flush its memory...
- if (!getExpanded(filterItem)) refresh(filterItem.getData());
- } else // else this filter lists the contents of the deleted container element, so refresh it:
- {
- // if the filter is not expanded, we need to flush its memory...
- if (!getExpanded(filterItem))
- refresh(filterItem.getData());
- else
- // if the filter is expanded, we need to refresh it
- smartRefresh(new TreeItem[] { filterItem }, null, true);
- }
- }
- }
-
- break;
-
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED:
- // we can easily lose our original selection so we need save and restore it if needed
- prevSelection = null;
- parentSelectionItem = null;
- if (originatedHere) {
- prevSelection = getRemoteSelection();
- parentSelectionItem = getSelectedParentItem();
- }
-
- // rename all existing references to the remote object...
- renameRemoteObject(remoteResource, event.getOldNames()[0], ss); // assuming only one resource renamed
-
- // refresh remoteResource if it's a directory
- ISystemViewElementAdapter adapter = getViewAdapter(remoteResource);
- if (remoteResource instanceof IAdaptable && adapter.hasChildren((IAdaptable) remoteResource)) {
- refreshRemoteObject(remoteResource, remoteResource, originatedHere);
- }
-
- // now, find all filters that list the contents of the OLD name container.
- filterMatches = findAllRemoteItemFilterReferences(event.getOldNames()[0], ss, null); // assuming only one resource renamed
- if (filterMatches != null) {
- for (int idx = 0; idx < filterMatches.size(); idx++) {
- FilterMatch match = (FilterMatch) filterMatches.get(idx);
- TreeItem filterItem = match.getTreeItem();
- if (match.listsElementContents()) // this filter lists the contents of the renamed container element, so refresh it:
- {
- // if the filter is not expanded, we need only flush its memory...
- if (!getExpanded(filterItem))
- refresh(filterItem.getData());
- else
- // the filter is expanded, so refresh its contents. This will likely result in an empty list
- smartRefresh(new TreeItem[] { filterItem }, null, true);
- }
- }
- }
- // now, find all filters that list the contents of the NEW name container.
- filterMatches = findAllRemoteItemFilterReferences(remoteResourceName, ss, null);
- if (filterMatches != null) {
- for (int idx = 0; idx < filterMatches.size(); idx++) {
- FilterMatch match = (FilterMatch) filterMatches.get(idx);
- TreeItem filterItem = match.getTreeItem();
- if (match.listsElementContents()) // this filter lists the contents of the renamed container element, so refresh it:
- {
- // if the filter is not expanded, we need only flush its memory...
- if (!getExpanded(filterItem))
- refresh(filterItem.getData());
- else
- // the filter is expanded, so refresh its contents. This will likely result in an empty list
- smartRefresh(new TreeItem[] { filterItem }, null, true);
- }
- }
- }
-
- // restore selection
- if (originatedHere && (prevSelection != null)) {
- selectRemoteObjects(prevSelection, ss, parentSelectionItem);
- updatePropertySheet(); // just in case
- }
- break;
- }
- }
-
- /**
- * Turn selection into an array of remote object names
- */
- protected List getRemoteSelection() {
- List prevSelection = null;
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator i = selection.iterator();
- while (i.hasNext()) {
- Object element = i.next();
- ISystemViewElementAdapter ra = getViewAdapter(element);
- if (ra != null) {
- if (prevSelection == null) prevSelection = new Vector();
- prevSelection.add(ra.getAbsoluteName(element));
- }
- }
- return prevSelection;
- }
-
- /**
- * Turn a given remote object reference into a fully qualified absolute name
- */
- protected String getRemoteResourceAbsoluteName(Object remoteResource) {
- if (remoteResource == null) return null;
- String remoteResourceName = null;
- if (remoteResource instanceof String)
- remoteResourceName = (String) remoteResource;
- else {
- ISystemViewElementAdapter ra = getViewAdapter(remoteResource);
- if (ra == null) return null;
- remoteResourceName = ra.getAbsoluteName(remoteResource);
- }
- return remoteResourceName;
- }
-
- /**
- * Deduce the subsystem from the event or remote object
- */
- protected ISubSystem getSubSystem(ISystemRemoteChangeEvent event, Object remoteResource, Object remoteParent) {
- if (event.getSubSystem() != null) return event.getSubSystem();
- ISubSystem ss = null;
- if ((remoteResource != null) && !(remoteResource instanceof String)) {
- if (remoteResource instanceof List) {
- List v = (List) remoteResource;
- if (v.size() > 0) ss = getSubSystem(event, v.get(0), null);
- } else {
- ISystemViewElementAdapter ra = getViewAdapter(remoteResource);
- if (ra != null) ss = ra.getSubSystem(remoteResource);
- }
- }
- if ((ss == null) && (remoteParent != null) && !(remoteParent instanceof String)) {
- if (remoteParent instanceof List) {
- List v = (List) remoteParent;
- if (v.size() > 0) ss = getSubSystem(event, null, v.get(0));
- } else {
- ISystemViewElementAdapter ra = getViewAdapter(remoteParent);
- if (ra != null) ss = ra.getSubSystem(remoteParent);
- }
- }
- return ss;
- }
-
- // ------------------------------------
- // MISCELLANEOUS METHODS...
- // ------------------------------------
-
- /**
- * Close us!
- */
- protected void close() {
- previousInputProvider = inputProvider;
- previousInput = getWorkbenchPart().getSite().getPage().getInput();
- ISystemViewInputProvider ip = new SystemEmptyListAPIProviderImpl();
- setInputProvider(ip);
- }
-
- /**
- * Test if the given input is our view's input object. This is designed to only
- * consider instances of ourself in non-primary perspectives.
- */
- protected boolean affectsInput(Object[] elements) {
- boolean affected = false;
- IWorkbenchPart viewPart = getWorkbenchPart();
- if ((viewPart != null) && (getInput() != RSECorePlugin.getTheSystemRegistry()) && !(getInput() instanceof SystemEmptyListAPIProviderImpl)) {
- for (int idx = 0; !affected && (idx < elements.length); idx++)
- affected = affectsInput(elements[idx]);
- }
- return affected;
- }
-
- /**
- * Test if the given input is our view's input object. This is designed to only
- * consider instances of ourself in non-primary perspectives.
- */
- protected boolean affectsInput(Object element) {
- boolean affected = false;
- IWorkbenchPart viewPart = getWorkbenchPart();
- if ((viewPart != null) && (getInput() != RSECorePlugin.getTheSystemRegistry()) && !(getInput() instanceof SystemEmptyListAPIProviderImpl)) {
-
- Object input = viewPart.getSite().getPage().getInput();
- if (input != null) {
- Object referencedElement = getReferencedObject(element);
- Object referencedInput = getReferencedObject(input);
- //System.out.println("TESTING1 " + input + " vs " + element);
- //System.out.println("TESTING2 " + referencedInput + " vs " + referencedElement);
- if ((input == element) || (referencedInput == referencedElement))
- affected = true;
- else {
- while (!affected && (input != null)) {
- input = getElementParent(input);
- if (input != null) {
- referencedInput = getReferencedObject(input);
- //System.out.println("...TESTING1 " + input + " vs " + element);
- //System.out.println("...TESTING2 " + referencedInput + " vs " + referencedElement);
- affected = ((input == element) || (referencedInput == referencedElement));
- }
- }
- }
- }
- }
- return affected;
- }
-
- protected Object getReferencedObject(Object inputObj) {
- if (inputObj instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference) inputObj).getReferencedFilterPool();
- else if (inputObj instanceof ISystemFilterReference)
- return ((ISystemFilterReference) inputObj).getReferencedFilter();
- else if (inputObj instanceof ISystemFilterStringReference)
- return ((ISystemFilterStringReference) inputObj).getReferencedFilterString();
- else
- return inputObj;
- }
-
- protected Object getElementParent(Object inputObj) {
- if (inputObj instanceof IHost)
- return ((IHost) inputObj).getSystemProfile();
- else if (inputObj instanceof ISubSystem)
- return ((ISubSystem) inputObj).getHost();
- else if (inputObj instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference) inputObj).getProvider(); // will be a subsystem
- else if (inputObj instanceof ISystemFilterPool)
- return ((ISystemFilterPool) inputObj).getProvider(); // will be a subsystem factory. Hmm!
- else if (inputObj instanceof ISystemFilterReference)
- return ((ISystemFilterReference) inputObj).getParent(); // will be filter reference or filter pool reference
- else if (inputObj instanceof ISystemFilter) {
- ISystemFilter filter = (ISystemFilter) inputObj;
- if (filter.getParentFilter() != null)
- return filter.getParentFilter();
- else
- return filter.getParentFilterPool();
- } else if (inputObj instanceof ISystemFilterStringReference)
- return ((ISystemFilterStringReference) inputObj).getParent(); // will be a SystemFilterReference
- else if (inputObj instanceof ISystemFilterString)
- return ((ISystemFilterString) inputObj).getParentSystemFilter();
- else
- return null;
- }
-
- protected IHost getInputConnection(Object inputObj) {
- if (inputObj instanceof IHost)
- return (IHost) inputObj;
- else if (inputObj instanceof ISubSystem)
- return ((ISubSystem) inputObj).getHost();
- else if (inputObj instanceof ISystemFilterPoolReference) {
- ISubSystem ss = (ISubSystem) ((ISystemFilterPoolReference) inputObj).getProvider(); // will be a subsystem
- if (ss == null) return null;
- return ss.getHost();
- } else if (inputObj instanceof ISystemFilterReference) {
- ISubSystem ss = (ISubSystem) ((ISystemFilterReference) inputObj).getProvider(); // will be a subsystem
- if (ss == null) return null;
- return ss.getHost();
- } else if (inputObj instanceof ISystemFilterStringReference) {
- ISubSystem ss = (ISubSystem) ((ISystemFilterStringReference) inputObj).getProvider(); // will be a subsystem
- if (ss == null) return null;
- return ss.getHost();
- } else
- return null;
- }
-
- /**
- * Handy debug method to print a tree item
- */
- protected String printTreeItem(Item item) {
- if (item == null)
- return ""; //$NON-NLS-1$
- else if (item instanceof TreeItem) {
- TreeItem ti = (TreeItem) item;
- return printTreeItem(ti.getParentItem()) + "/" + ti.getText(); //$NON-NLS-1$
- } else
- return item.toString();
- }
-
- /**
- * Delete all occurrences of a given remote object
- */
- protected void deleteRemoteObject(Object deleteObject, ISubSystem subsystem) {
- List matches = null;
- String oldElementName = null;
-
- // STEP 1: get the object's remote adapter and subsystem
- if (deleteObject instanceof String)
- oldElementName = (String) deleteObject;
- else {
- ISystemViewElementAdapter rmtAdapter = getViewAdapter(deleteObject);
- if (rmtAdapter == null) return;
- oldElementName = rmtAdapter.getAbsoluteName(deleteObject);
- subsystem = rmtAdapter.getSubSystem(deleteObject);
- }
- // STEP 2: find all references to the object
- matches = findAllRemoteItemReferences(oldElementName, deleteObject, subsystem, matches);
- if (matches == null) {
- //System.out.println("matches is null");
- return;
- }
-
- boolean wasSelected = false;
- Item parentItem = null;
-
- boolean dupes = false;
- Object prevData = null;
- for (int idx = 0; !dupes && (idx < matches.size()); idx++) {
- Item match = (Item) matches.get(idx);
- if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed()) {
- if (match.getData() == prevData)
- dupes = true;
- else
- prevData = match.getData();
- }
- }
- //System.out.println("matches size = " + matches.size() + ", any binary duplicates? " + dupes);
-
- List toRemove = new ArrayList();
- // STEP 3: process all references to the object
- for (int idx = 0; idx < matches.size(); idx++) {
- Item match = (Item) matches.get(idx);
- //System.out.println("...match " + idx + ": TreeItem? " + (match instanceof TreeItem) + ", disposed? " + ((TreeItem)match).isDisposed());
- // a reference to this remote object
- if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed()) {
- ((TreeItem) match).getParentItem(); // DWD may not be necessary
- //Object data = match.getData();
- if (!wasSelected) {
- //wasSelected = isSelectedOrChildSelected(data);
- wasSelected = isTreeItemSelectedOrChildSelected(match);
- if (wasSelected) {
- clearSelection();
- parentItem = ((TreeItem) match).getParentItem();
- //System.out.println("...current item was selected");
- }
- }
- if (dupes) // defect 46818
- { // if there are multiple references to the same binary object, ...
- //System.out.println(".....calling refresh(data) on this match");
- /*
- if (pItem!=null)
- smartRefresh(new TreeItem[] {pItem}); // just refresh the parent node
- else
- refreshAll();
- */
- disassociate(match);
- match.dispose();
- } else {
- toRemove.add(match);
- //System.out.println(".....calling remove(data) on this match");
- //remove(data); // remove this item from the tree
- }
- }
- }
-
- // do the remove now
- for (int i = 0; i < toRemove.size(); i++)
- {
- Item childItem = (Item)toRemove.get(i);
- disassociate(childItem);
- childItem.dispose();
- }
-
- // STEP 4: if we removed a selected item, select its parent
- if (wasSelected && (parentItem != null) && (parentItem instanceof TreeItem) && (parentItem.getData() != null)) {
- //System.out.println("Resetting selection to parent");
- setSelection(new StructuredSelection(parentItem.getData()), true);
- }
- return;
- }
-
- /**
- * Rename a remote object. Renames all references to it currently displayed in this tree.
- */
- protected void renameRemoteObject(Object renameObject, String oldElementName, ISubSystem subsystem) {
- String[] properties = new String[1];
- properties[0] = IBasicPropertyConstants.P_TEXT;
-
- // STEP 0: do we have the physical remote object that has been renamed? If so, update it directly
- /*
- Item item = (Item)findItem(renameObject);
- if (item != null)
- {
- update(renameObject, properties); // for refreshing non-structural properties in viewer when model changes
- if (item instanceof TreeItem)
- smartRefresh(new TreeItem[] {(TreeItem)item}); // we update the kids because they typically store references to their parent
- }
- */
-
- List matches = null;
-
- // STEP 1: get the object's remote adapter and subsystem
- String newElementName = null;
- ISystemViewElementAdapter rmtAdapter = null;
- if (renameObject instanceof String) {
- //FIXME How to get the adapter based on the String name?
- newElementName = (String)renameObject;
- } else {
- rmtAdapter = getViewAdapter(renameObject);
- subsystem = rmtAdapter.getSubSystem(renameObject);
- newElementName = rmtAdapter.getName(renameObject);
- }
-
- // STEP 2: find all references to the old name object
- matches = findAllRemoteItemReferences(oldElementName, renameObject, subsystem, matches);
- if (matches == null) return;
-
- TreeItem[] selected = getTree().getSelection();
- getTree().deselectAll();
-
- boolean refresh = false;
- // STEP 3: process all references to the old name object
- for (int idx = 0; idx < matches.size(); idx++) {
- Item match = (Item) matches.get(idx);
- // a reference to this remote object
- if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed())
- {
- Object data = match.getData();
-
- ISystemRemoteElementAdapter remoteAdapter = (ISystemRemoteElementAdapter)((IAdaptable)data).getAdapter(ISystemRemoteElementAdapter.class);
-
- if (data != renameObject) // not a binary match
- {
- if (remoteAdapter != null)
- {
- // DKM - would be nice to eventually get rid of remote element adapter
- refresh = remoteAdapter.refreshRemoteObject(data, renameObject); // old, new
- }
- } else {
- refresh = true;
- }
-
- // rename explicitly here (since internalUpdate doesn't seem to have an effect
- match.setText(newElementName);
- //updateItem(match, renameObject);
- internalUpdate(match, data, properties);
-
- //update(data, properties); // for refreshing non-structural properties in viewer when model changes
- //System.out.println("Match found. refresh required? " + refresh);
-// if (refresh)
- //refreshRemoteObject(data,null,false);
- // smartRefresh(new TreeItem[] { (TreeItem) match });
- }
- }
-
- if (refresh)
- {
- // causes duplicates to appear when there are more than one rename objects
- //smartRefresh((TreeItem[])matches.toArray(new TreeItem[matches.size()]));
- getTree().setSelection(selected);
- }
-
- // STEP 4: update property sheet, just in case.
- updatePropertySheet();
-
- return;
- }
-
- /**
- * Update properties of remote object. Update all references to this object
- */
- protected void updateRemoteObjectProperties(Object remoteObject) {
- List matches = new Vector();
-
- // STEP 1: get the object's remote adapter and subsystem
- ISystemRemoteElementAdapter rmtAdapter = (ISystemRemoteElementAdapter)((IAdaptable)remoteObject).getAdapter(ISystemRemoteElementAdapter.class);
-
- ISubSystem subsystem = rmtAdapter.getSubSystem(remoteObject);
-
- // STEP 2: find all references to the object
- String oldElementName = rmtAdapter.getAbsoluteName(remoteObject);
- findAllRemoteItemReferences(oldElementName, remoteObject, subsystem, matches);
-
- // STEP 3: process all references to the object
- String[] allProps = { IBasicPropertyConstants.P_TEXT, IBasicPropertyConstants.P_IMAGE };
- for (int idx = 0; idx < matches.size(); idx++) {
- Item match = (Item) matches.get(idx);
- // a reference to this remote object
- if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed()) {
- Object data = match.getData();
- if (data == remoteObject) // same binary object as given?
- update(data, allProps); // for refreshing non-structural properties in viewer when model changes
- else // match by name
- {
-
-
- rmtAdapter.refreshRemoteObject(data, remoteObject); // old, new
- update(data, allProps);
- }
- }
- }
-
- // STEP 4: update the property sheet in case we changed properties of first selected item
- updatePropertySheet();
- return;
- }
-
- /**
- * Refresh contents of remote container. Refreshes all references to this container including filters that
- * display the contents of this container.
- * @param remoteObject - either an actual remote object, or the absolute name of a remote object
- * @param toSelect - the child object to select after refreshing the given object. This will force the
- * object to be expanded, and then select this object which can be a remote object or absolute name of a
- * remote object. To simply force an expand of the remote object, without bothering to select a child,
- * pass an instance of SystemViewDummyObject.
- * @return true if a refresh done, false if given a non-remote object.
- */
- protected boolean refreshRemoteObject(Object remoteObject, Object toSelect, boolean originatedHere) {
- if (remoteObject == null) return false;
-
- // STEP 1: get the object's remote adapter and subsystem, or use its name if only given that
- ISystemViewElementAdapter rmtAdapter = null;
- ISubSystem subsystem = null;
- String oldElementName = null;
- boolean doesDeferredQueries = false;
- if (!(remoteObject instanceof String)) {
- rmtAdapter = getViewAdapter(remoteObject);
- if (rmtAdapter == null) return false;
- subsystem = rmtAdapter.getSubSystem(remoteObject);
- assert subsystem!=null : "EVENT_REFRESH_REMOTE outside subsystem"; //$NON-NLS-1$
- oldElementName = rmtAdapter.getAbsoluteName(remoteObject);
- doesDeferredQueries = rmtAdapter.supportsDeferredQueries(subsystem);
- } else
- oldElementName = (String) remoteObject;
-
- List matches = new Vector();
- // STEP 2: find all references to the object
- findAllRemoteItemReferences(oldElementName, remoteObject, subsystem, matches);
- if (matches.size()>0 && remoteObject instanceof String) {
- //TODO one String may reference multiple different context objects, so we should really iterate over all matches here
- //See javadoc of findAllRemoteItemReferences
- remoteObject = getFirstRemoteObject(matches);
- rmtAdapter = getViewAdapter(remoteObject);
- assert rmtAdapter!=null; //cannot happen because matches were result of String query
- if (rmtAdapter!=null) {
- subsystem = rmtAdapter.getSubSystem(remoteObject);
- assert subsystem!=null : "EVENT_REFRESH_REMOTE outside subsystem"; //$NON-NLS-1$
- doesDeferredQueries = rmtAdapter.supportsDeferredQueries(subsystem);
- }
- }
-
- if (remoteObject instanceof ISystemContainer) {
- ((ISystemContainer) remoteObject).markStale(true);
- }
-
- // STEP 3: process all references to the object
- boolean firstSelection = true;
- for (int idx = 0; idx < matches.size(); idx++) {
- Widget match = (Widget) matches.get(idx);
- // a reference to this remote object
- if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed()) {
- TreeItem matchedItem = (TreeItem)match;
- Object data = matchedItem.getData();
- boolean wasExpanded = matchedItem.getExpanded();
-
-
-
- smartRefresh(new TreeItem[] { matchedItem }); // refresh the remote object
- if (firstSelection && // for now, we just select the first binary occurrence we find
- (data == remoteObject)) // same binary object as given?
- {
- firstSelection = false;
- if ((toSelect != null) && originatedHere)
- {
- boolean allowExpand = true;
- if (rmtAdapter != null && data instanceof IAdaptable)
- {
- allowExpand = rmtAdapter.hasChildren((IAdaptable)data);
- }
- if (allowExpand && wasExpanded && !getExpanded(matchedItem)) // assume if callers wants to select kids that they want to expand parent
- {
- createChildren(matchedItem);
- setExpanded(matchedItem, true);
- }
-
- // todo: handle cumulative selections.
- // STEP 4: If requested, select the kids in the newly refreshed object.
- // If the same binary object appears multiple times, select the kids in the first occurrence.
- // ... what else to do?
- // DKM - added wasExpanded check since we don't want to expand something that isn't already expanded
- if (!doesDeferredQueries && wasExpanded && !(toSelect instanceof SystemViewDummyObject)) {
- //selecting remote objects makes only sense if not deferred, because
- //in the deferred case the objects will be retrieved in a separate job.
- selectRemoteObjects(toSelect, null, match); // select the given kids in this parent
- }
- }
- }
- }
- }
- return true;
- }
-
- protected void doUpdateItem(final Item item, Object element)
- {
- // adding this because base eclipse version isn't renaming properly on duplicates
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter != null && item != null && !item.isDisposed())
- {
- String oldText = item.getText();
- String newText = adapter.getText(element);
- if (oldText == null || !oldText.equals(newText))
- {
- //if (newText != null){
- item.setText(newText);
- //}
- }
- }
-
- super.doUpdateItem(item, element);
- }
-
- /**
- * Given the result TreeItems of findAllRemoteItemReferences,
- * return the Data of the first Item.
- */
- protected Object getFirstRemoteObject(List matches) {
- if ((matches == null) || (matches.size() == 0)) return null;
- Object firstRemote = matches.get(0);
- if (firstRemote != null) firstRemote = ((Item) firstRemote).getData();
- return firstRemote;
- }
-
- /**
- * Refreshes the tree starting at the given widget.
- *
- * @param widget the widget
- * @param element the element
- * @param doStruct <code>true</code> if structural changes are to be picked up,
- * and <code>false</code> if only label provider changes are of interest
- */
- protected void ourInternalRefresh(Widget widget, Object element, boolean doStruct, boolean forceRemote) {
- final Widget fWidget = widget;
- final Object fElement = element;
- final boolean fDoStruct = doStruct;
-
- // we have to take special care if one of our kids are selected and it is a remote object...
- if (forceRemote || (isSelectionRemote() && isTreeItemSelectedOrChildSelected(widget))) {
- if (!isTreeItemSelected(widget)) // it is one of our kids that is selected
- {
- //MOB cannot see why the selection is cleared here
- //clearSelection(); // there is nothing much else we can do. Calling code will restore it anyway hopefully
- doOurInternalRefresh(fWidget, fElement, fDoStruct, true);
- } else // it is us that is selected. This might be a refresh selected operation. TreeItem address won't change
- {
- doOurInternalRefresh(fWidget, fElement, fDoStruct, true);
- }
- } else {
- preservingSelection(new Runnable() {
- public void run() {
- doOurInternalRefresh(fWidget, fElement, fDoStruct, true);
- }
- });
- }
- }
-
- protected boolean isSelectionRemote() {
- ISelection s = getSelection();
- if (s instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) s;
- Iterator it = ss.iterator();
- while (it.hasNext()) {
- if (getRemoteAdapter(it.next()) != null) {
- return true;
- }
- }
- }
- return false;
- }
-
- protected void doOurInternalRefresh(Widget widget, Object element, boolean doStruct, boolean firstCall) {
- if (widget instanceof Item) {
- Object data = element;
- if (data instanceof IContextObject) {
- data = ((IContextObject)data).getModelObject();
- }
- if (doStruct) {
- updatePlus((Item) widget, data);
- }
- updateItem(widget, data);
- }
-
- /* may cause performance issue in bug 238363
- * calling refresh on each child item means that we'll be doing update on it
- * which ends up making it a pending decoration change since it's an update on an
- * item that already has text
- // recurse
- Item[] children = getChildren(widget);
- if (children != null) {
- for (int i = 0; i < children.length; i++) {
- Widget item = children[i];
- Object data = item.getData();
- if (data instanceof IAdaptable && item instanceof TreeItem) {
- data = getContextObject((TreeItem)item);
- }
- if (data != null) doOurInternalRefresh(item, data, doStruct, false);
- }
- }
-*/
-
- if (firstCall) {
-
- internalRefresh(element);
- }
- }
-
- /**
- * Override of internalRefreshStruct so that we can account for context
- */
- protected void internalRefreshStruct(Widget widget, Object element, boolean updateLabels) {
- if (widget instanceof TreeItem)
- {
- ContextObjectWithViewer contextObject = getContextObject((TreeItem)widget);
- IRSECallback callback = null;
-
- ArrayList expandedChildren = new ArrayList();
- if (widget instanceof TreeItem){
- TreeItem currItem = (TreeItem)widget;
- gatherExpandedChildren(currItem, currItem, expandedChildren);
- }
-
- if (expandedChildren.size() > 0){
- callback = new ExpandRemoteObjects(expandedChildren);
- contextObject.setCallback(callback);
- }
-
- internalRSERefreshStruct(widget, contextObject, updateLabels);
- }
- else
- {
- internalRSERefreshStruct(widget, element, updateLabels);
- }
- }
-
- /**
- * This is used during RSE refresh - otherwise filters aren't applied during refresh
- * @param widget the widget to refresh
- * @param element the element to refresh
- * @param updateLabels whether to update labels (ends up being ignored and having the value of true)
- */
- private void internalRSERefreshStruct(Widget widget, Object element, boolean updateLabels)
- {
- updateChildren(widget, element, null); // DKM - using deprecated API because it's the only way to call updateChildren
- // need a better solution for this in the future (the proper updateChildren is private)
- Item[] children = getChildren(widget);
- if (children != null) {
- for (int i = 0; i < children.length; i++) {
- Widget item = children[i];
- Object data = item.getData();
- if (data instanceof IAdaptable && item instanceof TreeItem) {
- data = getContextObject((TreeItem)item);
- }
- if (data != null) {
- internalRSERefreshStruct(item, data, updateLabels);
- }
- }
- }
-
- }
-
- protected Object[] getRawChildren(Widget w) {
- Object parent = w.getData();
-
- if (parent.equals(getRoot())) return super.getRawChildren(parent);
- Object[] result = ((ITreeContentProvider) getContentProvider()).getChildren(parent);
- if (result != null) return result;
-
- return new Object[0];
- }
-
- /*
- protected void preservingSelection(Runnable updateCode)
- {
- super.preservingSelection(updateCode);
- System.out.println("After preservingSelection: new selection = "+getFirstSelectionName(getSelection()));
- }
- protected void handleInvalidSelection(ISelection invalidSelection, ISelection newSelection)
- {
- System.out.println("Inside handleInvalidSelection: old = "+getFirstSelectionName(invalidSelection)+", new = "+getFirstSelectionName(newSelection));
- updateSelection(newSelection);
- }
- */
- protected String getFirstSelectionName(ISelection s) {
- if ((s != null) && (s instanceof IStructuredSelection)) {
- IStructuredSelection ss = (IStructuredSelection) s;
- Object firstSel = ss.getFirstElement();
- String name = null;
- if (firstSel != null) {
- ISystemRemoteElementAdapter ra = getRemoteAdapter(firstSel);
- if (ra != null)
- name = ra.getAbsoluteName(firstSel);
- else
- name = getViewAdapter(firstSel).getName(firstSel);
- }
- return name;
- } else
- return null;
- }
-
- /**
- * Expand a remote object within the tree. Must be given its parent element within the tree,
- * in order to uniquely find it. If not given this, we expand the first occurrence we find!
- * @param remoteObject - either a remote object or a remote object absolute name
- * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
- * @param parentObject - the parent that owns the remote objects, to optimize searches. Can
- * be an object or the absolute name of a remote object.
- * @return the tree item of the remote object if found and expanded, else null
- */
- public Item expandRemoteObject(Object remoteObject, ISubSystem subsystem, Object parentObject) {
- // given the parent? Should be easy
- Item remoteItem = null;
- if (parentObject != null) {
- Item parentItem = null;
- if (parentObject instanceof Item)
- parentItem = (Item) parentObject;
- else if (parentObject instanceof String) // given absolute name of remote object
- parentItem = findFirstRemoteItemReference((String) parentObject, subsystem, (Item) null); // search all roots for the parent
- else // given actual remote object
- {
- ISystemViewElementAdapter ra = getViewAdapter(parentObject);
- if (ra != null) {
- if (subsystem == null) subsystem = ra.getSubSystem(parentObject);
- parentItem = findFirstRemoteItemReference(ra.getAbsoluteName(parentObject), subsystem, (Item) null); // search all roots for the parent
- } else // else parent is not a remote object. Probably its a filter
- {
- Widget parentWidget = findItem(parentObject);
- if (parentWidget instanceof Item) parentItem = (Item) parentWidget;
- }
- }
- // ok, we have the parent item! Hopefully!
- if (remoteObject instanceof String)
- remoteItem = findFirstRemoteItemReference((String) remoteObject, subsystem, parentItem);
- else
- remoteItem = findFirstRemoteItemReference(remoteObject, parentItem);
- if (remoteItem == null) return null;
- setExpandedState(remoteItem.getData(), true);
- } else // not given a parent to refine search with. Better have a subsystem!!
- {
- if (remoteObject instanceof String)
- remoteItem = findFirstRemoteItemReference((String) remoteObject, subsystem, (Item) null);
- else {
- ISystemViewElementAdapter ra = getViewAdapter(remoteObject);
- if (ra != null) {
- if (subsystem == null) subsystem = ra.getSubSystem(remoteObject);
- remoteItem = findFirstRemoteItemReference(ra.getAbsoluteName(remoteObject), subsystem, (Item) null);
- }
- }
- if (remoteItem == null) return null;
- setExpandedState(remoteItem.getData(), true);
- }
- return remoteItem;
- }
-
- /**
- * Select a remote object or objects given the parent remote object (can be null) and subsystem (can be null)
- * @param src - either a remote object, a remote object absolute name, or a List of remote objects or remote object absolute names
- * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
- * @param parentObject - the parent that owns the remote objects, to optimize searches.
- * @return true if found and selected
- */
- public boolean selectRemoteObjects(Object src, ISubSystem subsystem, Object parentObject) {
- //String parentName = null;
- // given a parent object? That makes it easy...
- if (parentObject != null) {
- ISystemViewElementAdapter ra = getViewAdapter(parentObject);
- if (ra != null) {
- //parentName = ra.getAbsoluteName(parentObject);
- if (subsystem == null) subsystem = ra.getSubSystem(parentObject);
- Item parentItem = findFirstRemoteItemReference(parentObject, (Item) null); // search all roots for the parent
- return selectRemoteObjects(src, subsystem, parentItem);
- } else // else parent is not a remote object. Probably its a filter
- {
- Item parentItem = null;
- if (parentObject instanceof Item)
- parentItem = (Item) parentObject;
- else {
- Widget parentWidget = findItem(parentObject);
- if (parentWidget instanceof Item) parentItem = (Item) parentWidget;
- }
- if (parentItem != null)
- return selectRemoteObjects(src, (ISubSystem) null, parentItem);
- else
- return false;
- }
- } else
- //return selectRemoteObjects(src, (SubSystem)null, (Item)null); // Phil test
- return selectRemoteObjects(src, subsystem, (Item) null);
- }
-
- /**
- * Select a remote object or objects given the parent remote object (can be null) and subsystem (can be null) and parent TreeItem to
- * start the search at (can be null)
- * @param src - either a remote object, a remote object absolute name, or a List of remote objects or remote object absolute names
- * @param subsystem - the subsystem that owns the remote objects, to optimize searches.
- * @param parentItem - the parent at which to start the search to find the remote objects. Else, starts at the roots.
- * @return true if found and selected
- */
- protected boolean selectRemoteObjects(Object src, ISubSystem subsystem, Item parentItem) {
- clearSelection();
- Item selItem = null;
-
- if (parentItem != null && parentItem.isDisposed()) {
- return false;
- }
-
- if ((parentItem != null) && !getExpanded(parentItem))
- //setExpanded(parentItem, true);
- setExpandedState(parentItem.getData(), true);
-
- //System.out.println("SELECT_REMOTE: PARENT = " + parent + ", PARENTITEM = " + parentItem);
- if (src instanceof List) {
- //String elementName = null;
- List setList = (List)src;
- ArrayList selItems = new ArrayList();
- // our goal here is to turn the List of names or remote objects into a collection of
- // actual TreeItems we matched them on...
- for (int idx = 0; idx < setList.size(); idx++) {
- Object o = setList.get(idx);
- //elementName = null;
- if (o instanceof String)
- selItem = findFirstRemoteItemReference((String) o, subsystem, parentItem);
- else
- selItem = findFirstRemoteItemReference(o, parentItem);
-
- if (selItem != null) {
- selItems.add(selItem);
- // when selecting multiple items, we optimize by assuming they have the same parent...
- if ((parentItem == null) && (selItem instanceof TreeItem)) parentItem = ((TreeItem) selItem).getParentItem();
- }
- }
- if (selItems.size() > 0) {
- setSelection(selItems);
- updatePropertySheet();
- return true;
- }
- } else {
- if (src instanceof String)
- //selItem = (Item)findFirstRemoteItemReference((String)src, (SubSystem)null, parentItem); Phil test
- selItem = findFirstRemoteItemReference((String) src, subsystem, parentItem);
- else
- selItem = findFirstRemoteItemReference(src, parentItem);
-
- if (selItem != null) {
- ArrayList selItems = new ArrayList();
- selItems.add(selItem);
- setSelection(selItems);
- updatePropertySheet();
- return true;
- }
- }
- return false;
- }
-
- /**
- * Refresh the whole tree. We have special code to reselect remote objects after the refresh
- */
- public void refreshAll() {
- IStructuredSelection selected = (IStructuredSelection) getSelection();
- Iterator i = selected.iterator();
- Object parentElement = null;
- List selectedRemoteObjects = new Vector();
- Widget parentItem = null;
- ISubSystem ss = null;
- while (i.hasNext()) {
- Object element = i.next();
- if (parentElement == null) {
- Item item = (Item) findItem(element);
- if (item != null) {
- parentItem = getParentItem(item);
- }
- if ((parentItem != null) && (parentItem instanceof Item)) parentElement = ((Item) parentItem).getData();
- }
- if (getViewAdapter(element) != null) {
- selectedRemoteObjects.add(element);
- if (ss == null) ss = getViewAdapter(element).getSubSystem(element);
- }
- }
-
- //super.refresh();
- smartRefresh((Object) null, (selectedRemoteObjects.size() > 0));
-
- if (selectedRemoteObjects.size() > 0) {
- selectRemoteObjects(selectedRemoteObjects, ss, parentElement);
- }
- }
-
- /**
- * Do an intelligent refresh of an expanded item. The inherited algorithm for refresh is stupid,
- * in that it re-expands children based on their original ordinal position which can change after a
- * refresh, resulting in the wrong children being expanded. Currently this only truly comes to light
- * for remote objects, where refresh really can change the resulting list and hence each child's
- * ordinal position. So, to be safe we only override the inherited algorithm if any nested child
- * is a remote object
- */
- protected void smartRefresh(TreeItem[] itemsToRefresh) {
- smartRefresh(itemsToRefresh, null, false);
- }
-
- protected void smartRefresh(TreeItem[] itemsToRefresh, ArrayList expandedChildren, boolean forceRemote) {
- areAnyRemote = false; // set in ExpandedItem constructor
- boolean fullRefresh = false;
- // for each selected tree item gather a list of expanded child nodes...
- if (expandedChildren == null)
- expandedChildren = new ArrayList();
- else
- fullRefresh = true;
- boolean[] wasExpanded = new boolean[itemsToRefresh.length];
- for (int idx = 0; idx < itemsToRefresh.length; idx++) {
- TreeItem currItem = itemsToRefresh[idx];
- if (currItem.getExpanded()) {
- // ...if this selected item is expanded, recursively gather up all its expanded descendents
- Object data = currItem.getData();
- ISystemViewElementAdapter adapter = null;
- if (data != null) adapter = getViewAdapter(data);
- if (adapter != null && adapter.isPromptable(data))
- setExpandedState(data, false); // collapse temp expansion of prompts
- else {
- //expandedChildren.add(new ExpandedItem(currItem)); we don't need special processing for given items themselves as they will not be refreshed, only their kids
- gatherExpandedChildren((fullRefresh ? null : currItem), currItem, expandedChildren);
- wasExpanded[idx] = true;
- }
- } else {
- wasExpanded[idx] = false;
- }
- }
- // ok, we have found all expanded descendants of all selected items.
- // If none of the expanded sub-nodes are remote simply use the inherited algorithm for refresh
- if (!areAnyRemote) {
- for (int idx = 0; idx < itemsToRefresh.length; idx++)
- //ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), wasExpanded[idx]);
- ourInternalRefresh(itemsToRefresh[idx], itemsToRefresh[idx].getData(), true, forceRemote); // defect 42321
- return;
- }
- getControl().setRedraw(false);
- // If any selected nodes are remote use our own algorithm:
- // 1. collapse each given node and refresh it to remove the children from memory, then
- // expand it again. It doesn't matter if it is remote or not since its own memory
- // address (absolute name) won't change, only that of its children.
- for (int idx = 0; idx < itemsToRefresh.length; idx++) {
- TreeItem currItem = itemsToRefresh[idx];
- setExpanded(currItem, false); // collapse node
- ourInternalRefresh(currItem, currItem.getData(), true, true); // dispose of children, update plus
-
- if (wasExpanded[idx]) {
-
-
-
- IRSECallback callback = new ExpandRemoteObjects(expandedChildren);
-
- createChildren(currItem, callback); // re-expand
- currItem.setExpanded(true);
- } else // hmm, item was not expanded so just flush its memory
- {
-
- }
- }
-
- // for non-deferred queries
-
- // 2. expand each previously expanded sub-node, recursively
- for (int idx = 0; idx < expandedChildren.size(); idx++) {
- ExpandedItem itemToExpand = (ExpandedItem) expandedChildren.get(idx);
- if (itemToExpand.isRemote()) {
- // find remote item based on its original name and unchanged root parent
- Item item = null;
-
- // for deferred queries, we handle this via a callback
- item = findFirstRemoteItemReference(itemToExpand.remoteName, itemToExpand.subsystem, itemToExpand.parentItem);
-
- // if found, re-expand it
- if (item != null) {
- //setExpanded(item, true);
- createChildren(item);
- ((TreeItem) item).setExpanded(true);
- if (debug) System.out.println("Re-Expanded RemoteItem: " + itemToExpand.remoteName); //$NON-NLS-1$
- } else if (debug) System.out.println("Re-Expand of RemoteItem '" + itemToExpand.remoteName + "' failed. Not found"); //$NON-NLS-1$ //$NON-NLS-2$
- } else if (itemToExpand.data!=null) {
- setExpandedState(itemToExpand.data, true);
- if (debug) System.out.println("Re-Expanded non-remote Item: " + itemToExpand.data); //$NON-NLS-1$
- }
- }
-
- getControl().setRedraw(true);
- }
-
- public void refreshRemote(Object element)
- {
- smartRefresh(element, true);
- }
-
-
-
- protected ArrayList getExpandedChildren(TreeItem[] roots){
- ArrayList expandedChildren = new ArrayList();
- for (int idx = 0; idx < roots.length; idx++) {
- TreeItem currItem = roots[idx];
- if (currItem.getExpanded()) {
- Object data = currItem.getData();
- ISystemViewElementAdapter adapter = null;
- if (data != null) adapter = getViewAdapter(data);
- if(adapter != null && adapter.isPromptable(data)) {
- setExpandedState(data, false);
- }
- else {
- expandedChildren.add(new ExpandedItem(null, currItem));
- }
- }
- }
- return expandedChildren;
- }
-
- /**
- * Do an intelligent refresh of the given element. Can be null for full refresh
- */
- protected void smartRefresh(Object element, boolean forceRemote) {
- if ((element == null) || (element == getInput())) {
- // fullRefresh
- Tree tree = getTree();
- TreeItem[] roots = tree.getItems();
- boolean anyExpanded = false;
- areAnyRemote = false; // set in ExpandedItem constructor
- ArrayList expandedChildren = getExpandedChildren(roots);
- if (expandedChildren.size() > 0)
- anyExpanded = true;
-
- if (!anyExpanded)
- super.refresh();
- else {
- internalRefresh(getInput());
- roots = tree.getItems(); // re-query roots
- smartRefresh(roots, expandedChildren, forceRemote);
- }
- } else if (getViewAdapter(element) != null) {
-
- Item item = null;
- if (element instanceof String) {
- item = findFirstRemoteItemReference((String) element, (ISubSystem) null, (Item) null);
- if (item != null) {
- smartRefresh(new TreeItem[] { (TreeItem) item });
- }
- } else {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- // DKM - taken out as per defect 174295
- //String elementName = adapter.getName(element);
-
- String searchString = adapter.getAbsoluteName(element);
- ISubSystem subSystem = adapter.getSubSystem(element);
-
- List matches = new Vector();
- findAllRemoteItemReferences(searchString, element, subSystem, matches);
-
- // DKM - taken out as per defect 174295
- //findAllRemoteItemReferences(elementName, element, subSystem, matches);
- if (matches.size() > 0) {
- for (int i = 0; i < matches.size(); i++) {
- Item match = (Item) matches.get(i);
- if ((match instanceof TreeItem) && !((TreeItem) match).isDisposed()) {
- smartRefresh(new TreeItem[] { (TreeItem) match });
- }
- }
- }
- }
-
- /*
- Item item = null;
- if (element instanceof String)
- item = findFirstRemoteItemReference((String)element, (SubSystem)null, (Item)null);
- else
- item = findFirstRemoteItemReference(element, (Item)null);
- if (item != null)
- smartRefresh(new TreeItem[] {(TreeItem)item});
-
- */
- } else {
- Item item = (Item) findItem(element);
- //System.out.println("Inside SV smartRefresh for "+element+". Item found? " + (item!=null));
- if (item != null) smartRefresh(new TreeItem[] { (TreeItem) item });
- }
- }
-
- class ExpandedItem {
- //private TreeItem item; //not needed since we'll get the item by absolute name
- //For mixed remote/non-remote selections we may want a TreePath
- TreeItem parentItem;
- Object data;
- String remoteName;
- ISubSystem subsystem;
- private ISystemRemoteElementAdapter remoteAdapter;
-
- ExpandedItem(TreeItem parentItem, TreeItem item) {
- this.parentItem = parentItem;
- this.data = item.getData();
- if (data != null) {
- remoteAdapter = getRemoteAdapter(data);
- if (remoteAdapter != null) {
- remoteName = remoteAdapter.getAbsoluteName(data);
- subsystem = remoteAdapter.getSubSystem(data);
- areAnyRemote = true;
- if (debug) System.out.println("ExpandedRemoteItem added. remoteName = " + remoteName); //$NON-NLS-1$
- } else {
- ISystemViewElementAdapter adapter = getViewAdapter(data);
- if (adapter != null) {
- remoteName = adapter.getAbsoluteName(data);
- subsystem = adapter.getSubSystem(data);
- }
- if (debug) System.out.println("ExpandedItem added. Data = " + data); //$NON-NLS-1$
- }
- } else if (debug) System.out.println("ExpandedItem added. Data = null"); //$NON-NLS-1$
- }
-
- boolean isRemote() {
- return (remoteAdapter != null);
- }
- }
-
- /**
- * Gather up all expanded children of the given tree item into a list
- * that can be used later to reexpand.
- * @param parentItem The root parent which will not be refreshed itself
- * (only its kids) and hence will remain valid after refresh.
- * In a full refresh this will be null.
- * @param startingItem The starting item for this search.
- * Usually same as parentItem, but changes via recursion
- * @param listToPopulate An array list that will be populated
- * with instances of our inner class ExpandedItem
- */
- protected void gatherExpandedChildren(TreeItem parentItem, TreeItem startingItem, ArrayList listToPopulate) {
- TreeItem[] itemChildren = startingItem.getItems();
- for (int idx = 0; idx < itemChildren.length; idx++) {
- TreeItem currChild = itemChildren[idx];
- if (currChild.getExpanded()) {
- Object data = currChild.getData();
- ISystemViewElementAdapter adapter = null;
- if (data != null) adapter = getViewAdapter(data);
- if (adapter != null && adapter.isPromptable(data)) {
- setExpandedState(data, false);
- } else {
- listToPopulate.add(new ExpandedItem(parentItem, currChild));
- gatherExpandedChildren(parentItem, currChild, listToPopulate);
- }
- }
- }
- }
-
- /**
- * Get index of item given its data element
- */
- protected int getItemIndex(Widget parent, Object element) {
- int index = -1;
- Item[] kids = getChildren(parent);
- if (kids != null) for (int idx = 0; idx < kids.length; idx++)
- if (kids[idx].getData() == element) index = idx;
- return index;
- }
-
- /**
- * We don't show actual filters, only filter references that are unique generated
- * for each subtree of each subsystem. Yet, each event is relative to the filter,
- * not our special filter references. Hence, all this code!!
- * <p>
- * Special case handling for updates to filters which affect the filter
- * but not the filter parent:
- * 1. Existing filter renamed (RENAME)
- * 2. Existing filter's filter strings changed (CHANGE)
- * <p>
- * Assumption:
- * 1. event.getGrandParent() == subsystem (one event fired per affected subsystem)
- * 2. event.getSource() == filter or filter string (not the reference, the real filter or string)
- * 3. event.getParent() == parent of filter or filter string. One of:
- * a. filterPool reference or filter reference (nested)
- * b. filterPool for non-nested filters when showing filter pools
- * c. subsystem for non-nested filters when not showing filter pools
- * d. filter for nested filters
- * <p>
- * Our job here:
- * 1. Determine if we are even showing the given subsystem
- * 2. Find the reference to the updated filter in that subsystem's subtree
- * 3. Ask that parent to either update its name or collapse and refresh its children
- * 4. Forget selecting something ... the original item remains selected!
- */
- protected void findAndUpdateFilter(ISystemResourceChangeEvent event, int type) {
- ISystemFilter filter = (ISystemFilter) event.getSource();
- //Object parent = event.getParent();
- if (debug) {
- String eventType = null;
- switch (type) {
- case ISystemResourceChangeEvents.EVENT_RENAME_FILTER_REFERENCE:
- eventType = "EVENT_RENAME_FILTER_REFERENCE"; //$NON-NLS-1$
- break;
- case ISystemResourceChangeEvents.EVENT_CHANGE_FILTER_REFERENCE:
- eventType = "EVENT_CHANGE_FILTER_REFERENCE"; //$NON-NLS-1$
- break;
- }
- logDebugMsg("SV event: " + eventType); //$NON-NLS-1$
- }
-
- // STEP 1. ARE WE EVEN SHOWING THE GIVEN SUBSYSTEM?
- ISubSystem ss = (ISubSystem) event.getGrandParent();
- Widget widget = findItem(ss);
-
- if (widget != null) {
-
- // STEP 2: ARE WE SHOWING A REFERENCE TO RENAMED OR UPDATED FILTER?
- Widget item = null;
-
- Control c = getControl();
-
- // KM: defect 53008.
- // Yes we are showing the subsystem, so widget is the subsystem item
- if (widget != c && widget instanceof Item) {
-
- if (debug) logDebugMsg("...Found ss " + ss); //$NON-NLS-1$
-
- item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE);
- }
- // No, we are not showing the subsystem, so widget is the control
- else if (widget == c) {
-
- if (debug) logDebugMsg("...Din not find ss " + ss); //$NON-NLS-1$
-
- item = internalFindReferencedItem(widget, filter, SEARCH_INFINITE);
- }
-
- if (item == null)
- logDebugMsg("......didn't find renamed/updated filter's reference!"); //$NON-NLS-1$
- else {
- // STEP 3: UPDATE THAT FILTER...
- if (type == ISystemResourceChangeEvents.EVENT_RENAME_FILTER_REFERENCE) {
- String[] rproperties = { IBasicPropertyConstants.P_TEXT };
- update(item.getData(), rproperties); // for refreshing non-structural properties in viewer when model changes
- } else if (type == ISystemResourceChangeEvents.EVENT_CHANGE_FILTER_REFERENCE) {
- //if (((TreeItem)item).getExpanded())
- //refresh(item.getData());
- smartRefresh(new TreeItem[] { (TreeItem) item });
- /*
- Object data = item.getData();
- boolean wasExpanded = getExpanded((Item)item);
- setExpandedState(data, false); // collapse node
- refresh(data); // clear all cached widgets
- if (wasExpanded)
- setExpandedState(data, true); // by doing this all subnodes that were expanded are now collapsed
- */
- }
- updatePropertySheet();
- }
- }
- }
-
- protected void findAndUpdateFilterString(ISystemResourceChangeEvent event, int type) {
- ISystemFilterString filterString = (ISystemFilterString) event.getSource();
- // STEP 1. ARE WE EVEN SHOWING THE GIVEN SUBSYSTEM?
- ISubSystem ss = (ISubSystem) event.getGrandParent();
- Widget item = findItem(ss);
- if (item != null && item != getControl()) {
- Item ssItem = (Item) item;
- if (debug) logDebugMsg("...Found ss " + ss); //$NON-NLS-1$
- // STEP 2: ARE WE SHOWING A REFERENCE TO THE UPDATED FILTER STRING?
- item = internalFindReferencedItem(ssItem, filterString, SEARCH_INFINITE);
- if (item == null)
- logDebugMsg("......didn't find updated filter string's reference!"); //$NON-NLS-1$
- else {
- // STEP 3: UPDATE THAT FILTER STRING...
- if (type == ISystemResourceChangeEvents.EVENT_CHANGE_FILTERSTRING_REFERENCE) // HAD BETTER!
- {
- //if (((TreeItem)item).getExpanded())
- //refresh(item.getData());
- // boolean wasExpanded = getExpanded((Item)item);
- Object data = item.getData();
- setExpandedState(data, false); // collapse node
- refresh(data); // clear all cached widgets
- //if (wasExpanded)
- //setExpandedState(data, true); // hmm, should we?
- String properties[] = { IBasicPropertyConstants.P_TEXT };
- update(item.getData(), properties); // for refreshing non-structural properties in viewer when model changes
- updatePropertySheet();
- }
- }
- }
- }
-
- /**
- * We don't show actual filters, only filter references that are unique generated
- * for each subtree of each subsystem. Yet, each event is relative to the filter,
- * not our special filter references. Hence, all this code!!
- * <p>
- * Special case handling for updates to filters which affect the parent of the
- * filter, such that the parent's children must be re-generated:
- * 1. New filter created (ADD)
- * 2. Existing filter deleted (DELETE)
- * 3. Existing filters reordered (MOVE)
- * <p>
- * Assumption:
- * 1. event.getGrandParent() == subsystem (one event fired per affected subsystem)
- * 2. event.getSource() == filter (not the reference, the real filter)
- * 3. event.getParent() == parent of filter. One of:
- * a. filterPool reference or filter reference (nested)
- * b. filterPool for non-nested filters when showing filter pools
- * c. subsystem for non-nested filters when not showing filter pools
- * d. filter for nested filters
- * <p>
- * Our job here:
- * 1. Determine if we are even showing the given subsystem
- * 2. Find the parent to the given filter: filterPool or subsystem
- * 3. Ask that parent to refresh its children (causes re-gen of filter references)
- * 4. Select something: QUESTION: is this subsystem the origin of this action??
- * a. For ADD, select the newly created filter reference for the new filter
- * ANSWER: IF PARENT OF NEW FILTER IS WITHIN THIS SUBSYSTEM, AND WAS SELECTED PREVIOUSLY
- * b. For DELETE, select the parent of the filter?
- * ANSWER: IF DELETED FILTER IS WITHING THIS SUBSYSTEM AND WAS SELECTED PREVIOUSLY
- * c. For MOVE, select the moved filters
- * ANSWER: IF MOVED FILTERS ARE WITHIN THIS SUBSYSTEM, AND WERE SELECTED PREVIOUSLY
- */
- protected void findAndUpdateFilterParent(ISystemResourceChangeEvent event, int type) {
- ISubSystem ss = (ISubSystem) event.getGrandParent();
-
-
- boolean add = false, move = false, delete = false;
- boolean afilterstring = false;
- //if (debug)
- //{
- String eventType = null;
- switch (type) {
- case ISystemResourceChangeEvents.EVENT_ADD_FILTER_REFERENCE:
- add = true;
- if (debug) eventType = "EVENT_ADD_FILTER_REFERENCE"; //$NON-NLS-1$
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE_FILTER_REFERENCE:
- delete = true;
- if (debug) eventType = "EVENT_DELETE_FILTER_REFERENCE"; //$NON-NLS-1$
- break;
- case ISystemResourceChangeEvents.EVENT_MOVE_FILTER_REFERENCES:
- move = true;
- if (debug) eventType = "EVENT_MOVE_FILTER_REFERENCES"; //$NON-NLS-1$
- break;
- case ISystemResourceChangeEvents.EVENT_ADD_FILTERSTRING_REFERENCE:
- add = true;
- afilterstring = true;
- if (debug) eventType = "EVENT_ADD_FILTERSTRING_REFERENCE"; //$NON-NLS-1$
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE_FILTERSTRING_REFERENCE:
- delete = true;
- afilterstring = true;
- if (debug) eventType = "EVENT_DELETE_FILTERSTRING_REFERENCE"; //$NON-NLS-1$
- break;
- case ISystemResourceChangeEvents.EVENT_MOVE_FILTERSTRING_REFERENCES:
- move = true;
- afilterstring = true;
- if (debug) eventType = "EVENT_MOVE_FILTERSTRING_REFERENCES"; //$NON-NLS-1$
- break;
-
- }
- if (debug) logDebugMsg("SV event: " + eventType); //$NON-NLS-1$
- //}
- //clearSelection();
-
- ISystemFilter filter = null;
- ISystemFilterString filterstring = null;
- if (!afilterstring)
- filter = (ISystemFilter) event.getSource(); // for multi-source move, gets first filter
- else
- filterstring = (ISystemFilterString) event.getSource();
-
- boolean multiSource = move;
- // STEP 1: ARE WE SHOWING THE SUBSYSTEM GRANDPARENT OF CURRENT REFRESH?
- Widget item = findItem(ss);
-
- if (item == null) {
- refresh();
-
- if (debug) logDebugMsg("...Did not find ss " + ss.getName()); //$NON-NLS-1$
- return;
- }
-
- boolean wasSelected = false;
- IStructuredSelection oldSelections = (IStructuredSelection) getSelection();
-
- Object parent = event.getParent();
- if (debug) logDebugMsg("...Found ss " + ss); //$NON-NLS-1$
-
- // STEP 2: ARE WE SHOWING A REFERENCE TO THE FILTER's PARENT POOL?
- Widget parentRefItem = null;
- ISystemFilterContainer refdParent = null;
- // 3a (reference to filter pool or filter)
- if (parent instanceof ISystemFilterContainerReference) // given a reference to parent?
- {
- refdParent = ((ISystemFilterContainerReference) parent).getReferencedSystemFilterContainer();
- parentRefItem = internalFindReferencedItem(item, refdParent, SEARCH_INFINITE);
- }
- // 3b and 3d. (filter pool or filter)
- else if (parent instanceof ISystemFilterContainer) {
- refdParent = (ISystemFilterContainer) parent;
- parentRefItem = internalFindReferencedItem(item, refdParent, SEARCH_INFINITE);
- }
- // 3c (subsystem)
- else {
- parentRefItem = item;
- }
- if (parentRefItem != null) {
- if (debug) logDebugMsg("......We are showing reference to parent"); //$NON-NLS-1$
- // STEP 3... YES, SO REFRESH PARENT... IT WILL RE-GEN THE FILTER REFERENCES FOR EACH CHILD FILTER
- // ... actually, call off the whole show if that parent is currently not expanded!!
- // HMMM... WE NEED TO REFRESH EVEN IF NOT EXPANDED IF ADDING FIRST CHILD
- if (!add) // move or delete
- {
- // Widgets can only be Tree or TreeItem here
- if (parentRefItem instanceof Item){
- if (!(((TreeItem) parentRefItem).getExpanded())) {
- refresh(parentRefItem.getData()); // flush cached widgets so next expand is fresh
- return;
- }
- }
-
-
- // move or delete and parent is expanded...
- Item oldItem = (Item) internalFindReferencedItem(parentRefItem, afilterstring ? (Object) filterstring : (Object) filter, 1);
- //if (debug)
- //logDebugMsg("oldItem null? " + (oldItem==null));
- if (oldItem != null) // found moved or deleted filter in our subtree
- {
- wasSelected = isSelected(oldItem.getData(), oldSelections); // was it selected before?
- //if (debug)
- //logDebugMsg("was selected? " + wasSelected);
- } else {
- // else interesting case ... we are showing the parent, but can't find the child!
- }
- if (move) {
- Object[] srcObjects = null;
- if (multiSource)
- srcObjects = event.getMultiSource();
- else {
- srcObjects = new Object[1];
- srcObjects[0] = event.getSource();
- }
- moveReferencedTreeItems(parentRefItem, srcObjects, event.getPosition());
- //refresh(parentRefItem.getData());
- } else // remove
- {
- if (oldItem != null)
- remove(oldItem.getData());
- }
- } else // add operation
- {
- if (!(((TreeItem) parentRefItem).getExpanded())) {
- refresh(parentRefItem.getData()); // delete cached GUIs
- //setExpandedState(parentRefItem,true); // not our job to expand here.
- } else if (afilterstring) {
- ISystemFilterReference fr = (ISystemFilterReference) parentRefItem.getData();
- ISystemFilterStringReference fsr = fr.getSystemFilterStringReference(filterstring);
- createTreeItem(parentRefItem, fsr, event.getPosition());
- //setSelection(new StructuredSelection(fsr),true);
- } else {
- Object data = parentRefItem.getData();
- if (data instanceof ISystemFilterContainerReference) {
- ISystemFilterContainerReference sfcr = (ISystemFilterContainerReference) data;
- ISystemFilterReference sfr = sfcr.getSystemFilterReference(ss, filter);
- createTreeItem(parentRefItem, sfr, event.getPosition());
- } else // hmm, could be parent is a subsystem, child is a filter in no-show-filter-pools mode
- {
- if (data instanceof ISystemFilterPoolReferenceManagerProvider) // that's a subsystem!
- {
- ISystemFilterPoolReferenceManagerProvider sfprmp = (ISystemFilterPoolReferenceManagerProvider) data;
- ISystemFilterPoolReferenceManager sfprm = sfprmp.getSystemFilterPoolReferenceManager();
- ISystemFilterReference sfr = sfprm.getSystemFilterReference(ss, filter);
- createTreeItem(parentRefItem, sfr, sfprm.getSystemFilterReferencePosition(sfr));
- }
- }
- }
- //refresh(parentRefItem.getData());
- }
-
- // STEP 4: DECIDE WHAT TO SELECT:
-
- // 4a. ADD ... only select if parent of new filter was previously selected...
- if (add && isSelected(parentRefItem.getData(), oldSelections)) {
- if (debug) logDebugMsg(".........that parent was previously selected"); //$NON-NLS-1$
- // .... YES, SO SELECT NEW FILTER'S REFERENCE
- Item filterItem = (Item) internalFindReferencedItem(parentRefItem, afilterstring ? (Object) filterstring : (Object) filter, 1); // start at filter's parent, search for filter
- if (filterItem == null) {
- if (debug) logDebugMsg("Hmm, didn't find new filter's reference!"); //$NON-NLS-1$
- } else {
- if (debug) logDebugMsg(".........Trying to set selection to " + filterItem.getData()); //$NON-NLS-1$
- setSelection(new StructuredSelection(filterItem.getData()), true);
- }
- }
- // 4b. DELETE ... select parent if deleted filter was previously selected
- else if (delete && wasSelected) {
- setSelection(new StructuredSelection(parentRefItem.getData())); // select parent
- }
- // 4c. MOVE ... only select if any of moved references were previously selected...
- else if (move && wasSelected && !afilterstring) {
- ISystemFilter[] filters = (ISystemFilter[]) event.getMultiSource();
- if (filters != null) {
- ISystemFilterReference[] newRefs = new ISystemFilterReference[filters.length];
- for (int idx = 0; idx < newRefs.length; idx++) {
- Widget w = internalFindReferencedItem(parentRefItem, filters[idx], 1);
- newRefs[idx] = (ISystemFilterReference) ((Item) w).getData();
- }
- setSelection(new StructuredSelection(newRefs), true);
- }
- } else if (move && wasSelected && afilterstring) {
- ISystemFilterString[] filterStrings = (ISystemFilterString[]) event.getMultiSource();
- if (filterStrings != null) {
- ISystemFilterStringReference[] newRefs = new ISystemFilterStringReference[filterStrings.length];
- for (int idx = 0; idx < newRefs.length; idx++) {
- Widget w = internalFindReferencedItem(parentRefItem, filterStrings[idx], 1);
- newRefs[idx] = (ISystemFilterStringReference) ((Item) w).getData();
- }
- setSelection(new StructuredSelection(newRefs), true);
- }
- }
-
- } else if (debug) logDebugMsg("Did not find parent ref " + parent); //$NON-NLS-1$
- }
-
- /**
- * Move existing items a given number of positions within the same node.
- * If the delta is negative, they are all moved up by the given amount. If
- * positive, they are all moved down by the given amount.<p>
- */
- protected void moveReferencedTreeItems(Widget parentItem, Object[] masterSrc, int delta) {
- int[] oldPositions = new int[masterSrc.length];
- Item[] oldItems = new Item[masterSrc.length];
- Object[] src = new Object[masterSrc.length];
-
- for (int idx = 0; idx < src.length; idx++) {
- oldItems[idx] = (Item) internalFindReferencedItem(parentItem, masterSrc[idx], 1);
- src[idx] = oldItems[idx].getData();
- }
- Item[] children = null;
- if (parentItem instanceof Item) {
- children = getItems((Item) parentItem);
- } else
- children = getChildren(parentItem);
-
- for (int idx = 0; idx < src.length; idx++) {
- oldPositions[idx] = getTreeItemPosition(oldItems[idx], children) + 1;
- //logDebugMsg("::: Old position : " + oldPositions[idx]);
- }
-
- if (delta > 0) // moving down, process backwards
- {
- for (int idx = src.length - 1; idx >= 0; idx--) {
- //logDebugMsg("DN: Old position : " + oldPositions[idx] + ", new position : " + (oldPositions[idx]+delta));
- moveTreeItem(parentItem, oldItems[idx], src[idx], oldPositions[idx] + delta);
- }
- } else // moving up, process forewards
- {
- for (int idx = 0; idx < src.length; idx++) {
- //logDebugMsg("UP: Old position : " + oldPositions[idx] + ", new position : " + (oldPositions[idx]+delta-1));
- moveTreeItem(parentItem, oldItems[idx], src[idx], oldPositions[idx] + delta - 1);
- }
- }
- }
-
- /**
- * Recursively tries to find a reference to the given referenced item
- *
- * @param parent the parent item at which to start the search.
- * @param element the master element to which we want to find a tree item which references it
- * @param searchLimit how deep to search
- */
- protected Widget internalFindReferencedItem(Widget parent, Object element, int searchLimit) {
- previousItem = null;
- searchDepth = 0;
-
- Widget result = mappedFindFirstRemoteItemReference(element);
- if (result == null)
- {
- result = recursiveInternalFindReferencedItem(parent, element, searchLimit);
- }
- return result;
- }
-
- /**
- * Recursively tries to find a reference the given filtercontainer
- * Limits search depth to when we find an item that is not a connection,
- * subsystem, filter pool, filter or filter string.
- * @param parent the parent item at which to start the search.
- * @param element the master element to which we want to find a tree item which references it
- * @param searchLimit how deep to search
- */
- protected Widget recursiveInternalFindReferencedItem(Widget parent, Object element, int searchLimit) {
- // compare with node
- Object data = parent.getData();
- if ((data != null) && (data instanceof IRSEBaseReferencingObject)) {
- IRSEBaseReferencingObject refingData = (IRSEBaseReferencingObject) data;
- Object refedData = refingData.getReferencedObject();
- //logDebugMsg("data is a refing obj to " + refingData);
- if (refedData == element)
- //if (refedData.equals(element))
- return parent;
- else
- previousItem = parent;
- }
- // recurse over children if we are listing a subsystem or connection or
- // filter framework reference object, and nesting limit not reached.
- if (((data instanceof ISubSystem) || (data instanceof IHost) || (data instanceof ISystemFilterContainer) || (data instanceof ISystemFilterContainerReference) || (data instanceof ISystemFilterStringReference))
- && (searchDepth < searchLimit)) {
- ++searchDepth;
- int oldDepth = searchDepth;
- Item[] items = getChildren(parent);
- for (int i = 0; (i < items.length); i++)
- {
- Widget o = recursiveInternalFindReferencedItem(items[i], element, searchLimit);
- if (o != null) return o;
- searchDepth = oldDepth;
- }
- }
- return null;
- }
-
- /**
- * Recursively tries to find an item starting at the given item.
- * (base viewer classes do not offer a relative search!)
- *
- * @param parent the parent item at which to start the search.
- * @param element the element to match on. Matches on "==" versus equals()
- */
- protected Widget internalFindRelativeItem(Widget parent, Object element, int searchLimit) {
- searchDepth = 0;
- return recursiveInternalFindRelativeItem(parent, element, searchLimit);
- }
-
- /**
- * Recursively tries to find an item starting at the given item.
- * (base viewer classes do not offer a relative search!)
- *
- * @param parent the parent item at which to start the search.
- * @param element the element to match on. Matches on "==" versus equals()
- */
- protected Widget recursiveInternalFindRelativeItem(Widget parent, Object element, int searchLimit) {
- // compare with node
- Object data = parent.getData();
- if ((data != null) && (data == element)) return parent;
- // recurse over children
- if (searchDepth < searchLimit) {
- ++searchDepth;
- int oldDepth = searchDepth;
- Item[] items = getChildren(parent);
- for (int i = 0; i < items.length; i++) {
- Widget o = recursiveInternalFindRelativeItem(items[i], element, searchLimit);
- if (o != null) return o;
- searchDepth = oldDepth;
- }
- }
- return null;
- }
-
-
-
- /**
- * Find the first binary-match or name-match of remote object, given its absolute name.
- * @param remoteObjectName The absolute name of the remote object to find.
- * @param subsystem The subsystem of the remote object to find. Optional.
- * @param parentItem The parent item at which to start the search. Optional.
- * @return TreeItem hit if found
- */
- public Item findFirstRemoteItemReference(String remoteObjectName, ISubSystem subsystem, Item parentItem) {
- //List matches = new Vector();
- Item match = null;
- if (parentItem == null)
- //findAllRemoteItemReferences(remoteObjectName, null, subsystem, matches);
- match = internalFindFirstRemoteItemReference(remoteObjectName, null, subsystem);
- else {
-
- //recursiveFindAllRemoteItemReferences(parentItem, remoteObjectName, null, subsystem, matches);
- match = recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, null, subsystem);
- }
- //if (matches.size() > 0)
- // return (Item)matches.elementAt(0);
- //else
- // return null;
- return match;
- }
-
- /**
- * Find the first binary-match or name-match of a remote object, given its binary object.
- * @param remoteObject - The remote object to find.
- * @param parentItem - Optionally, the parent item to start the search at
- * @return TreeItem hit if found
- */
- public Item findFirstRemoteItemReference(Object remoteObject, Item parentItem) {
-
- Item match = mappedFindFirstRemoteItemReference(remoteObject);
- if (match != null)
- return match;
-
- //List matches = new Vector();
- ISystemViewElementAdapter adapter = getViewAdapter(remoteObject);
- if (adapter == null) return null;
-
- ISubSystem subsystem = adapter.getSubSystem(remoteObject);
- String remoteObjectName = adapter.getAbsoluteName(remoteObject);
- if (parentItem == null)
- //findAllRemoteItemReferences(remoteObjectName, remoteObject, subsystem, matches);
- match = internalFindFirstRemoteItemReference(remoteObjectName, remoteObject, subsystem);
- else {
- //recursiveFindAllRemoteItemReferences(parentItem, remoteObjectName, remoteObject, subsystem, matches);
- //System.out.println("recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, remoteObject, subsystem)");
- match = recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, remoteObject, subsystem);
- }
-
- //if (matches.size() > 0)
- // return (Item)matches.elementAt(0);
- //else
- // return null;
- return match;
- }
-
- /**
- * Recursively tries to find a given remote object. Since the object memory object
- * for a remote object is not dependable we call getAbsoluteName() on the adapter to
- * do the comparisons. Note this does not take into account the parent connection or
- * subsystem or filter, hence you must know where to start the search, else you risk
- * finding the wrong one.
- *
- * @param element the remote object to which we want to find a tree item which references it. Can be a string or an object
- * @param elementObject the actual remote element to find, for binary matching, optionally for cases when element is a string
- * @param matches the List to populate with hits, or <code>null</code> to
- * get a new List created and returned with the hits.
- * @return the List populated with hits, or <code>null</code> if <code>null</code>
- * was passed in as the List to populate and no hits were found.
- */
- public List findAllRemoteItemReferences(Object element, Object elementObject, List matches) {
- String searchString = null;
- ISubSystem subsystem = null;
- if (element instanceof String)
- searchString = (String) element;
- else {
- if (elementObject == null)
- elementObject = element;
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter == null)
- return matches;
- subsystem = adapter.getSubSystem(element);
- searchString = adapter.getAbsoluteName(element);
- }
- Tree tree = getTree();
- Item[] roots = tree.getItems();
- if (roots == null)
- return matches;
- if (matches == null)
- matches = new Vector();
-
- // try new map lookup method - won't work in cases of rename
- if (!mappedFindAllRemoteItemReferences(elementObject, matches)){
- for (int idx = 0; idx < roots.length; idx++) {
- //System.out.println("recursiveFindAllRemoteItemReferences(roots[idx], searchString, elementObject, subsystem, matches);");
- matches = recursiveFindAllRemoteItemReferences(roots[idx], searchString, elementObject, subsystem, matches);
- }
- }
-
- return matches;
- }
-
- /**
- * Recursively tries to find all occurrences of a given remote object, starting at the tree root.
- * Since the object memory object for a remote object is not dependable we call getAbsoluteName()
- * on the adapter to do the comparisons.
- * <p>
- * TODO: This method should not return any invalid matches, i.e. remote objects
- * that do match the String identifier but have been deleted already. Because the
- * same remote object can appear in multiple contexts in the RSE Tree, a single
- * remote object identifier String may evaluate to multiple different matches
- * to fill into the matches argument. All those context object matches, however,
- * reference the same real-world model objects due to the constraint that
- * {@link IRemoteObjectIdentifier} uniquely identifies a remote object.
- * <p>
- * This overload takes a string and a subsystem.
- *
- * @param searchString the absolute name of the remote object to which
- * we want to find a tree item which references it.
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @param matches the List to populate with hits (TreeItem objects),
- * or <code>null</code> to get a new List created and returned
- * @return the List populated with hits, or <code>null</code> if
- * <code>null</code> was passed as matches to populate and no matches
- * were found.
- */
- protected List findAllRemoteItemReferences(String searchString, Object elementObject, ISubSystem subsystem, List matches) {
- Tree tree = getTree();
- Item[] roots = tree.getItems();
- if (roots == null) return matches;
- if (matches == null)
- matches = new Vector();
-
- // try new map lookup method - won't work in cases of rename
- if (!mappedFindAllRemoteItemReferences(elementObject, matches)){
-
- boolean foundExact = false;
- for (int idx = 0; idx < roots.length; idx++){
- if (recursiveFindExactMatches((TreeItem)roots[idx], elementObject, subsystem, matches)){
- foundExact = true;
- }
- }
-
- if (!foundExact)
- {
- for (int idx = 0; idx < roots.length; idx++){
- matches = recursiveFindAllRemoteItemReferences(roots[idx], searchString, elementObject, subsystem, matches);
- }
- }
- }
- return matches;
- }
-
-
- private boolean recursiveFindExactMatches(TreeItem root, Object elementObject, ISubSystem subsystem, List matches)
- {
- boolean foundSomething = false;
- Object data = root.getData();
- if (data == elementObject)
- {
- matches.add(root);
- foundSomething = true;
- }
- if (subsystem != null){
- if (data instanceof ISubSystem){
- if (data != subsystem)
- return false;
- }
- else if (data instanceof IHost){
- if (subsystem.getHost() != data)
- return false;
- }
- }
-
- TreeItem[] children = root.getItems();
- for (int i = 0; i < children.length; i++)
- {
- if (recursiveFindExactMatches(children[i], elementObject, subsystem, matches))
- {
- foundSomething = true;
- }
- }
- return foundSomething;
- }
-
- /**
- * Recursively tries to find the first occurrence of a given remote object, starting at the tree root.
- * Optionally scoped to a specific subsystem.
- * Since the object memory object for a remote object is not dependable we call getAbsoluteName()
- * on the adapter to do the comparisons.
- * <p>
- * This overload takes a string and a subsystem.
- *
- * @param searchString the absolute name of the remote object to which we want to find a tree item which references it.
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @return TreeItem hit if found
- */
- protected Item internalFindFirstRemoteItemReference(String searchString, Object elementObject, ISubSystem subsystem) {
- Item[] roots = getTree().getItems();
- if ((roots == null) || (roots.length == 0)) return null;
-
- // use map first
- Item match = mappedFindFirstRemoteItemReference(elementObject);
-
- for (int idx = 0; (match == null) && (idx < roots.length); idx++) {
- //System.out.println("recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, remoteObject, subsystem)");
- match = recursiveFindFirstRemoteItemReference(roots[idx], searchString, elementObject, subsystem);
- }
-
- return match;
- }
-
- protected Item mappedFindFirstRemoteItemReference(Object elementObject)
- {
- return (Item)findItem(elementObject);
- }
-
- protected boolean mappedFindAllRemoteItemReferences(Object elementObject, List occurrences)
- {
- Widget[] items = findItems(elementObject);
- if (items.length > 0)
- {
- for (int i = 0; i < items.length; i++)
- {
- occurrences.add(items[i]);
- }
- return true;
- }
-
- return false;
- }
-
- /**
- * Recursively tries to find all references to a remote object.
- * @param parent the parent item at which to start the search.
- * @param elementName the absolute name of the remote element to find
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @param occurrences the List to populate with hits. Must not be <code>null</code>
- * @return the given List populated with hits
- */
- protected List recursiveFindAllRemoteItemReferences(Item parent, String elementName, Object elementObject, ISubSystem subsystem, List occurrences) {
- Object rawData = parent.getData();
- ISystemViewElementAdapter remoteAdapter = null;
- // ----------------------------
- // what are we looking at here?
- // ----------------------------
- if (rawData != null) remoteAdapter = getViewAdapter(rawData);
- // -----------------------------------------------------------------------
- // if this is a remote object, test if it is the one we are looking for...
- // -----------------------------------------------------------------------
- if (remoteAdapter != null) {
- // first test for binary match
- if (elementObject == rawData) {
- occurrences.add(parent); // found a match!
- if (debugRemote) System.out.println("Find All: Remote item binary match found"); //$NON-NLS-1$
- return occurrences; // no point in checking the kids
- }
- // now test for absolute name match
- String fqn = remoteAdapter.getAbsoluteName(rawData);
- if (debugRemote) System.out.println("TESTING FINDALL: '" + fqn + "' vs '" + elementName + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if ((fqn != null) && fqn.equals(elementName)) {
- occurrences.add(parent); // found a match!
- if (debugRemote) System.out.println("...and remote item name match found"); //$NON-NLS-1$
- return occurrences; // no point in checking the kids
- }
- }
- // -------------------------------------------------------------------------
- // if we have been given a subsystem to restrict to, that is a hint to us...
- // -------------------------------------------------------------------------
- else if ((rawData != null) && (subsystem != null)) // test for hints we are in the wrong place
- {
- // if we are currently visiting a subsystem, and that subsystem is not from the same
- // factory, then we can assume the remote object occurrences we are looking for are
- // not to be found within this branch...
- if ((rawData instanceof ISubSystem) && (((ISubSystem) rawData).getSubSystemConfiguration() != subsystem.getSubSystemConfiguration())) {
- return occurrences; // they don't match, so don't bother checking the kids
- }
- // if we are currently visiting a connection, and that connection's hostname is not the same
- // as that of our given subsystem, then we can assume the remote object occurrences we are
- // looking for are not to be found within this branch...
- else if ((rawData instanceof IHost) && (!((IHost) rawData).getHostName().equals(subsystem.getHost().getHostName()))) {
- return occurrences; // they don't match, so don't bother checking the kids
- }
- }
- // recurse over children
- Item[] items = getChildren(parent);
- for (int i = 0; (i < items.length); i++) {
-
- if (!items[i].isDisposed()) occurrences = recursiveFindAllRemoteItemReferences(items[i], elementName, elementObject, subsystem, occurrences);
- }
- return occurrences;
- }
-
-
-
-
- /**
- * Recursively tries to find the first references to a remote object.
- * This search is restricted to the given subsystem, if given.
- * @param parent the parent item at which to start the search.
- * @param elementName the absolute name of the remote element to find
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @return TreeItem match if found, null if not found.
- */
- protected Item recursiveFindFirstRemoteItemReference(Item parent, String elementName, Object elementObject, ISubSystem subsystem) {
- Object rawData = parent.getData();
- ISystemViewElementAdapter remoteAdapter = null;
- // ----------------------------
- // what are we looking at here?
- // ----------------------------
- if (rawData != null) remoteAdapter = getViewAdapter(rawData);
- // -----------------------------------------------------------------------
- // if this is a remote object, test if it is the one we are looking for...
- // -----------------------------------------------------------------------
- if (remoteAdapter != null) {
- // first test for binary match
- if (elementObject == rawData) {
- if (debugRemote) System.out.println("Remote item binary match found"); //$NON-NLS-1$
- return parent; // return the match
- }
- // now test for absolute name match
- String fqn = remoteAdapter.getAbsoluteName(rawData);
- if (debugRemote) System.out.println("TESTING FINDFIRST: '" + fqn + "' vs '" + elementName + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if ((fqn != null) && fqn.equals(elementName)) {
- if ((subsystem != null) && (subsystem == remoteAdapter.getSubSystem(rawData))) {
- if (debugRemote) System.out.println("Remote item name match found and subsystems matched"); //$NON-NLS-1$
- return parent; // return the match
- } else if (subsystem == null) {
- if (debugRemote) System.out.println("Remote item name match found and subsystem null"); //$NON-NLS-1$
- return parent;
- } else if (debugRemote) System.out.println("Remote item name match found but subsystem mismatch"); //$NON-NLS-1$
- }
- }
- // -------------------------------------------------------------------------
- // if we have been given a subsystem to restrict to, that is a hint to us...
- // -------------------------------------------------------------------------
- else if ((rawData != null) && (subsystem != null)) // test for hints we are in the wrong place
- {
- // if we are currently visiting a subsystem, and that subsystem is not from the same
- // factory, then we can assume the remote object occurrences we are looking for are
- // not to be found within this branch...
- if ((rawData instanceof ISubSystem) && (rawData != subsystem)) {
- return null; // they don't match, so don't bother checking the kids
- }
- // if we are currently visiting a connection, and that connection's hostname is not the same
- // as that of our given subsystem, then we can assume the remote object occurrences we are
- // looking for are not to be found within this branch...
- else if ((rawData instanceof IHost) && !((IHost) rawData).getHostName().equals(subsystem.getHost().getHostName())) {
- return null; // they don't match, so don't bother checking the kids
- }
- }
- // recurse over children
- Item[] items = getChildren(parent);
- Item match = null;
- for (int i = 0; (match == null) && (i < items.length); i++) {
- if (!items[i].isDisposed()) match = recursiveFindFirstRemoteItemReference(items[i], elementName, elementObject, subsystem);
- }
- return match;
- }
-
- /**
- * Recursively tries to find all filters affected by a given remote object.
- *
- * @param elementName the absolute name of the remote object to which we want to find a filters which result in it.
- * @param subsystem The subsystem which owns the remote resource. Necessary to scope the search for impacted filters.
- * @param matches the List to populate with hits. Can be <code>null</code>,
- * in which case a new List is created and returned.
- * @return List of FilterMatch objects for each affected filter, or
- * <code>null</code> if <code>null</code> was passed in as the List
- * to populate and no matches were found.
- */
- protected List findAllRemoteItemFilterReferences(String elementName, ISubSystem subsystem, List matches) {
- Tree tree = getTree();
- Item[] roots = tree.getItems();
- if (roots == null) return matches;
- if (matches == null)
- matches = new Vector();
-
- for (int idx = 0; idx < roots.length; idx++){
- matches = recursiveFindAllRemoteItemFilterReferences(roots[idx], elementName, subsystem, matches);
- }
- return matches;
-
- }
-
- /**
- * Recursively tries to find all filters which are affected by a given remote object, such that we can subsequently refresh that filter
- * after a remote resource change.
- * @param parent the parent item at which to start the search.
- * @param elementName the absolute name of the remote element that has been created, changed, deleted or renamed.
- * @param subsystem The subsystem which owns the remote resource. Necessary to scope the search for impacted filters.
- * @param occurrences the List to populate with hits. Must not be <code>null</code>.
- *
- * @return The given List of occurrences, populated with FilterMatch objects
- * for each affected filter.
- */
- protected List recursiveFindAllRemoteItemFilterReferences(Item parent, String elementName, ISubSystem subsystem, List occurrences) {
- Object rawData = parent.getData();
-
- // ----------------------------
- // what are we looking at here?
- // ----------------------------
-
- // ---------------------------------------------------------------------
- // if this is a filter object, test for two things:
- // #1. does this filter list this remote object if expanded/refreshed?
- // #2. does this filter list the contents of this remote object?
- // ---------------------------------------------------------------------
- if (rawData instanceof ISystemFilterReference) {
- ISystemFilterReference filterRef = (ISystemFilterReference) rawData;
- if (filterRef.getReferencedFilter().isPromptable()) return occurrences;
- ISubSystem fss = (ISubSystem) filterRef.getProvider();
- if (fss != null) // should never happen!!
- {
- // #1
- if (fss.doesFilterMatch(filterRef.getReferencedFilter(), elementName)) {
- occurrences.add(new FilterMatch((TreeItem) parent, true)); // found a match!
- if (debugRemote) System.out.println("...Filter match found for " + elementName + ": " + filterRef.getReferencedFilter().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- return occurrences; // no point in checking the kids
- }
- // #2
- else if (fss.doesFilterListContentsOf(filterRef.getReferencedFilter(), elementName)) {
- occurrences.add(new FilterMatch((TreeItem) parent, false)); // found a match!
- if (debugRemote) System.out.println("...Filter content match found for " + elementName + ": " + filterRef.getReferencedFilter().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- return occurrences; // no point in checking the kids
- } else if (debugRemote) System.out.println("... no match on the filter for element name " + elementName); //$NON-NLS-1$
- }
- }
- // ----------------------------------------------------------------------
- // if this is not a filter, then before recursing on its kids, check for
- // hints that such recursion is a waste of time, for performance reasons
- // ----------------------------------------------------------------------
- else if (rawData != null) {
- // ---------------------------------------------------------------------------------
- // if we are currently visiting a subsystem, and that subsystem is not from the same
- // factory, then we can assume the remote object occurrences we are looking for are
- // not to be found within this branch...
- // ---------------------------------------------------------------------------------
- if ((rawData instanceof ISubSystem) && (subsystem != null)) {
- ISubSystem currSS = (ISubSystem) rawData;
- if (currSS.getSubSystemConfiguration() != subsystem.getSubSystemConfiguration()) return occurrences; // they don't match, so don't bother checking the kids
- }
- // -----------------------------------------------------------------------------------------
- // if we are currently visiting a connection, and that connection's hostname is not the same
- // as that of our given subsystem, then we can assume the remote object occurrences we are
- // looking for are not to be found within this branch...
- // -----------------------------------------------------------------------------------------
- else if (rawData instanceof IHost) {
- if (subsystem==null) {
- return occurrences; //bug 187061: renaming a host has no subsystem associated, therefore no other matches to rename
- }
- IHost currConn = (IHost) rawData;
- if (!currConn.getHostName().equals(subsystem.getHost().getHostName()))
- return occurrences; // they don't match, so don't bother checking the kids
- }
- // skip the new connection prompts...
- else if (rawData instanceof ISystemPromptableObject)
- return occurrences;
- // ------------------------------------------------------------------------
- // if this is a remote object, we are too deep into this branch of the tree
- // for filters, so stop here
- // ------------------------------------------------------------------------
- else if (getRemoteAdapter(rawData) != null) return occurrences;
- }
- // recurse over children
- Item[] items = getChildren(parent);
- for (int i = 0; (i < items.length); i++) {
- occurrences = recursiveFindAllRemoteItemFilterReferences(items[i], elementName, subsystem, occurrences);
- }
- return occurrences;
- }
-
- /**
- * Inner class to encapsulate what is put in the List for the recursiveFindAllRemoteItemFilterReferences() method.
- */
- protected class FilterMatch {
- protected boolean filterListsElement;
- protected boolean filterListsElementContents;
- protected TreeItem match;
-
- FilterMatch(TreeItem match, boolean filterListsElement) {
- this.match = match;
- this.filterListsElement = filterListsElement;
- this.filterListsElementContents = !filterListsElement;
- }
-
- boolean listsElement() {
- return filterListsElement;
- }
-
- boolean listsElementContents() {
- return filterListsElementContents;
- }
-
- TreeItem getTreeItem() {
- return match;
- }
- }
-
- /**
- * --------------------------------------------------------------------------------
- * For many actions we have to walk the selection list and examine each selected
- * object to decide if a given common action is supported or not.
- * <p>
- * Walking this list multiple times while building the popup menu is a performance
- * hit, so we have this common method that does it only once, setting instance
- * variables for all of the decisions we are in interested in.
- * --------------------------------------------------------------------------------
- */
- protected void scanSelections(String whereFrom) {
- //System.out.println("inside scanSelections. Called from " + whereFrom);
- // here are the instance variables we set...
- // protected boolean selectionShowRefreshAction;
- // protected boolean selectionShowOpenViewActions;
- // protected boolean selectionShowDeleteAction;
- // protected boolean selectionShowRenameAction;
- // protected boolean selectionIsRemoteObject;
- // protected boolean selectionEnableDeleteAction;
- // protected boolean selectionEnableRenameAction;
-
-
- // initial these variables to true. Then if set to false even once, leave as false always...
- selectionShowPropertiesAction = true;
- selectionShowRefreshAction = true;
- selectionShowOpenViewActions = true;
- selectionShowGenericShowInTableAction = true;
- selectionShowDeleteAction = true;
- selectionShowRenameAction = true;
- selectionEnableDeleteAction = true;
- selectionEnableRenameAction = true;
- selectionIsRemoteObject = true;
-
- selectionHasAncestorRelation = hasAncestorRelationSelection();
-
-
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- SystemRemoteElementResourceSet lastSet = null;
- while (elements.hasNext()) {
-
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter == null) continue;
-
- if (selectionShowPropertiesAction) selectionShowPropertiesAction = adapter.showProperties(element);
-
- if (selectionShowRefreshAction) selectionShowRefreshAction = adapter.showRefresh(element);
-
- if (selectionShowOpenViewActions) selectionShowOpenViewActions = adapter.showOpenViewActions(element);
-
- if (selectionShowGenericShowInTableAction) selectionShowGenericShowInTableAction = adapter.showGenericShowInTableAction(element);
-
- if (selectionShowDeleteAction) selectionShowDeleteAction = adapter.showDelete(element);
-
- if (selectionShowRenameAction) selectionShowRenameAction = adapter.showRename(element);
-
- if (selectionEnableDeleteAction) selectionEnableDeleteAction = selectionShowDeleteAction && adapter.canDelete(element) && !selectionHasAncestorRelation;
- //System.out.println("ENABLE DELETE SET TO " + selectionEnableDeleteAction);
-
- if (selectionEnableRenameAction) selectionEnableRenameAction = selectionShowRenameAction && adapter.canRename(element);
-
- if (selectionIsRemoteObject) selectionIsRemoteObject = adapter.isRemote(element);
-
- if (selectionIsRemoteObject && !selectionFlagsUpdated) {
- ISubSystem srcSubSystem = adapter.getSubSystem(element);
- if (srcSubSystem != null &&
- (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem))
- {
- SystemRemoteElementResourceSet set = null;
- if (lastSet != null)
- {
- if (lastSet.getViewAdapter() == adapter && lastSet.getSubSystem() == srcSubSystem)
- {
- set = lastSet;
- }
- }
- if (set == null)
- {
- set = getSetFor(srcSubSystem, adapter);
- lastSet = set;
- }
- set.addResource(element);
- }
- }
-
- }
-
-
- selectionFlagsUpdated = true;
- //System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions);
-
- }
-
- /**
- * Decides whether to even show the properties menu item.
- * Assumes scanSelections() has already been called
- */
- protected boolean showProperties() {
- return selectionShowPropertiesAction;
- }
-
- /**
- * Decides whether to even show the refresh menu item.
- * Assumes scanSelections() has already been called
- */
- protected boolean showRefresh() {
- return selectionShowRefreshAction;
- /*
- boolean ok = true;
- IStructuredSelection selection= (IStructuredSelection)getSelection();
- Iterator elements= selection.iterator();
- int count = 0;
- while (ok && elements.hasNext())
- {
- Object element= elements.next();
- ISystemViewElementAdapter adapter = getAdapter(element);
- if (!adapter.showRefresh(element))
- ok = false;
- }
- return ok;
- */
- }
-
- /**
- * Decides whether to even show the "open in new perspective" menu item.
- * Assumes scanSelections() has already been called
- */
- protected boolean showOpenViewActions() {
- return selectionShowOpenViewActions;
- }
-
- /**
- * Decides whether to even show the generic "show in table" menu item.
- * Assumes scanSelections() has already been called
- */
- protected boolean showGenericShowInTableAction() {
- return selectionShowGenericShowInTableAction;
- }
-
- /**
- * Decides whether all the selected objects are remote objects or not
- * Assumes scanSelections() has already been called
- */
- protected boolean areSelectionsRemote() {
- return selectionIsRemoteObject;
- }
-
- // ---------------------------
- // ISYSTEMDELETETARGET METHODS
- // ---------------------------
-
- /**
- * Required method from ISystemDeleteTarget.
- * Decides whether to even show the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showDelete() {
- if (!selectionFlagsUpdated) {
- //System.out.println("Inside showDelete. selectFlagsUpdated = false");
- scanSelections("showDelete"); //$NON-NLS-1$
- }
- return selectionShowDeleteAction;
- }
-
- /**
- * Required method from ISystemDeleteTarget
- * Decides whether to enable the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canDelete() {
- if (!selectionFlagsUpdated) {
- //System.out.println("Inside canDelete. selectFlagsUpdated = false");
- scanSelections("canDelete"); //$NON-NLS-1$
- }
- return selectionEnableDeleteAction;
- }
-
- /**
- * Required method from ISystemDeleteTarget
- *
- * @deprecated all deletion should now occur independently of the view and the
- * view should only deal with the handling of refresh events
- */
- public boolean doDelete(IProgressMonitor monitor) {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- //int selectedCount = selection.size();
- //Object multiSource[] = new Object[selectedCount];
- //int idx = 0;
- Object element = null;
- //Object parentElement = getSelectedParent();
- ISystemViewElementAdapter adapter = null;
- boolean ok = true;
- boolean anyOk = false;
- List deletedVector = new Vector();
-
- // keep track of the current set
- SystemRemoteElementResourceSet set = null;
-
- try {
- while (ok && elements.hasNext()) {
- element = elements.next();
- //multiSource[idx++] = element;
- adapter = getViewAdapter(element);
- if (getRemoteAdapter(element) != null) continue;
- ok = adapter.doDelete(getShell(), element, monitor);
- if (ok) {
- anyOk = true;
- deletedVector.add(element);
- }
- }
- // now we have things divided into sets
- // delete 1 set at a time
- for (int s = 0; s < _setList.size() && ok; s++) {
- set = (SystemRemoteElementResourceSet) _setList.get(s);
- ISubSystem srcSubSystem = set.getSubSystem();
- ISystemViewElementAdapter srcAdapter = set.getViewAdapter();
-
- if (srcSubSystem != null) {
-
- // this call can throw an exception
- ok = srcAdapter.doDeleteBatch(getShell(), set.getResourceSet(), monitor);
-
- if (ok) {
- anyOk = true;
- deletedVector.addAll(set.getResourceSet());
- }
- }
- }
- } catch (SystemMessageException exc) {
- SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
- ok = false;
- } catch (Exception exc) {
- String msg = exc.getMessage();
- if ((msg == null) || (exc instanceof ClassCastException)) msg = exc.getClass().getName();
- SystemMessageDialog.displayErrorMessage(getShell(), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element, msg));
-
- // refresh all parents if selection is remote objects
- if (selectionIsRemoteObject) {
-
- // we only need to iterate over the last set in the list of sets since presumably the sets before did not cause any exceptions
- // if elements in the list before were deleted successfully, then the code after this catch block will handle them (by firing delete events)
- // for the current set that caused the exception, we refresh the parents of the elements in the set (since we don't know which
- // elements in the set may have been deleted successfully before the exception occurred).
- if (set != null) {
- List list = set.getResourceSet();
-
- if (list != null && list.size() > 0) {
-
- Iterator iter = list.iterator();
-
- List refreshedList = new Vector();
-
- while (iter.hasNext()) {
- Object obj = iter.next();
- ISystemViewElementAdapter adp = getViewAdapter(obj);
- Object parent = adp.getParent(obj);
-
- if ((parent != null) && !(refreshedList.contains(parent))) {
- SystemResourceChangeEvent event = new SystemResourceChangeEvent(parent, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null);
- sr.fireEvent(event);
- refreshedList.add(parent);
- }
- }
- }
- }
- }
-
- ok = false;
- }
- //System.out.println("in doDelete. Any ok? " + anyOk + ", selectionIsRemoteObject? " + selectionIsRemoteObject);
- if (anyOk) {
- if (selectionIsRemoteObject)
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this);
- else {
- Object[] deleted = new Object[deletedVector.size()];
- for (int idx = 0; idx < deleted.length; idx++)
- deleted[idx] = deletedVector.get(idx);
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvents.EVENT_DELETE_MANY, getSelectedParent()));
- }
- }
- return ok;
- }
-
- // ---------------------------
- // ISYSTEMRENAMETARGET METHODS
- // ---------------------------
-
- private class RenameJob extends WorkspaceJob
- {
- String[] newNames = null;
- Object[] elements = null;
- Object[] elementAdapters = null;
- Object parentElement = null;
- String renameMessage = null;
-
- /**
- * RenameJob job.
- * @param newNames array of new names of all the elements need to be renamed
- * @param elements array of all the elements need to be renamed
- * @param elementAdapters array of all the view adapters of the elements need to be renamed
- * @param parentElement the parent object of the list of objects to be renamed
- * @param renameMessage the title of the Rename job.
- */
- public RenameJob(String[] newNames, Object[] elements, Object[] elementAdapters, Object parentElement, String renameMessage)
- {
- super(renameMessage);
- this.newNames = newNames;
- this.elements = elements;
- this.elementAdapters = elementAdapters;
- this.parentElement = parentElement;
- setUser(true);
- }
-
- public IStatus runInWorkspace(IProgressMonitor monitor)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- Object element = null;
- ISystemViewElementAdapter adapter = null;
- ISystemRemoteElementAdapter remoteAdapter = null;
- String oldFullName = ""; //$NON-NLS-1$
- String oldName = ""; //$NON-NLS-1$
- Vector fileNamesRenamed = new Vector();
-
- boolean ok = true;
- try {
- int steps = elements.length;
- monitor.beginTask(renameMessage, steps);
- for (int i=0; i < elements.length; i++)
- {
- element = elements[i];
- adapter = (ISystemViewElementAdapter)elementAdapters[i];
- remoteAdapter = getRemoteAdapter(element);
- if (remoteAdapter != null)
- {
- oldName = remoteAdapter.getName(element);
- oldFullName = remoteAdapter.getAbsoluteName(element); // pre-rename
- monitor.subTask(getRenamingMessage(oldName).getLevelOneText());
- }
- ok = adapter.doRename(null, element, newNames[i], monitor);
- if (ok)
- {
- fileNamesRenamed.add(oldName);
- if (remoteAdapter != null)
- {
- ISubSystem ss = adapter.getSubSystem(element);
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, ss, new String[] {oldFullName}, this);
- }
-
- else
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(element, ISystemResourceChangeEvents.EVENT_RENAME, parentElement));
- }
- monitor.worked(1);
- }
- }
- catch (SystemMessageException exc)
- {
- ok = false;
- //If this operation is cancelled, need to display a proper message to the user.
- if (monitor.isCanceled() && fileNamesRenamed.size() > 0)
- {
- //Get the renamed file names
- String renamedFileNames = (String)(fileNamesRenamed.get(0));
- for (int i=1; i<(fileNamesRenamed.size()); i++)
- {
- renamedFileNames = renamedFileNames + "\n" + fileNamesRenamed.get(i); //$NON-NLS-1$
- }
- //getMessage("RSEG1125").makeSubstitution(movedFileName));
- SystemMessage thisMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_RENAME_INTERRUPTED);
- thisMessage.makeSubstitution(renamedFileNames);
- SystemMessageDialog.displayErrorMessage(shell, thisMessage);
- }
- else
- {
- SystemMessageDialog.displayErrorMessage(shell, exc.getSystemMessage());
- }
- } catch (Exception exc) {
- //String msg = exc.getMessage();
- //if ((msg == null) || (exc instanceof ClassCastException))
- // msg = exc.getClass().getName();
- exc.printStackTrace();
- SystemMessageDialog.displayErrorMessage(null, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_RENAMING).makeSubstitution(element, exc), //msg),
- exc);
- ok = false;
- }
-
- return Status.OK_STATUS;
- }
- }
- /**
- * Required method from ISystemRenameTarget.
- * Decides whether to even show the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showRename() {
- return selectionShowRenameAction;
- }
-
- /**
- * Required method from ISystemRenameTarget
- * Decides whether to enable the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canRename() {
- if (!selectionFlagsUpdated) scanSelections("canRename"); //$NON-NLS-1$
- return selectionEnableRenameAction;
- }
-
- /**
- * Get the specific "Renaming %1..."
- */
- protected SystemMessage getRenamingMessage(String oldName)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_RENAMEGENERIC_PROGRESS);
- msg.makeSubstitution(oldName);
- return msg;
- }
-
- /**
- * Required method from ISystemRenameTarget
- */
- public boolean doRename(String[] newNames) {
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- Object parentElement = getSelectedParent();
-
- Object[] renameElements = new Object[newNames.length];
- Object[] elementAdapters = new Object[newNames.length];
- int i = 0;
- while (elements.hasNext()) {
- renameElements[i] = elements.next();
- elementAdapters[i] = getViewAdapter(renameElements[i]);
- i++;
- //remoteAdapter = getRemoteAdapter(element);
- }
- SystemMessage renameMessage = getRenamingMessage(""); //$NON-NLS-1$
- String renameMessageText = renameMessage.getLevelOneText();
- RenameJob renameJob = new RenameJob(newNames, renameElements, elementAdapters, parentElement, renameMessageText);
- renameJob.schedule();
- return true;
- }
-
- protected void logDebugMsg(String msg) {
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),msg);
- msg = this.getClass().getName() + ": " + msg; //$NON-NLS-1$
- SystemBasePlugin.logInfo(msg);
- System.out.println(msg);
- }
-
- // -----------------------------------------------------------------
- // ISystemSelectAllTarget methods to facilitate the global action...
- // -----------------------------------------------------------------
- /**
- * Return true if select all should be enabled for the given object.
- * For a tree view, you should return true if and only if the selected object has children.
- * You can use the passed in selection or ignore it and query your own selection.
- */
- public boolean enableSelectAll(IStructuredSelection selection) {
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- if ((items == null) || (items.length != 1)) // only allow for single selections
- return false;
-
- TreeItem ti = items[0];
- int count = getItemCount(ti);
- if (count == 1) // is it a dummy?
- {
- if ((getItems(ti)[0]).getData() == null) count = 0; // assume a dummy
- }
- return (count > 0);
- }
-
- /**
- * When this action is run via Edit->Select All or via Ctrl+A, perform the
- * select all action. For a tree view, this should select all the children
- * of the given selected object. You can use the passed in selected object
- * or ignore it and query the selected object yourself.
- */
- public void doSelectAll(IStructuredSelection selection) {
- Tree tree = getTree();
- TreeItem[] currSel = tree.getSelection();
- TreeItem[] childItems = currSel[0].getItems();
- if (childItems.length == 0) return;
- tree.setSelection(childItems);
- Object[] childObjects = new Object[childItems.length];
- for (int idx = 0; idx < childObjects.length; idx++)
- childObjects[idx] = childItems[idx].getData();
- fireSelectionChanged(new SelectionChangedEvent(this, new StructuredSelection(childObjects)));
- }
-
- // --------------------------------------------
- // ISystemTree methods to facilitate our GUI...
- // --------------------------------------------
- /**
- * This is called to ensure all elements in a multiple-selection have the same parent in the
- * tree viewer. If they don't we automatically disable all actions.
- * <p>
- * Designed to be as fast as possible by going directly to the SWT widgets
- */
- public boolean sameParent() {
- boolean same = true;
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- if ((items == null) || (items.length == 0)) return true;
- TreeItem prevParent = null;
- TreeItem currParent = null;
- for (int idx = 0; same && (idx < items.length); idx++) {
- currParent = items[idx].getParentItem();
- if ((idx > 0) && (currParent != prevParent))
- same = false;
- else {
- prevParent = currParent;
- }
- }
- return same;
- }
-
- protected boolean selectionHasAncestryRelationship() {
- if (selectionFlagsUpdated) return selectionHasAncestorRelation;
-
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- return hasSelectedAncestor(items);
- /*
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
-
- for (int idx = 0; idx < items.length; idx++) {
- TreeItem item = items[idx];
- // for (int c = 0; c < items.length; c++) {
- // if (item != items[c]) {
- if (isAncestorOf(item, items)) {
- return true;
- }
-// }
- // }
- }
- return false;
- */
- }
-
- protected boolean isAncestorOf(TreeItem container, TreeItem[] items) {
- TreeItem[] children = container.getItems();
- for (int i = 0; i < children.length; i++) {
- TreeItem child = children[i];
- for (int j = 0; j < items.length; j++)
- {
- TreeItem item = items[j];
- if (child == item) {
- return true;
- }
- else if (child.getItemCount() > 0)
- {
- if (isAncestorOf(child, items))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
-
-
- protected boolean hasSelectedAncestor(TreeItem[] items) {
-
- List cleanParents = new ArrayList();
-
- for (int j = 0; j < items.length; j++)
- {
- TreeItem item = items[j];
- TreeItem parent = item.getParentItem();
- while (parent != null && !cleanParents.contains(parent))
- {
- if (isTreeItemSelected(parent))
- {
- return true;
- }
- else
- {
- cleanParents.add(parent);
- parent = parent.getParentItem();
- }
- }
- }
- return false;
- }
-
-
-
-
-
-
-/*
- protected boolean isAncestorOf(TreeItem container, TreeItem item) {
- TreeItem[] children = container.getItems();
- for (int i = 0; i < children.length; i++) {
- TreeItem child = children[i];
- if (child == item) {
- return true;
- } else if (child.getItemCount() > 0) {
- if (isAncestorOf(child, item)) {
- return true;
- }
- }
- }
- return false;
- }
-*/
-
- /**
- * This is called to accurately get the parent object for the current selection
- * for this viewer.
- * <p>
- * The getParent() method in the adapter is very unreliable... adapters can't be sure
- * of the context which can change via filtering and view options.
- */
- public Object getSelectedParent() {
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- if ((items == null) || (items.length == 0)) {
- return tree.getData();
- } else {
- TreeItem parentItem = items[0].getParentItem();
- if (parentItem != null)
- return parentItem.getData();
- else
- return tree.getData();
- }
- }
-
- /**
- * Return the TreeItem of the parent of the selected node. Or null if a root is selected.
- */
- public TreeItem getSelectedParentItem() {
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- if ((items == null) || (items.length == 0)) {
- return null;
- } else {
- return items[0].getParentItem();
- }
- }
-
- /**
- * This returns the element immediately before the first selected element in this tree level.
- * Often needed for enablement decisions for move up actions.
- */
- public Object getPreviousElement() {
- Object prevElement = null;
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- if ((items != null) && (items.length > 0)) {
- TreeItem item1 = items[0];
- TreeItem[] parentItems = null;
- TreeItem parentItem = item1.getParentItem();
- if (parentItem != null)
- parentItems = parentItem.getItems();
- else
- parentItems = item1.getParent().getItems();
- if (parentItems != null) {
- TreeItem prevItem = null;
- for (int idx = 0; (prevItem == null) && (idx < parentItems.length); idx++)
- if ((parentItems[idx] == item1) && (idx > 0)) prevItem = parentItems[idx - 1];
- if (prevItem != null) prevElement = prevItem.getData();
- }
- }
- return prevElement;
- }
-
- /**
- * This returns the element immediately after the last selected element in this tree level
- * Often needed for enablement decisions for move down actions.
- */
- public Object getNextElement() {
- Object nextElement = null;
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- if ((items != null) && (items.length > 0)) {
- TreeItem itemN = items[items.length - 1];
- TreeItem[] parentItems = null;
- TreeItem parentItem = itemN.getParentItem();
- if (parentItem != null)
- parentItems = parentItem.getItems();
- else
- parentItems = itemN.getParent().getItems();
- if (parentItems != null) {
- TreeItem nextItem = null;
- for (int idx = 0; (nextItem == null) && (idx < parentItems.length); idx++)
- if ((parentItems[idx] == itemN) && (idx < (parentItems.length - 1))) nextItem = parentItems[idx + 1];
- if (nextItem != null) nextElement = nextItem.getData();
- }
- }
- return nextElement;
- }
-
- /**
- * This is called to walk the tree back up to the roots and return the visible root
- * node for the first selected object.
- */
- public Object getRootParent() {
- Tree tree = getTree();
- TreeItem[] selectedItems = tree.getSelection();
- Object rootElement = null;
- if ((selectedItems != null) && (selectedItems.length > 0)) {
- TreeItem item = selectedItems[0];
- TreeItem parentItem = item.getParentItem();
- if (parentItem == null) // item is a root element
- rootElement = item.getData();
- else
- while (rootElement == null) {
- item = parentItem;
- parentItem = item.getParentItem();
- if (parentItem == null) // item is a root element
- rootElement = item.getData();
- }
- }
- //logDebugMsg("getRootParent returned: "+rootElement);
- return rootElement;
- }
-
- /**
- * This returns an array containing each element in the tree, up to but not including the root.
- * The array is in reverse order, starting at the leaf and going up.
- */
- public Object[] getElementNodes(Object element) {
- Widget w = findItem(element);
- if ((w != null) && (w instanceof TreeItem)) return getElementNodes((TreeItem) w);
- return null;
- }
-
- /**
- * This returns an array containing each element in the tree, up to but not including the root.
- * The array is in reverse order, starting at the leaf and going up.
- * This flavor is optimized for the case when you have the tree item directly.
- * @return Array of Objects leading to the given TreeItem,
- * sorted from the leaf item up.
- */
- public Object[] getElementNodes(TreeItem item) {
- List v = new Vector();
- v.add(item.getData());
- while (item != null) {
- item = item.getParentItem();
- if (item != null) v.add(item.getData());
- }
- Object[] nodes = new Object[v.size()];
- for (int idx = 0; idx < nodes.length; idx++)
- nodes[idx] = v.get(idx);
- return nodes;
- }
-
- /**
- * This returns an array containing each element in the tree, up to but not including the root.
- * The array is in reverse order, starting at the leaf and going up.
- * This flavor returns an array of TreeItem objects versus element objects.
- * @return Array of TreeItem objects leading to the given TreeItem,
- * sorted from the leaf item up.
- */
- public TreeItem[] getItemNodes(TreeItem item) {
- List v = new Vector();
- v.add(item);
- while (item != null) {
- item = item.getParentItem();
- if (item != null) v.add(item);
- }
- TreeItem[] nodes = new TreeItem[v.size()];
- for (int idx = 0; idx < nodes.length; idx++)
- nodes[idx] = (TreeItem) v.get(idx);
- return nodes;
- }
-
- /**
- * Helper method to determine if a given object is currently selected.
- * Does consider if a child node of the given object is currently selected.
- */
- public boolean isSelectedOrChildSelected(Object parentElement) {
- boolean isSelected = false;
- Item[] selectedItems = ((Tree) getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length > 0)) {
- Widget w = findItem(parentElement);
- if (!(w instanceof TreeItem)) return true; // assume we have been given the root, which means any selection is a child
- TreeItem item = (TreeItem) w;
- // for every selected tree item, scan upwards to the root to see if
- // it or any of its parents are the given element.
- for (int idx = 0; !isSelected && (idx < selectedItems.length); idx++) {
- if (selectedItems[idx] instanceof TreeItem) {
- if (selectedItems[idx] == item)
- isSelected = true;
- else
- isSelected = searchToRoot((TreeItem) selectedItems[idx], item);
- }
- }
- }
- return isSelected;
- //return isSelected(element, (IStructuredSelection)getSelection());
- }
-
- /**
- * Override that takes a widget.
- */
- public boolean isTreeItemSelectedOrChildSelected(Widget w) {
- boolean isSelected = false;
- Item[] selectedItems = ((Tree) getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length > 0)) {
- if (!(w instanceof TreeItem)) return true; // assume we have been given the root, which means any selection is a child
- TreeItem item = (TreeItem) w;
- // for every selected tree item, scan upwards to the root to see if
- // it or any of its parents are the given element.
- for (int idx = 0; !isSelected && (idx < selectedItems.length); idx++) {
- if (selectedItems[idx] instanceof TreeItem) {
- if (selectedItems[idx] == item)
- isSelected = true;
- else
- isSelected = searchToRoot((TreeItem) selectedItems[idx], item);
- }
- }
- }
- return isSelected;
- //return isSelected(element, (IStructuredSelection)getSelection());
- }
-
- /**
- * Return the number of immediate children in the tree, for the given tree node
- */
- public int getChildCount(Object element) {
- if (getTree().isDisposed()) return 0;
- Widget w = findItem(element);
- if (w == null)
- return 0;
-
- // modified patch initially provided by Tobias Schwarz
- if (w instanceof TreeItem) {
- TreeItem ti = (TreeItem) w;
- int count = getItemCount((Item) w);
- int ignoreItems = 0;
- if (count > 0) {
- Item[] items = getItems(ti);
- for (int i=0; i<count; i++) {
- Object itemData = items[i].getData();
- if (itemData==null
- || itemData instanceof SystemMessageObject
- || itemData instanceof PendingUpdateAdapter
- ) {
- ignoreItems++;
- } else {
- break;
- }
- }
- }
- return count - ignoreItems;
- }
- return getItemCount((Control) w);
- }
-
- /**
- * Return the tree item of the first selected object
- */
- protected TreeItem getFirstSelectedTreeItem() {
- // find the selected tree item...
- Item[] selectedItems = ((Tree) getControl()).getSelection();
- if ((selectedItems == null) || (selectedItems.length == 0) || !(selectedItems[0] instanceof TreeItem)) return null;
- return (TreeItem) selectedItems[0];
- }
-
- /**
- * Refresh the given tree item node
- */
- protected void refreshTreeItem(TreeItem item) {
- // if we are already expanded, collapse and refresh to clear memory
- if (getExpanded(item)) {
- collapseNode(item.getData(), true);
- //setExpanded(selectedItem, false);
- //refreshItem(selectedItem, selectedItem.getData());
- }
- // ok, now time to force an expand...
- createChildren(item); // re-expand. this calls the content provider, which calls the getChildren() method in the adapter. That will call us back.
- item.setExpanded(true);
- }
-
- /**
- * Called when a property is updated and we need to inform the Property Sheet viewer.
- * There is no formal mechanism for this so we simulate a selection changed event as
- * this is the only event the property sheet listens for.
- */
- public void updatePropertySheet() {
- ISelection selection = getSelection();
- if (selection == null) return;
-
- // only fire this event if the view actually has focus
- if (getControl().isFocusControl())
- {
- // create an event
- SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
- // fire the event
- fireSelectionChanged(event);
- }
- }
-
- /**
- * Called to select an object within the tree, and optionally expand it
- */
- public void select(Object element, boolean expand) {
- setSelection(new StructuredSelection(element), true); // true => reveal
- if (expand) setExpandedState(element, true);
- }
-
- /**
- * Returns the tree item of the first selected object. Used for setViewerItem in a resource
- * change event.
- */
- public Item getViewerItem() {
- TreeItem[] selectedItems = getTree().getSelection();
- if ((selectedItems != null) && (selectedItems.length > 0))
- return selectedItems[0];
- else
- return null;
- }
-
- /**
- * Returns true if any of the selected items are currently expanded
- */
- public boolean areAnySelectedItemsExpanded() {
- boolean expanded = false;
- Item[] selectedItems = ((Tree) getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length > 0)) {
- // for every selected tree item, see if it is currently expanded...
- for (int idx = 0; !expanded && (idx < selectedItems.length); idx++) {
- if (selectedItems[idx] instanceof TreeItem) {
- if (((TreeItem) selectedItems[idx]).getExpanded()) expanded = true;
- }
- }
- }
- return expanded;
- }
-
- /**
- * Returns true if any of the selected items are expandable but not yet expanded
- */
- public boolean areAnySelectedItemsExpandable() {
- boolean expandable = false;
- Item[] selectedItems = ((Tree) getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length > 0)) {
- // for every selected tree item, see if needs expanding...
- for (int idx = 0; !expandable && (idx < selectedItems.length); idx++) {
- if (selectedItems[idx] instanceof TreeItem) {
- if ((((TreeItem) selectedItems[idx]).getItemCount() > 0) && !((TreeItem) selectedItems[idx]).getExpanded()) expandable = true;
- }
- }
- }
- return expandable;
- }
-
-
- /**
- * Initialize drag and drop support for this view.
- *
- */
- protected void initDragAndDrop()
- {
- int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] dragtransfers = new Transfer[]
- { PluginTransfer.getInstance(),
- EditorInputTransfer.getInstance()
- };
-
- Transfer[] droptransfers = new Transfer[]
- { PluginTransfer.getInstance(),
- FileTransfer.getInstance(),
- EditorInputTransfer.getInstance(),
- ResourceTransfer.getInstance()
- };
-
- addDragSupport(ops | DND.DROP_DEFAULT, dragtransfers, new SystemViewDataDragAdapter(this));
- addDropSupport(ops | DND.DROP_DEFAULT, droptransfers, new SystemViewDataDropAdapter(this));
- }
- // ----------------------------------
- // Support for EXPAND TO-> ACTIONS...
- // ----------------------------------
-
- public void expandTo(Object parentObject, Object remoteObject)
- {
- SystemViewLabelAndContentProvider provider = (SystemViewLabelAndContentProvider)getContentProvider();
- provider.setEnableDeferredQueries(false);
-
- ISystemViewElementAdapter adapter = getViewAdapter(parentObject);
- ISystemViewElementAdapter targetAdapter = getViewAdapter(remoteObject);
- Assert.isNotNull(adapter, "adapter is null for " + parentObject); //$NON-NLS-1$
- ISubSystem ss = adapter.getSubSystem(parentObject);
- String parentName = adapter.getAbsoluteName(parentObject);
- String remoteObjectName = targetAdapter.getAbsoluteName(remoteObject);
- Item parentItem = findFirstRemoteItemReference(parentName, ss, null);
- if (parentItem != null)
- {
- createChildren(parentItem);
- Item[] children = getItems(parentItem);
- setExpanded(parentItem, true);
- for (int i = 0; i < children.length; i++)
- {
-
- Item child = children[i];
- Object data = child.getData();
- if (data.equals(remoteObject))
- {
- select(remoteObject, false);
- provider.setEnableDeferredQueries(true);
- return;
- }
- else if (data instanceof ISystemFilterReference)
- {
- ISystemFilterReference ref = (ISystemFilterReference)data;
- if (ss.doesFilterMatch(ref.getReferencedFilter(), remoteObjectName)){
- expandTo(data, remoteObject);
- }
- else if (ss.doesFilterListContentsOf(ref.getReferencedFilter(),remoteObjectName)){
- expandTo(data, remoteObject);
- }
- }
- else if (data instanceof ISystemFilterPoolReference)
- {
- expandTo(data, remoteObject);
- }
- else
- {
- ISystemViewElementAdapter dataAdapter = (ISystemViewElementAdapter)((IAdaptable)data).getAdapter(ISystemViewElementAdapter.class);
- String path = dataAdapter.getAbsoluteName(data);
- if (remoteObjectName.startsWith(path))
- {
- expandTo(data, remoteObject);
- }
- }
- }
- }
- provider.setEnableDeferredQueries(true);
- }
-
-
- /**
- * Called when user selects an Expand To action to expand the selected remote object with a quick filter
- */
- public void expandTo(String filterString) {
- SystemViewPart svp = getSystemViewPart();
- if (svp == null) return;
- // find the selected tree item...
- TreeItem selectedItem = getFirstSelectedTreeItem();
- if (selectedItem == null) return;
- Object element = selectedItem.getData();
- ISystemViewElementAdapter remoteAdapter = getViewAdapter(element);
- if (remoteAdapter == null) return;
- // update our hashtables, keyed by object address and tree path...
- if (expandToFiltersByObject == null) expandToFiltersByObject = new Hashtable();
- if (expandToFiltersByTreePath == null) expandToFiltersByTreePath = new Hashtable();
- if (filterString != null)
- expandToFiltersByObject.put(selectedItem.getData(), filterString);
- else
- expandToFiltersByObject.remove(selectedItem.getData());
- if (filterString != null)
- expandToFiltersByTreePath.put(getItemPath(selectedItem), filterString);
- else
- expandToFiltersByTreePath.remove(getItemPath(selectedItem));
-
- // now refresh this tree item node...
- refreshTreeItem(selectedItem);
- }
-
- /**
- * Return the fully-qualified path up to the given item, expressible as a string
- */
- protected String getItemPath(TreeItem item) {
- StringBuffer idBuffer = new StringBuffer(getItemNodeID(item));
- TreeItem[] elementNodes = getItemNodes(item);
- if (elementNodes != null) {
- for (int idx = elementNodes.length - 1; idx >= 0; idx--) {
- item = elementNodes[idx];
- idBuffer.append(SystemViewPart.MEMENTO_DELIM + getItemNodeID(item));
- }
- }
- //System.out.println("MEMENTO HANDLE: " + idBuffer.toString());
- return idBuffer.toString();
- }
-
- /**
- * Return the string identifying this node in the tree
- */
- protected String getItemNodeID(TreeItem item) {
- //ISystemViewElementAdapter adapter = getAdapter(item.getData());
- //return adapter.getMementoHandle(item.getData());
- return item.getText();
- }
-
- /**
- * Callback from the input provider to test if the given node has expand-to filtering criteria
- */
- public String getExpandToFilter(Object element) {
- String filter = null;
- // for performance reasons, we first test for a binary match...
- if (expandToFiltersByObject != null) {
- filter = (String) expandToFiltersByObject.get(element);
- }
- // if binary match fails, look for tree path match...
- if ((filter == null) && (expandToFiltersByTreePath != null)) {
- Widget item = findItem(element);
- if ((item != null) && (item instanceof TreeItem)) {
- filter = (String) expandToFiltersByTreePath.get(getItemPath((TreeItem) item));
- if (filter != null) {
- if (expandToFiltersByObject == null) expandToFiltersByObject = new Hashtable();
- expandToFiltersByObject.put(element, filter); // so next time it will be faster
- }
- }
- }
- return filter;
- }
-
- /**
- * To support restoring state we need to write out to disk out current table that maps
- * tree items to their current expand-to filter. That means we need access to the table.
- */
- public Hashtable getExpandToFilterTable() {
- return expandToFiltersByTreePath;
- }
-
- /**
- * To support restoring state we need to write out to disk out current table that maps
- * tree items to their current expand-to filter. That means we need to be able to set the table.
- */
- public void setExpandToFilterTable(Hashtable ht) {
- expandToFiltersByTreePath = ht;
- }
-
- protected SystemRemoteElementResourceSet getSetFor(ISubSystem subSystem, ISystemViewElementAdapter adapter) {
- for (int i = 0; i < _setList.size(); i++) {
- SystemRemoteElementResourceSet set = (SystemRemoteElementResourceSet) _setList.get(i);
- if (set.getViewAdapter() == adapter && set.getSubSystem() == subSystem) {
- return set;
- }
- }
-
- // no existing set - create one
- SystemRemoteElementResourceSet newSet = new SystemRemoteElementResourceSet(subSystem, adapter);
- _setList.add(newSet);
- return newSet;
- }
-/*
- protected boolean usingElementMap() {
- return false;
- }
-*/
-
- /**
- * For bug 204684:
- *
- * Because we don't have an API for ISystemViewElementAdapter.exists()...
- * This class is used to determine whether an object exists and consequently whether to remove it from the view
- * after a query comes back with either no children or a SystemMessageObject. We query the parent to determine
- * whether the remote object exists - in that case we just leave the message as is in the view. In the case where
- * we detect that the object does not exist, we re-populate the parent node with the new children.
- */
- public static class CheckExistenceJob extends Job
- {
-
-
- private IAdaptable _remoteObject;
- //private TreeItem _parentItem;
- private IContextObject _context;
- public CheckExistenceJob(IAdaptable remoteObject, TreeItem parentItem, IContextObject context)
- {
- super("Check existence"); //$NON-NLS-1$
- _remoteObject = remoteObject;
- //_parentItem = parentItem;
- _context = context;
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- // need to use the model object to get the adapter (since it could be a filter)
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)_context.getModelObject().getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null)
- {
- final Object[] children = adapter.getChildren(_context, monitor);
- if (contains(children, _remoteObject))
- {
- // we want to end this so the user sees the error message
- }
- else
- {
- Display.getDefault().asyncExec(new Runnable(){
- public void run()
- {
- /*
- // first need to remove the old items
- TreeItem[] items = _parentItem.getItems();
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null) {
- disassociate(items[i]);
- items[i].dispose();
- } else {
- items[i].dispose();
- }
- }
-
-
- // we want to propagate the changes to the view
- add(_context.getModelObject(), children);
- */
- // refresh using the event since other views may need updating
- IAdaptable par = _context.getModelObject();
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.fireEvent(new SystemResourceChangeEvent(par, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null));
-
- }
- });
- }
- }
-
- return Status.OK_STATUS;
- }
-
- public static boolean contains(Object[] children, IAdaptable remoteObject)
- {
- ISystemViewElementAdapter adapter1 = (ISystemViewElementAdapter)remoteObject.getAdapter(ISystemViewElementAdapter.class);
- String path1 = adapter1==null ? null : adapter1.getAbsoluteName(remoteObject);
- for (int i = 0; i < children.length; i++)
- {
- if (remoteObject==children[i] || remoteObject.equals(children[i]))
- {
- return true;
- }
- else if (children[i] instanceof IAdaptable)
- {
- IAdaptable remoteObject2 = (IAdaptable)children[i];
- ISystemViewElementAdapter adapter2 = (ISystemViewElementAdapter)remoteObject2.getAdapter(ISystemViewElementAdapter.class);
- if (adapter2 != null)
- {
- String path2 = adapter2.getAbsoluteName(remoteObject2);
- if (path1 != null && path2 != null && path1.equals(path2))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- }
-
-
- public void add(Object parentElementOrTreePath, Object[] childElements) {
-
- assertElementsNotNull(childElements);
- IContextObject contextObject = null;
- ISystemFilterReference originalFilter = null;
- if (parentElementOrTreePath instanceof IContextObject)
- {
- contextObject = (IContextObject)parentElementOrTreePath;
- originalFilter = contextObject.getFilterReference();
- parentElementOrTreePath = contextObject.getModelObject();
-
- }
-
- List matches = new Vector();
- findAllRemoteItemReferences(parentElementOrTreePath, parentElementOrTreePath, matches);
-
- // get rid of references to items for different connection
- if (parentElementOrTreePath instanceof IAdaptable)
- {
- List invalidMatches = new ArrayList();
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)parentElementOrTreePath).getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null)
- {
- IHost parentHost = adapter.getSubSystem(parentElementOrTreePath).getHost();
- for (int i = 0; i < matches.size(); i++)
- {
- Widget match = (Widget) matches.get(i);
- Object data = null;
- try {
- data = match.getData();
- }
- catch (SWTException e){
- // not sure why this occurs -logging it for now
- // this is reported in bug 251625
- SystemBasePlugin.logError("Exception in SystemView.add() with " + match); //$NON-NLS-1$
- SystemBasePlugin.logError(e.getMessage());
- }
-
- if (data instanceof IAdaptable)
- {
- ISystemViewElementAdapter madapter = (ISystemViewElementAdapter)((IAdaptable)data).getAdapter(ISystemViewElementAdapter.class);
- if (madapter != null)
- {
- IHost mHost = madapter.getSubSystem(data).getHost();
- if (mHost != parentHost)
- {
- invalidMatches.add(match);
- }
- }
- }
- }
- }
-
- if (invalidMatches.size() > 0)
- {
- for (int m = invalidMatches.size() - 1; m >= 0 ; m--)
- {
- Object match = invalidMatches.get(m);
- matches.remove(match);
- }
- }
- }
-
- //Widget[] widgets = internalFindItems(parentElementOrTreePath);
- // If parent hasn't been realized yet, just ignore the add.
- if (matches.size() == 0) {
- super.add(parentElementOrTreePath, childElements);
- }
- else
- {
- for (int i = 0; i < matches.size(); i++) {
- Widget match = (Widget) matches.get(i);
- ISystemFilterReference ref = null;
- if (match instanceof TreeItem)
- {
- ref = getContainingFilterReference((TreeItem)match);
- }
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)parentElementOrTreePath).getAdapter(ISystemViewElementAdapter.class);
-
- if (matches.size() > 1 && ref != null && ref != originalFilter)
- {
- // could have the same object under multiple filters
- // need to apply filter
-
- Object[] newChildren = null;
- if (match instanceof TreeItem)
- {
- ContextObjectWithViewer context = getContextObject((TreeItem)match);
- newChildren = adapter.getChildren(context, new NullProgressMonitor());
- internalAdd(match, parentElementOrTreePath, newChildren);
- }
- }
- else
- {
- internalAdd(match, parentElementOrTreePath, childElements);
-
- // refresh parent in this case because the parentElementOrTreePath may no longer exist
- if (childElements.length == 0 || childElements[0] instanceof SystemMessageObject)
- {
- if (adapter.isRemote(parentElementOrTreePath) && !adapter.hasChildren((IAdaptable)parentElementOrTreePath))
- {
- /*
- // refresh the parent
- Object par = adapter.getParent(parentElementOrTreePath);
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.fireEvent(new SystemResourceChangeEvent(par, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null));
-
- */
-
- // for bug 204684, using this job to determine whether or not the object exists before trying to update
- if (match instanceof TreeItem)
- {
- TreeItem parentItem = ((TreeItem)match).getParentItem();
- if (parentItem != null)
- {
- ContextObjectWithViewer context = getContextObject(parentItem);
- if (adapter.supportsDeferredQueries(context.getSubSystem())) {
- CheckExistenceJob job = new CheckExistenceJob((IAdaptable)parentElementOrTreePath, parentItem, context);
- job.schedule();
- } else {
- Object[] children = adapter.getChildren(context, new NullProgressMonitor());
- if (!CheckExistenceJob.contains(children, (IAdaptable)parentElementOrTreePath)) {
- IAdaptable par = context.getModelObject();
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.fireEvent(new SystemResourceChangeEvent(par, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null));
- }
- }
- }
- }
- }
- }
-
- }
- }
- }
-
- TreeItem item = getFirstSelectedTreeItem();
- if (item != null)
- {
- if (item.getData() == parentElementOrTreePath)
- {
- updatePropertySheet();
- }
- }
-
- // for bug 187739
- if (contextObject instanceof ContextObjectWithViewer) {
- ContextObjectWithViewer ctx = (ContextObjectWithViewer)contextObject;
- IRSECallback cb = ctx.getCallback();
- if (cb!=null) {
- cb.done(Status.OK_STATUS, childElements);
- }
- }
- }
-
-
- /**
- * Get the containing filter reference for an item
- * @param item the item to get the filter reference for
- * @return the filter reference
- */
- public ISystemFilterReference getContainingFilterReference(TreeItem item)
- {
- Object data = item.getData();
- if (data instanceof ISystemFilterReference)
- {
- return (ISystemFilterReference)data;
- }
- else
- {
- TreeItem parent = item.getParentItem();
- if (parent != null)
- {
- return getContainingFilterReference(parent);
- }
- else
- {
- Object input = getInput();
- if (input instanceof ISystemFilterReference)
- {
- return (ISystemFilterReference)input;
- }
- else
- {
- return null;
- }
- }
- }
- }
-
- /**
- * Get the containing subsystem from an item
- * @param item the item to get the subsystem for
- * @return the subsystem
- */
- public ISubSystem getContainingSubSystem(TreeItem item)
- {
- Object data = item.getData();
- if (data instanceof ISubSystem)
- {
- return (ISubSystem)data;
- }
- else
- {
- TreeItem parent = item.getParentItem();
- if (parent != null)
- {
- return getContainingSubSystem(parent);
- }
- else
- {
- Object input = getInput();
- if (input instanceof ISubSystem)
- {
- return (ISubSystem)input;
- }
- else
- {
- return null;
- }
- }
- }
- }
-
-
- /**
- * Get the context object from a tree item
- * @param item the item to get the context for
- * @return the context object
- */
- public ContextObjectWithViewer getContextObject(TreeItem item)
- {
- Object data = item.getData();
- ISystemFilterReference filterReference = getContainingFilterReference(item);
- if (filterReference != null)
- {
- return new ContextObjectWithViewer(data, filterReference.getSubSystem(), filterReference, this);
- }
- else
- {
- ISubSystem subSystem = getContainingSubSystem(item);
- if (subSystem != null)
- {
- return new ContextObjectWithViewer(data, subSystem, this);
- }
- else
- {
- return new ContextObjectWithViewer(data, this);
- }
- }
- }
-
-
- /**
- * Create tree items for the specified children
- *
- * @param widget the parent item for the items to create
- * @param children the children to create items for
- */
- public void createTreeItems(TreeItem widget, Object[] children)
- {
- TreeItem[] tis = widget.getItems();
-
- // first dispose of dummies
- for (int i = 0; i < tis.length; i++) {
- if (tis[i].getData() != null) {
- disassociate(tis[i]);
- Assert.isTrue(tis[i].getData() == null,
- "Second or later child is non -null");//$NON-NLS-1$
- }
- tis[i].dispose();
- }
-
- // now create children
- for (int i = 0; i < children.length; i++)
- {
- createTreeItem(widget, children[i], -1);
- }
- }
-
- /**
- * For bug 187739
- */
- protected void createChildren(final Widget widget, IRSECallback callback)
- {
- if (widget instanceof TreeItem)
- {
- final Item[] tis = getChildren(widget);
- if (tis != null && tis.length > 0) {
- Object data = tis[0].getData();
- if (data != null) {
- return; // children already there!
- }
- }
- final IRSECallback cb = callback;
-
- BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
- public void run() {
- // fix for PR 1FW89L7:
- // don't complain and remove all "dummies" ...
- if (tis != null) {
- for (int i = 0; i < tis.length; i++) {
- if (tis[i].getData() != null) {
- disassociate(tis[i]);
- Assert.isTrue(tis[i].getData() == null,
- "Second or later child is non -null");//$NON-NLS-1$
-
- }
- tis[i].dispose();
- }
- }
- Object d = widget.getData();
- if (d != null)
- {
- ContextObjectWithViewer parentElement = getContextObject((TreeItem)widget);
- if (cb != null){
- parentElement.setCallback(cb);
- }
-
- Object[] children = getSortedChildren(parentElement);
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- createTreeItem(widget, children[i], -1);
- }
- }
- }
- }
-
- });
- }
- else
- {
- super.createChildren(widget);
- }
- }
-
- /**
- * Overridden so that we can pass a wrapper IContextObject into the provider to get children instead
- * of the model object, itself
- */
- protected void createChildren(final Widget widget)
- {
- createChildren(widget, null);
- }
-
- /**
- * Override to pass context into hasChildren()
- *
- */
- public boolean isExpandable(Object elementOrTreePath) {
- Object element;
- TreePath path;
- if (elementOrTreePath instanceof TreePath) {
- path = (TreePath) elementOrTreePath;
- element = path.getLastSegment();
- } else {
- element = elementOrTreePath;
- path = null;
- }
- IContentProvider cp = getContentProvider();
- if (cp instanceof ITreePathContentProvider) {
- ITreePathContentProvider tpcp = (ITreePathContentProvider) cp;
- if (path == null) {
- // A path was not provided so try and find one
- Widget w = findItem(element);
- if (w instanceof Item) {
- Item item = (Item) w;
- path = getTreePathFromItem(item);
- }
- if (path == null) {
- path = new TreePath(new Object[] { element });
- }
- }
- return tpcp.hasChildren(path);
- }
- if (cp instanceof ITreeContentProvider)
- {
- ITreeContentProvider tcp = (ITreeContentProvider) cp;
- if (elementOrTreePath instanceof TreeItem)
- {
- ContextObjectWithViewer context = getContextObject((TreeItem)elementOrTreePath);
- return tcp.hasChildren(context);
- }
- else
- {
- return tcp.hasChildren(element);
- }
- }
- return false;
- }
-
- public void update(Object element, String[] properties) {
- Assert.isNotNull(element);
- List matches = new Vector();
- findAllRemoteItemReferences(element, element, matches);
-
- for (int i = 0; i < matches.size(); i++) {
-
- internalUpdate((Widget)matches.get(i), element, properties);
- }
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForConnections.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForConnections.java
deleted file mode 100644
index 59442b816..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForConnections.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is used when the contents are the children of a particular connection.
- * Used when user right clicks on a connection and selects Open In New Perspective.
- */
-public class SystemViewAPIProviderForConnections
- extends SystemAbstractAPIProvider
-{
-
-
- protected IHost connection = null;
-
- /**
- * Constructor
- * @param connection The connection object we are drilling down on.
- */
- public SystemViewAPIProviderForConnections(IHost connection)
- {
- super();
- this.connection = connection;
- }
-
- /**
- * Get the input connection object.
- */
- public IHost getConnection()
- {
- return connection;
- }
- /**
- * Reset the input connection object.
- */
- public void setConnection(IHost connection)
- {
- this.connection = connection;
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- * We return all subsystems for this connection
- */
- public Object[] getSystemViewRoots()
- {
- //return sr.getSubSystems(connection);
- return getViewAdapter(connection).getChildren(connection, new NullProgressMonitor()); // pc42690
- }
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- * We return true, assuming there is at least one subsystem object
- */
- public boolean hasSystemViewRoots()
- {
- return true;
- }
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- * <p>Not applicable for us.
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- //return sr.getSubSystems(selectedConnection);
- return getViewAdapter(selectedConnection).getChildren(selectedConnection, new NullProgressMonitor()); // pc42690
- }
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- * <p>Not applicable for us.
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return true;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterPools.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterPools.java
deleted file mode 100644
index 773aa5edd..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterPools.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is used when the contents are the children of a particular subsystem.
- * Used when user right clicks on a filter pool and selects Open In New Perspective.
- */
-public class SystemViewAPIProviderForFilterPools
- extends SystemAbstractAPIProvider
-{
-
-
- protected ISubSystem subsystem = null;
- protected ISystemFilterPool filterPool = null;
- protected ISystemFilterPoolReference filterPoolReference = null;
-
- /**
- * Constructor
- * @param filterPoolReference The filterpool reference object we are drilling down on.
- */
- public SystemViewAPIProviderForFilterPools(ISystemFilterPoolReference filterPoolReference)
- {
- super();
- setFilterPoolReference(filterPoolReference);
- }
-
- /**
- * Get the parent subsystem object.
- */
- public ISubSystem getSubSystem()
- {
- return subsystem;
- }
- /**
- * Get the input filter pool reference object.
- */
- public ISystemFilterPoolReference getSystemFilterPoolReference()
- {
- return filterPoolReference;
- }
- /**
- * Get the filter pool referenced by the input filter pool reference object.
- */
- public ISystemFilterPool getSystemFilterPool()
- {
- return filterPool;
- }
-
- /**
- * Reset the input filter pool reference object.
- */
- public void setFilterPoolReference(ISystemFilterPoolReference filterPoolReference)
- {
- this.filterPoolReference = filterPoolReference;
- this.filterPool = filterPoolReference.getReferencedFilterPool();
- this.subsystem = (ISubSystem)filterPoolReference.getProvider();
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- * We return all filters for this filter pool
- */
- public Object[] getSystemViewRoots()
- {
- return filterPoolReference.getSystemFilterReferences(getSubSystem());
- }
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- * We return true if the referenced filter pool has any filters
- */
- public boolean hasSystemViewRoots()
- {
- return (filterPool.getSystemFilterCount() > 0);
- }
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- * <p>Not applicable for us.
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- return null;
- }
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- * <p>Not applicable for us.
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java
deleted file mode 100644
index a30acf68c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilterStrings.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is used when the contents are the children of a particular subsystem.
- * Used when user right clicks on a filter string and selects Open In New Perspective.
- */
-public class SystemViewAPIProviderForFilterStrings
- extends SystemAbstractAPIProvider
-{
-
-
- protected ISubSystem subsystem = null;
- protected ISystemFilterPool filterPool = null;
- protected ISystemFilterPoolReference filterPoolReference = null;
- protected ISystemFilterReference filterReference = null;
- protected ISystemFilter filter = null;
- protected ISystemFilterString filterString = null;
- protected ISystemFilterStringReference filterStringReference = null;
-
- /**
- * Constructor
- * @param filterStringReference The filter string reference object we are drilling down on.
- */
- public SystemViewAPIProviderForFilterStrings(ISystemFilterStringReference filterStringReference)
- {
- super();
- setFilterStringReference(filterStringReference);
- }
-
- /**
- * Get the parent subsystem object.
- */
- public ISubSystem getSubSystem()
- {
- return subsystem;
- }
- /**
- * Get the parent filter pool reference object.
- */
- public ISystemFilterPoolReference getSystemFilterPoolReference()
- {
- return filterPoolReference;
- }
- /**
- * Get the parent filter pool.
- */
- public ISystemFilterPool getSystemFilterPool()
- {
- return filterPool;
- }
- /**
- * Get the parent filter reference object.
- */
- public ISystemFilterReference getSystemFilterReference()
- {
- return filterReference;
- }
- /**
- * Get the parent filter
- */
- public ISystemFilter getSystemFilter()
- {
- return filter;
- }
- /**
- * Get the input filter string reference object.
- */
- public ISystemFilterStringReference getSystemFilterStringReference()
- {
- return filterStringReference;
- }
- /**
- * Get the filter referenced by the input filter string reference object.
- */
- public ISystemFilterString getSystemFilterString()
- {
- return filterString;
- }
-
-
- /**
- * Reset the input filter string reference object.
- */
- public void setFilterStringReference(ISystemFilterStringReference filterStringReference)
- {
- this.filterStringReference = filterStringReference;
- this.filterString = filterStringReference.getReferencedFilterString();
- this.filterReference = filterStringReference.getParent();
- this.filter = filterReference.getReferencedFilter();
- this.filterPoolReference = filterReference.getParentSystemFilterReferencePool();
- this.filterPool = filterPoolReference.getReferencedFilterPool();
- this.subsystem = (ISubSystem)filterPoolReference.getProvider();
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- * What we return depends on setting of Show Filter Strings.
- */
- public Object[] getSystemViewRoots()
- {
- ISubSystem ss = subsystem;
- Object element = filterStringReference;
- Object[] children = null;
- try
- {
- children = ss.resolveFilterString(filterStringReference.getString(), new NullProgressMonitor());
- children = checkForEmptyList(children, element, true);
- }
- catch (InterruptedException exc)
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED),
- ISystemMessageObject.MSGTYPE_CANCEL, element);
- System.out.println("Cancelled."); //$NON-NLS-1$
- }
- catch (Exception exc)
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),
- ISystemMessageObject.MSGTYPE_ERROR, element);
- System.out.println("Exception resolving filter strings: " + exc.getClass().getName() + ", " + exc.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$
- exc.printStackTrace();
- } // message already issued
- return children;
- }
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- * We return true
- */
- public boolean hasSystemViewRoots()
- {
- return true;
- }
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- * <p>Not applicable for us.
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- return null;
- }
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- * <p>Not applicable for us.
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java
deleted file mode 100644
index 7ce326bae..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForFilters.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Martin Oberhuber (Wind River) - [218524][api] Remove deprecated ISystemViewInputProvider#getShell()
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.SubSystemHelpers;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is used when the contents are the children of a particular subsystem.
- * Used when user right clicks on a filter and selects Open In New Perspective.
- */
-public class SystemViewAPIProviderForFilters
- extends SystemAbstractAPIProvider
-{
-
-
- protected ISubSystem subsystem = null;
- protected ISystemFilterPool filterPool = null;
- protected ISystemFilterPoolReference filterPoolReference = null;
- protected ISystemFilterReference filterReference = null;
- protected ISystemFilter filter = null;
-
- /**
- * Constructor
- * @param filterReference The filter reference object we are drilling down on.
- */
- public SystemViewAPIProviderForFilters(ISystemFilterReference filterReference)
- {
- super();
- setFilterReference(filterReference);
- }
-
- /**
- * Get the parent subsystem object.
- */
- public ISubSystem getSubSystem()
- {
- return subsystem;
- }
- /**
- * Get the parent filter pool reference object.
- */
- public ISystemFilterPoolReference getSystemFilterPoolReference()
- {
- return filterPoolReference;
- }
- /**
- * Get the parent filter pool.
- */
- public ISystemFilterPool getSystemFilterPool()
- {
- return filterPool;
- }
- /**
- * Get the input filter reference object.
- */
- public ISystemFilterReference getSystemFilterReference()
- {
- return filterReference;
- }
- /**
- * Get the filter referenced by the input filter reference object.
- */
- public ISystemFilter getSystemFilter()
- {
- return filter;
- }
-
- /**
- * Reset the input filter reference object.
- */
- public void setFilterReference(ISystemFilterReference filterReference)
- {
- this.filterReference = filterReference;
- this.filter = filterReference.getReferencedFilter();
- this.filterPoolReference = filterReference.getParentSystemFilterReferencePool();
- this.filterPool = filterPoolReference.getReferencedFilterPool();
- this.subsystem = (ISubSystem)filterPoolReference.getProvider();
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- * What we return depends on setting of Show Filter Strings.
- */
- public Object[] getSystemViewRoots()
- {
- // see getChildren() OF SystemViewFilterReferenceAdapter. TODO: RE-USE VS COPY!
- Object[] children = null;
- ISystemFilterReference fRef = filterReference;
- Object element = fRef;
- //Object[] children = fRef.getChildren(getShell());
- ISystemFilter referencedFilter = fRef.getReferencedFilter();
-
- ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(referencedFilter);
- boolean promptable = referencedFilter.isPromptable();
- //System.out.println("Promptable? " + promptable);
- if (promptable)
- {
- children = new SystemMessageObject[1];
- try {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
- ISystemFilter newFilter = adapter.createFilterByPrompting(ssf, fRef, RSEUIPlugin.getTheSystemRegistryUI().getShell());
- if (newFilter == null)
- {
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED),
- ISystemMessageObject.MSGTYPE_CANCEL,element);
- }
- else // filter successfully created!
- {
- // return "filter created successfully" message object for this node
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FILTERCREATED),
- ISystemMessageObject.MSGTYPE_OBJECTCREATED,element);
- // select the new filter reference...
- ISubSystem ss = fRef.getSubSystem();
- ISystemFilterReference sfr = fRef.getParentSystemFilterReferencePool().getExistingSystemFilterReference(ss, newFilter);
- ISystemViewInputProvider inputProvider = this;
- if ((sfr != null) && (inputProvider.getViewer()!=null))
- {
- SystemResourceChangeEvent event = new SystemResourceChangeEvent(sfr, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
- Viewer v = (Viewer)inputProvider.getViewer();
- if (v instanceof ISystemResourceChangeListener)
- {
- //sr.fireEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers!
- RSEUIPlugin.getTheSystemRegistryUI().postEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers!
- }
- }
- }
- } catch (Exception exc) {
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),
- ISystemMessageObject.MSGTYPE_ERROR, element);
- SystemBasePlugin.logError("Exception prompting for filter ",exc); //$NON-NLS-1$
- }
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"returning children");
- return children;
- }
- ISubSystem ss = fRef.getSubSystem();
- Object[] nestedFilterReferences = fRef.getSystemFilterReferences(ss);
- int nbrFilterStrings = referencedFilter.getFilterStringCount();
- if (nbrFilterStrings == 0)
- return nestedFilterReferences;
- else
- {
-
- {
- String[] filterStrings = referencedFilter.getFilterStrings();
- try
- {
- if (nestedFilterReferences != null)
- {
- Object[] allChildren = ss.resolveFilterStrings(filterStrings, new NullProgressMonitor());
- int nbrNestedFilters = nestedFilterReferences.length;
- children = new Object[nbrNestedFilters + allChildren.length];
- int idx = 0;
- for (idx=0; idx<nbrNestedFilters; idx++)
- children[idx] = nestedFilterReferences[idx];
- for (int jdx=0; jdx<allChildren.length; jdx++)
- children[idx++] = allChildren[jdx];
- }
- }
- catch (InterruptedException exc)
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED),
- ISystemMessageObject.MSGTYPE_CANCEL,element);
- SystemBasePlugin.logDebugMessage(this.getClass().getName(),"Filter resolving cancelled by user."); //$NON-NLS-1$
- }
- catch (Exception exc)
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),
- ISystemMessageObject.MSGTYPE_ERROR, element);
- SystemBasePlugin.logError("Exception resolving filters' strings ",exc); //$NON-NLS-1$
- } // message already issued
-
- return checkForEmptyList(children, element, true);
- }
- }
- }
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- * We return true if the referenced filter has nested filters or has filter strings.
- */
- public boolean hasSystemViewRoots()
- {
- int nbrNestedFilters = filter.getSystemFilterCount();
- int nbrFilterStrings = filter.getFilterStringCount();
- return (nbrNestedFilters > 0) || (nbrFilterStrings > 0);
- }
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- * <p>Not applicable for us.
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- return null;
- }
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- * <p>Not applicable for us.
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return false;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForSubSystems.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForSubSystems.java
deleted file mode 100644
index 8ad201567..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAPIProviderForSubSystems.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.view.SystemAbstractAPIProvider;
-
-
-/**
- * This class is a provider of root nodes to the remote systems tree viewer part.
- * It is used when the contents are the children of a particular subsystem.
- * Used when user right clicks on a subsystem and selects Open In New Perspective.
- */
-public class SystemViewAPIProviderForSubSystems
- extends SystemAbstractAPIProvider
-{
-
-
- protected ISubSystem subsystem = null;
-
- /**
- * Constructor
- * @param subsystem The subsystem object we are drilling down on.
- */
- public SystemViewAPIProviderForSubSystems(ISubSystem subsystem)
- {
- super();
- setSubSystem(subsystem);
- }
-
- /**
- * Get the input subsystem object.
- */
- public ISubSystem getSubSystem()
- {
- return subsystem;
- }
- /**
- * Reset the input subsystem object.
- */
- public void setSubSystem(ISubSystem subsystem)
- {
- this.subsystem = subsystem;
- }
-
- // ----------------------------------
- // SYSTEMVIEWINPUTPROVIDER METHODS...
- // ----------------------------------
- /**
- * Return the children objects to consistute the root elements in the system view tree.
- * We return all filter pools for this subsystem
- */
- public Object[] getSystemViewRoots()
- {
- return subsystem.getChildren();
- }
- /**
- * Return true if {@link #getSystemViewRoots()} will return a non-empty list
- * We return subsystem.hasChildren()
- */
- public boolean hasSystemViewRoots()
- {
- return subsystem.hasChildren();
- }
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- * <p>Not applicable for us.
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- return null;
- }
- /**
- * This method is called by the connection adapter when deciding to show a plus-sign
- * or not beside a connection. Return true if this connection has children to be shown.
- * <p>Not applicable for us.
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAdapterFactory.java
deleted file mode 100644
index fb180a3fe..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewAdapterFactory.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryAdapter;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryNode;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewProfileAdapter;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetAdapter;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewPropertySetNode;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationAdapter;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewSubSystemConfigurationNode;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
-import org.eclipse.rse.ui.model.ISystemPromptableObject;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * This factory maps requests for an adapter object from a given
- * element object.
- */
-public class SystemViewAdapterFactory implements IAdapterFactory {
-
- private SystemViewRootInputAdapter rootAdapter = new SystemViewRootInputAdapter();
- private SystemViewConnectionAdapter connectionAdapter = new SystemViewConnectionAdapter();
- private SystemViewSubSystemAdapter subsystemAdapter = new SystemViewSubSystemAdapter();
- private SystemViewFilterPoolAdapter filterPoolAdapter = new SystemViewFilterPoolAdapter();
- private SystemViewFilterAdapter filterAdapter = new SystemViewFilterAdapter();
- private SystemViewFilterPoolReferenceAdapter filterPoolReferenceAdapter = new SystemViewFilterPoolReferenceAdapter();
- private SystemViewFilterReferenceAdapter filterReferenceAdapter = new SystemViewFilterReferenceAdapter();
- private SystemViewMessageAdapter msgAdapter = new SystemViewMessageAdapter();
- private SystemViewPromptableAdapter promptAdapter = new SystemViewPromptableAdapter();
- private SystemViewNewConnectionPromptAdapter newConnPromptAdapter = new SystemViewNewConnectionPromptAdapter();
- private SystemTeamViewProfileAdapter profileAdapter = new SystemTeamViewProfileAdapter();
- private SystemTeamViewCategoryAdapter categoryAdapter = new SystemTeamViewCategoryAdapter();
- private SystemTeamViewSubSystemConfigurationAdapter subsysFactoryAdapter = new SystemTeamViewSubSystemConfigurationAdapter();
- private SystemTeamViewPropertySetAdapter propertySetAdapter = new SystemTeamViewPropertySetAdapter();
-
- private SystemViewFilterStringAdapter filterStringAdapter = new SystemViewFilterStringAdapter();
-
- /**
- * @see IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- return new Class[] { ISystemViewElementAdapter.class, ISystemDragDropAdapter.class, IPropertySource.class, IWorkbenchAdapter.class,
- IActionFilter.class, IDeferredWorkbenchAdapter.class };
- }
-
- /**
- * Called by our plugin's startup method to register our adaptable object types
- * with the platform. We prefer to do it here to isolate/encapsulate all factory
- * logic in this one place.
- * @param manager the adapter manager controlling this factory
- */
- public void registerWithManager(IAdapterManager manager) {
- manager.registerAdapters(this, ISystemViewInputProvider.class);
- manager.registerAdapters(this, ISystemProfile.class);
- manager.registerAdapters(this, IHost.class);
- manager.registerAdapters(this, ISubSystem.class);
- manager.registerAdapters(this, ISystemFilter.class);
- manager.registerAdapters(this, ISystemFilterPool.class);
- manager.registerAdapters(this, ISystemFilterPoolReference.class);
- manager.registerAdapters(this, ISystemFilterReference.class);
- manager.registerAdapters(this, ISystemFilterString.class);
- manager.registerAdapters(this, ISystemMessageObject.class);
- manager.registerAdapters(this, ISystemPromptableObject.class);
- manager.registerAdapters(this, SystemTeamViewCategoryNode.class);
- manager.registerAdapters(this, SystemTeamViewSubSystemConfigurationNode.class);
- manager.registerAdapters(this, SystemTeamViewPropertySetNode.class);
-
- // FIXME - UDAs no longer in core
- //manager.registerAdapters(this, SystemTeamViewCompileTypeNode.class);
- //manager.registerAdapters(this, SystemTeamViewCompileCommandNode.class);
- //manager.registerAdapters(this, SystemUDActionElement.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- Object adapter = null;
- if (adaptableObject instanceof ISystemViewElementAdapter)
- adapter = adaptableObject;
- else if (adaptableObject instanceof ISystemDragDropAdapter)
- adapter = adaptableObject;
- else if (adaptableObject instanceof ISystemViewInputProvider)
- adapter = rootAdapter;
- else if (adaptableObject instanceof ISystemProfile)
- adapter = profileAdapter;
- else if (adaptableObject instanceof IHost)
- adapter = connectionAdapter;
- else if (adaptableObject instanceof ISubSystem)
- adapter = subsystemAdapter;
- else if (adaptableObject instanceof ISystemFilterPoolReference)
- adapter = filterPoolReferenceAdapter;
- else if (adaptableObject instanceof ISystemFilterPool)
- adapter = filterPoolAdapter;
- else if (adaptableObject instanceof ISystemFilterReference)
- adapter = filterReferenceAdapter;
- else if (adaptableObject instanceof ISystemFilterString)
- adapter = filterStringAdapter;
- else if (adaptableObject instanceof ISystemFilter)
- adapter = filterAdapter;
- else if (adaptableObject instanceof ISystemMessageObject)
- adapter = msgAdapter;
- else if (adaptableObject instanceof ISystemPromptableObject) {
-
- if (adaptableObject instanceof SystemNewConnectionPromptObject) {
- adapter = newConnPromptAdapter;
- } else {
- adapter = promptAdapter;
- }
- } else if (adaptableObject instanceof SystemTeamViewCategoryNode)
- adapter = categoryAdapter;
- else if (adaptableObject instanceof SystemTeamViewSubSystemConfigurationNode) adapter = subsysFactoryAdapter;
- else if (adaptableObject instanceof SystemTeamViewPropertySetNode) adapter = propertySetAdapter;
-
- /** FIXME - UDAs no longer in core
- else if (adaptableObject instanceof SystemTeamViewCompileTypeNode)
- adapter = getCompileTypeAdapter();
- else if (adaptableObject instanceof SystemTeamViewCompileCommandNode)
- adapter = getCompileCommandAdapter();
- else if (adaptableObject instanceof SystemUDActionElement)
- adapter = getUserActionAdapter();
- */
-
- if ((adapter != null) && (adapterType == IPropertySource.class)) {
- ((ISystemViewElementAdapter) adapter).setPropertySourceInput(adaptableObject);
- } else if (adapter == null) {
- SystemBasePlugin.logWarning("No adapter found for object of type: " + adaptableObject.getClass().getName()); //$NON-NLS-1$
- }
- return adapter;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewCompositeActionGroup.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewCompositeActionGroup.java
deleted file mode 100644
index aeb4d88b7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewCompositeActionGroup.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.ActionGroup;
-
-public class SystemViewCompositeActionGroup extends ActionGroup {
-
-
-
- private ActionGroup[] fGroups;
-
- public SystemViewCompositeActionGroup() {
- }
-
- public SystemViewCompositeActionGroup(ActionGroup[] groups) {
- setGroups(groups);
- }
-
- protected void setGroups(ActionGroup[] groups) {
- Assert.isTrue(fGroups == null);
- Assert.isNotNull(groups);
- fGroups= groups;
- }
-
- public ActionGroup get(int index) {
- if (fGroups == null)
- return null;
- return fGroups[index];
- }
-
- public void addGroup(ActionGroup group) {
- if (fGroups == null) {
- fGroups= new ActionGroup[] { group };
- } else {
- ActionGroup[] newGroups= new ActionGroup[fGroups.length + 1];
- System.arraycopy(fGroups, 0, newGroups, 0, fGroups.length);
- newGroups[fGroups.length]= group;
- fGroups= newGroups;
- }
- }
-
- public void dispose() {
- super.dispose();
- if (fGroups == null)
- return;
- for (int i= 0; i < fGroups.length; i++) {
- fGroups[i].dispose();
- }
- }
-
- public void fillActionBars(IActionBars actionBars) {
- super.fillActionBars(actionBars);
- if (fGroups == null)
- return;
- for (int i= 0; i < fGroups.length; i++) {
- fGroups[i].fillActionBars(actionBars);
- }
- }
-
- public void fillContextMenu(IMenuManager menu) {
- super.fillContextMenu(menu);
- if (fGroups == null)
- return;
- for (int i= 0; i < fGroups.length; i++) {
- fGroups[i].fillContextMenu(menu);
- }
- }
-
- public void setContext(ActionContext context) {
- super.setContext(context);
- if (fGroups == null)
- return;
- for (int i= 0; i < fGroups.length; i++) {
- fGroups[i].setContext(context);
- }
- }
-
- public void updateActionBars() {
- super.updateActionBars();
- if (fGroups == null)
- return;
- for (int i= 0; i < fGroups.length; i++) {
- fGroups[i].updateActionBars();
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
deleted file mode 100644
index 9306395e4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
+++ /dev/null
@@ -1,734 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * - created and used RSEPreferencesManager
- * Uwe Stieber (Wind River) - Menu action contributions can be acknowlegded by system type provider
- * David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- * Kevin Doyle (IBM) - [189005] Fixed getParent() to return SystemRegistryUI instead of SystemRegistry
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [191288] Up To Action doesn't go all the way back to the connections
- * Uwe Stieber (Wind River) - [199032] [api] Remove method acceptContextMenuActionContribution(...) from RSESystemTypeAdapter
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * Martin Oberhuber (Wind River) - [216266] Consider stateless subsystems (supportsSubSystemConnect==false)
- * David Dykstal (IBM) - [197036] minor refactoring caused by SystemRegistry fix for this bug
- * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
- * David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
- * David McKnight (IBM) - [226324] Default user ID from preferences not inherited
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.IRSEUserIdConstants;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.RSEPreferencesManager;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemClearAllPasswordsAction;
-import org.eclipse.rse.internal.ui.actions.SystemConnectAllSubSystemsAction;
-import org.eclipse.rse.internal.ui.actions.SystemCopyConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemDisconnectAllSubSystemsAction;
-import org.eclipse.rse.internal.ui.actions.SystemExportConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemImportConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemMoveConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemMoveDownConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemMoveUpConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemWorkOfflineAction;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorSpecialChar;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-
-/**
- * Adapter for displaying SystemConnection objects in tree views.
- */
-public class SystemViewConnectionAdapter
- extends AbstractSystemViewAdapter
-{
- private SystemNewConnectionAction anotherConnectionAction = null;
- //private SystemUpdateConnectionAction updateAction = null;
- private SystemMoveUpConnectionAction upAction = null;
- private SystemMoveDownConnectionAction downAction = null;
- private SystemDisconnectAllSubSystemsAction disconnectAction = null;
- private SystemConnectAllSubSystemsAction connectAction = null;
- private SystemClearAllPasswordsAction clearPasswordAction = null;
- private SystemCopyConnectionAction copyAction = null;
- private SystemMoveConnectionAction moveAction = null;
- private SystemExportConnectionAction exportAction = null;
- private SystemImportConnectionAction importAction = null;
-
- // yantzi: artemis 6.0, add work offline support
- private SystemWorkOfflineAction offlineAction = null;
-
- private SystemInheritablePropertyData userIdData = new SystemInheritablePropertyData();
- private String translatedType = null;
- private String translatedHostname = null;
- private String translatedDescription = null;
- // for reset property support
- private String original_hostName, original_description;
- private SystemInheritablePropertyData original_userIdData = new SystemInheritablePropertyData();
- private boolean changed_hostName, changed_description, changed_userId;
- private boolean actionsCreated = false;
-
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
- /**
- * Returns the system type object for the specified host.
- *
- * @param host The host to get the system type object from.
- * @return The system type object or <code>null</code>.
- */
- private IRSESystemType getSystemTypeForHost(IHost host) {
- if (host != null) {
- return host.getSystemType();
- }
- return null;
- }
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given element.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup) {
- if (!actionsCreated) createActions();
-
- // bugzilla#161195: _ALL_ actions needs to be passed to the system type for approval.
- // _Never_ add any action without the system type provider having said ok to this.
- IHost host = (IHost)selection.getFirstElement();
- IRSESystemType sysType = getSystemTypeForHost(host);
- Object adapter = sysType != null ? sysType.getAdapter(RSESystemTypeAdapter.class) : null;
- RSESystemTypeAdapter sysTypeAdapter = adapter instanceof RSESystemTypeAdapter ? (RSESystemTypeAdapter)adapter : null;
-
- //updateAction.setValue(null); // reset
- menu.add(menuGroup, anotherConnectionAction);
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new GroupMarker(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING));// user or BP/ISV additions
-
- menu.add(menuGroup, copyAction);
- menu.add(menuGroup, moveAction);
- menu.add(menuGroup, upAction);
- menu.add(menuGroup, downAction);
- menu.add(menuGroup, exportAction);
- menu.add(menuGroup, importAction);
-
- // MJB: RE defect 40854
- addConnectOrDisconnectAction(menu, menuGroup, selection);
-
- // SystemClearAllPasswordsAction is added only if passwords are supported
- // by any of the sub systems.
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- IConnectorService[] connectorServices = registry.getConnectorServices(host);
- boolean passwordsSupported = false;
- for (int i = 0; i < connectorServices.length && passwordsSupported == false; i++) {
- passwordsSupported |= connectorServices[i].supportsPassword();
- }
- if (passwordsSupported) menu.add(menuGroup, clearPasswordAction);
-
- // yantzi: artemis 6.0, offline support, only add work offline action for system types that support offline mode
- if (sysTypeAdapter != null && sysTypeAdapter.isEnableOffline(host.getSystemType())) {
- menu.add(menuGroup, offlineAction);
- }
- }
-
- private void addConnectOrDisconnectAction(SystemMenuManager menu, String menuGroup, IStructuredSelection selection) {
- IHost host = (IHost)selection.getFirstElement();
-
- ISystemRegistry sysReg = RSECorePlugin.getTheSystemRegistry();
- boolean anySupportsConnect = sysReg.isAnySubSystemSupportsConnect(host);
-
- if (anySupportsConnect) {
- boolean anyConnected = sysReg.isAnySubSystemConnected(host);
- boolean allConnected = sysReg.areAllSubSystemsConnected(host);
-
- if (!allConnected) menu.add(menuGroup, connectAction);
- if (anyConnected) menu.add(menuGroup, disconnectAction);
- }
- }
-
- private void createActions()
- {
- anotherConnectionAction = new SystemNewConnectionAction(null,
- SystemResources.ACTION_ANOTHERCONN_LABEL,
- SystemResources.ACTION_ANOTHERCONN_TOOLTIP,
- false,
- true,
- null);
- anotherConnectionAction.setHelp(RSEUIPlugin.HELPPREFIX+"actn0015"); //$NON-NLS-1$
-
- //updateAction = new SystemUpdateConnectionAction(null);
- upAction = new SystemMoveUpConnectionAction(null);
- downAction = new SystemMoveDownConnectionAction(null);
- disconnectAction = new SystemDisconnectAllSubSystemsAction(null);
- copyAction = new SystemCopyConnectionAction(null);
- moveAction = new SystemMoveConnectionAction(null);
- offlineAction = new SystemWorkOfflineAction(null);
- connectAction = new SystemConnectAllSubSystemsAction(null);
- clearPasswordAction = new SystemClearAllPasswordsAction(null);
- exportAction = new SystemExportConnectionAction();
- importAction = new SystemImportConnectionAction();
- actionsCreated = true;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- IHost connection = (IHost)element;
- boolean anyConnected = RSECorePlugin.getTheSystemRegistry().isAnySubSystemConnected(connection);
- ImageDescriptor descriptor = null;
- IRSESystemType systemType = getSystemTypeForHost(connection);
- if (systemType != null) {
- RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)(systemType.getAdapter(RSESystemTypeAdapter.class));
- if (anyConnected) {
- descriptor = sysTypeAdapter.getLiveImageDescriptor(systemType);
- } else {
- descriptor = sysTypeAdapter.getImageDescriptor(systemType);
- }
- } else {
- descriptor = ImageDescriptor.getMissingImageDescriptor();
- }
- return descriptor;
- }
-
- /**
- * Return the label for this object
- */
- public String getText(Object element)
- {
- IHost conn = (IHost)element;
- boolean qualifyNames = RSEUIPlugin.getTheSystemRegistryUI().getQualifiedHostNames();
- if (!qualifyNames)
- return conn.getAliasName();
- else
- return conn.getSystemProfileName() + "." + conn.getAliasName(); //$NON-NLS-1$
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- IHost conn = (IHost)element;
- return conn.getAliasName();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- IHost conn = (IHost)element;
- return conn.getSystemProfileName() + "." + conn.getAliasName(); //$NON-NLS-1$
- }
-
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- if (translatedType == null)
- translatedType = SystemViewResources.RESID_PROPERTY_CONNECTION_TYPE_VALUE;
- return translatedType;
- }
-
- /**
- * Return the string to display in the status line when the given object is selected.
- * We return:
- * Connection: name - Host name: hostName - Description: description
- */
- public String getStatusLineText(Object element)
- {
- IHost conn = (IHost)element;
- if (translatedHostname == null)
- translatedHostname = SystemViewResources.RESID_PROPERTY_HOSTNAME_LABEL;
- if (translatedDescription == null)
- translatedDescription = SystemViewResources.RESID_PROPERTY_CONNDESCRIPTION_LABEL;
- String statusText =
- getType(element) + ": " + conn.getAliasName() + " - " + //$NON-NLS-1$ //$NON-NLS-2$
- translatedHostname + ": " + conn.getHostName(); //$NON-NLS-1$
- String text = conn.getDescription();
- if ((text==null) || (text.length()==0))
- return statusText;
- else
- return statusText + " - " + translatedDescription + ": " + text; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Return the parent of this object
- */
- public Object getParent(Object element)
- {
- return RSECorePlugin.getTheSystemRegistry();
- }
-
- /**
- * Return the children of this object
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- IHost conn = (IHost)element;
- ISystemViewInputProvider input = getInput();
- if (input != null)
- {
- Object[] children = input.getConnectionChildren(conn);
- if (children != null)
- {
- Vector v = new Vector();
- boolean someSkipped = false;
- for (int idx=0; idx<children.length; idx++)
- {
- if ((children[idx] instanceof ISubSystem) &&
- ((ISubSystem)children[idx]).isHidden() )
- someSkipped = true;
- else
- v.addElement(children[idx]);
- }
- if (someSkipped)
- {
- children = new Object[v.size()];
- for (int idx=0; idx<children.length; idx++)
- children[idx] = v.elementAt(idx);
- }
- }
- return children;
- }
- else
- {
- System.out.println("SystemViewConnection.getChildren(): adapter has no input!"); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Return true if this object has children
- */
- public boolean hasChildren(IAdaptable element)
- {
- IHost conn = (IHost)element;
- return getInput().hasConnectionChildren(conn);
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
-
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- propertyDescriptorArray = new PropertyDescriptor[6];
- int idx = -1;
-
- // add our unique property descriptors...
- //idx = defaultProperties.length;
- //RSEUIPlugin plugin = RSEUIPlugin.getDefault();
-
- // profile
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PROFILE, SystemViewResources.RESID_PROPERTY_PROFILE_LABEL, SystemViewResources.RESID_PROPERTY_PROFILE_TOOLTIP);
-
- // system type
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_SYSTEMTYPE,SystemViewResources.RESID_PROPERTY_SYSTEMTYPE_LABEL, SystemViewResources.RESID_PROPERTY_SYSTEMTYPE_TOOLTIP);
-
- // status
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_CONNECTED,SystemViewResources.RESID_PROPERTY_CONNECTIONSTATUS_LABEL, SystemViewResources.RESID_PROPERTY_CONNECTIONSTATUS_TOOLTIP);
-
- // hostname
- if (translatedHostname == null)
- translatedHostname = SystemViewResources.RESID_PROPERTY_HOSTNAME_LABEL;
- propertyDescriptorArray[++idx] = new TextPropertyDescriptor(ISystemPropertyConstants.P_HOSTNAME, translatedHostname);
- propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_HOSTNAME_TOOLTIP);
-
- // default user id
- //propertyDescriptorArray[++idx] = new TextPropertyDescriptor(ISystemPropertyConstants.P_DEFAULTUSERID,
- // SystemViewResources.RESID_PROPERTY_DEFAULTUSERID_LABEL));
- SystemInheritableTextPropertyDescriptor userIdDescriptor =
- new SystemInheritableTextPropertyDescriptor(ISystemPropertyConstants.P_DEFAULTUSERID,
- SystemViewResources.RESID_PROPERTY_DEFAULTUSERID_LABEL);
- //RSEUIPlugin sp = RSEUIPlugin.getDefault();
- userIdDescriptor.setToggleButtonToolTipText(SystemResources.RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP);
- userIdDescriptor.setEntryFieldToolTipText(SystemResources.RESID_CONNECTION_DEFAULTUSERID_TIP);
- ICellEditorValidator userIdValidator =
- new ValidatorSpecialChar("=;",false, //$NON-NLS-1$
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_NOTVALID),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY)); // false => allow empty? No.
- userIdDescriptor.setValidator(userIdValidator);
- propertyDescriptorArray[++idx] = userIdDescriptor;
- propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_DEFAULTUSERID_TOOLTIP);
-
- // description
- if (translatedDescription == null)
- translatedDescription = SystemViewResources.RESID_PROPERTY_CONNDESCRIPTION_LABEL;
- propertyDescriptorArray[++idx] = new TextPropertyDescriptor(ISystemPropertyConstants.P_DESCRIPTION, translatedDescription);
- propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_CONNDESCRIPTION_TOOLTIP);
-
- }
- return propertyDescriptorArray;
- }
-
- /**
- * Returns the current value for the named property.
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param key the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- protected Object internalGetPropertyValue(Object key)
- {
- String name = (String)key;
- IHost conn = (IHost)propertySourceInput;
-
- if (name.equals(ISystemPropertyConstants.P_SYSTEMTYPE))
- return conn.getSystemType().getLabel();
- else if (name.equals(ISystemPropertyConstants.P_HOSTNAME))
- return conn.getHostName();
- else if (name.equals(ISystemPropertyConstants.P_DEFAULTUSERID))
- {
- setDefaultUserIdPropertyData(userIdData, conn);
- //System.out.println("Testing getPropertyValue: " + userIdData);
- return userIdData;
- }
- else if (name.equals(ISystemPropertyConstants.P_DESCRIPTION))
- return conn.getDescription();
- else if (name.equals(ISystemPropertyConstants.P_PROFILE))
- return conn.getSystemProfile().getName();
- else if (name.equals(ISystemPropertyConstants.P_IS_CONNECTED))
- {
- if (conn.isOffline())
- {
- return SystemResources.RESID_OFFLINE_LABEL;
- }
- else
- {
- boolean anyConnected = RSECorePlugin.getTheSystemRegistry().isAnySubSystemConnected(conn);
- if (anyConnected)
- return SystemViewResources.RESID_PROPERTY_CONNECTIONSTATUS_CONNECTED_VALUE;
- else
- return SystemViewResources.RESID_PROPERTY_CONNECTIONSTATUS_DISCONNECTED_VALUE;
- }
- }
- else
- return null;
- }
-
- /**
- * Set the values in the userIdPropertyData object that drives the userId property sheet widget
- */
- private SystemInheritablePropertyData setDefaultUserIdPropertyData(SystemInheritablePropertyData data, IHost conn)
- {
- String localUserId = conn.getLocalDefaultUserId();
- data.setLocalValue(localUserId);
- String parentUserId = RSEPreferencesManager.getDefaultUserId(conn.getSystemType());
- data.setInheritedValue(parentUserId);
- data.setIsLocal((localUserId!=null)&&(localUserId.length()>0));
- //data.printDetails();
- return data;
- }
-
- // because this node has some editable properties, these overrides of our
- // parent class are needed as callbacks from the PropertySheet window.
- /**
- * Set input object for property source queries. This is called by the
- * SystemViewAdaptorFactory before returning this adapter object.
- */
- public void setPropertySourceInput(Object propertySourceInput)
- {
- if (this.propertySourceInput == propertySourceInput) // no change?
- return; // don't mistakenly update history values else reset from property sheet doesn't work correctly.
- super.setPropertySourceInput(propertySourceInput);
- IHost conn = (IHost)propertySourceInput;
- original_userIdData = setDefaultUserIdPropertyData(original_userIdData,conn);
- original_hostName = conn.getHostName();
- original_description = conn.getDescription();
- changed_userId = changed_hostName = changed_description = false;
- //System.out.println("Inside setPropertySourceInput in adapter");
- }
- /**
- * Returns whether the property value has changed from the default.
- * Only applicable for editable properties.
- * Called by PropertySheet viewer when user presses reset.
- * @return <code>true</code> if the value of the specified property has changed
- * from its original default value; <code>false</code> otherwise.
- */
- public boolean isPropertySet(Object propertyObject)
- {
- String property = (String)propertyObject;
- boolean changed = false;
- if (property.equals(ISystemPropertyConstants.P_DEFAULTUSERID))
- changed = changed_userId;
- else if (property.equals(ISystemPropertyConstants.P_HOSTNAME))
- changed = changed_hostName;
- else if (property.equals(ISystemPropertyConstants.P_DESCRIPTION))
- changed = changed_description;
- return changed;
- }
-
- /**
- * Called when user selects the reset button in property sheet.
- */
- public void resetPropertyValue(Object propertyObject)
- {
- //System.out.println("Inside resetPropertyValue in adapter");
- String property = (String)propertyObject;
- IHost conn = (IHost)propertySourceInput;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- if (property.equals(ISystemPropertyConstants.P_DEFAULTUSERID))
- {
- //sr.updateConnection(null, conn, conn.getSystemType().getName(), conn.getAliasName(),
- // conn.getHostName(), conn.getDescription(), original_userId, USERID_LOCATION_CONNECTION);
- updateDefaultUserId(conn, original_userIdData);
- }
- else if (property.equals(ISystemPropertyConstants.P_HOSTNAME))
- {
- sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), original_hostName,
- conn.getDescription(), conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET);
- }
- else if (property.equals(ISystemPropertyConstants.P_DESCRIPTION))
- {
- sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(),
- original_description, conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET);
- }
- }
- /**
- * Change the default user Id value
- */
- private void updateDefaultUserId(IHost conn, SystemInheritablePropertyData data)
- {
- int whereToUpdate = IRSEUserIdConstants.USERID_LOCATION_HOST;
- //if (!data.getIsLocal())
- //whereToUpdate = USERID_LOCATION_DEFAULT_SYSTEMTYPE;
- String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(),
- conn.getDescription(), userId, whereToUpdate);
- }
-
- /**
- * Called when user changes property via property sheet.
- */
- public void setPropertyValue(Object property, Object value)
- {
- String name = (String)property;
- IHost conn = (IHost)propertySourceInput;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- if (name.equals(ISystemPropertyConstants.P_DEFAULTUSERID))
- {
- //System.out.println("Testing setPropertyValue: " + value);
- //sr.updateConnection(null, conn, conn.getSystemType().getName(), conn.getAliasName(),
- // conn.getHostName(), conn.getDescription(), (String)value, USERID_LOCATION_CONNECTION);
- updateDefaultUserId(conn, (SystemInheritablePropertyData)value);
- changed_userId = true;
- }
- else if (name.equals(ISystemPropertyConstants.P_HOSTNAME))
- {
- // DKM - don't update unless it really changed
- // defect 57739
- if (!((String)value).equalsIgnoreCase(conn.getHostName()))
- {
- sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), (String)value,
- conn.getDescription(), conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET);
- changed_hostName = true;
- }
- }
- else if (name.equals(ISystemPropertyConstants.P_DESCRIPTION))
- {
- // DKM - don't update unless it really changed
- // defect 57739
- if (!((String)value).equalsIgnoreCase(conn.getDescription()))
- {
- sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(),
- (String)value, conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET);
- changed_description = true;
- }
- }
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element)
- {
- if (element instanceof IHost)
- {
- IHost host = (IHost)element;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- //do not allow delete if any subsystem is connected but supports disconnect.
- //specifically, this allows deletion of "Local" which is always connected (but does not support disconnect)
- //need to get subsystems from registry instead of host in order to be lazy:
- //subsystems which are not yet instantiated do not need to be considered.
- ISubSystem[] ss = sr.getSubSystems(host);
- for (int i=0; i<ss.length; i++) {
- if (ss[i].isConnected() && ss[i].getSubSystemConfiguration().supportsSubSystemConnect())
- return false;
- }
- }
- return true;
- }
-
-
-
- /**
- * Perform the delete action.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor)
- {
- boolean ok = true;
- IHost conn = (IHost)element;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.deleteHost(conn);
- return ok;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename popup menu item will be enabled.
- */
- public boolean canRename(Object element)
- {
- return true; // all connections are renamable
- }
- /**
- * Perform the rename action.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- boolean ok = true;
- IHost conn = (IHost)element;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.renameHost(conn,name); // renames and saves to disk
- return ok;
- }
- /**
- * Return a validator for verifying the new name is correct.
- */
- public ISystemValidator getNameValidator(Object element)
- {
- IHost conn = (IHost)element;
- //return org.eclipse.rse.core.ui.SystemConnectionForm.getConnectionNameValidator(conn); defect 42117
- return org.eclipse.rse.ui.SystemConnectionForm.getConnectionNameValidator(conn.getSystemProfile());
- }
- /**
- * Parent override.
- * <p>
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * Returns profile.connectionName, upperCased
- */
- public String getCanonicalNewName(Object element, String newName)
- {
- IHost conn = (IHost)element;
- return (conn.getSystemProfileName() + "." + newName).toUpperCase(); //$NON-NLS-1$
- }
-
-
- // FOR COMMON DRAG AND DROP ACTIONS
- /**
- * Indicates whether the connection can be dragged.
- * Can't be used for physical copies but rather
- * for views (like the Scratchpad)
- */
- public boolean canDrag(Object element)
- {
- return true;
- }
-
- /**
- * Returns the connection (no phyiscal operation required to drag and subsystem (because it's local)
- */
- public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
- {
- return element;
- }
-
-
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * This just defaults to getName, but if that is not sufficient override it here.
- */
- public String getMementoHandle(Object element)
- {
- IHost conn = (IHost)element;
- return conn.getSystemProfileName() + "." + conn.getAliasName(); //$NON-NLS-1$
- }
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- return ISystemMementoConstants.MEMENTO_KEY_CONNECTION;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDragAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDragAdapter.java
deleted file mode 100644
index ad5640582..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDragAdapter.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [142065] fix drag and drop on Mac OS X
- * Kevin Doyle (IBM) - [187536] Drag & Drop file to Editor launchs file in system editor
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.LazyDownloadJob;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.part.EditorInputTransfer;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.PluginTransferData;
-
-
-/**
- * Drag adapter for dragging objects in the Systems views
- *
- */
-public class SystemViewDataDragAdapter extends DragSourceAdapter
-{
-
-
- ISelectionProvider _selectionProvider;
- private ISelection _selection = null; // set this on dragStart, set to null on dragFinished
- public static final char CONNECTION_DELIMITER = ':';
- public static final char RESOURCE_SEPARATOR = '|';
-
- /**
- * Constructor for drag adapter
- *
- */
- public SystemViewDataDragAdapter(ISelectionProvider provider)
- {
- _selectionProvider = provider;
- }
-
- public void dragFinished(DragSourceEvent event)
- {
- _selection = null; // drag has finished, forget the selection
- if (event.doit == false)
- {
- return;
- }
- }
-
-
- private void serializeObject(Object dragObject, ISystemDragDropAdapter adapter, StringBuffer dataStream)
- {
- // get the subsystem id
- ISubSystem subSystem = null;
- if (dragObject instanceof ISubSystem)
- {
- subSystem = (ISubSystem)dragObject;
- String subSystemId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForSubSystem(subSystem);
- dataStream.append(subSystemId);
- }
- else if (dragObject instanceof IHost)
- {
- IHost connection = (IHost)dragObject;
- String connectionId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForConnection(connection);
- dataStream.append(connectionId);
- }
- else
- {
- subSystem = adapter.getSubSystem(dragObject);
-
- if (subSystem != null)
- {
- String subSystemId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForSubSystem(subSystem);
- dataStream.append(subSystemId);
-
- }
-
- String objectId = adapter.getAbsoluteName(dragObject);
- dataStream.append(":"); //$NON-NLS-1$
- dataStream.append(objectId);
- }
- }
-
- public void dragStart(DragSourceEvent event)
- {
- /*
- * Remember the selection at drag start. This is the only point at which the selection is valid
- * during the drag operations on all platforms.
- */
- _selection = _selectionProvider.getSelection();
- if (_selection instanceof IStructuredSelection)
- {
- IStructuredSelection ss = (IStructuredSelection) _selection;
- Iterator iterator = ss.iterator();
- while (iterator.hasNext())
- {
- Object dragObject = iterator.next();
-
- if (dragObject instanceof IAdaptable)
- {
- ISystemDragDropAdapter adapter = (ISystemDragDropAdapter) ((IAdaptable) dragObject).getAdapter(ISystemDragDropAdapter.class);
- if (adapter == null || !adapter.canDrag(dragObject))
- {
- event.doit = false;
- event.detail = DND.DROP_NONE;
- }
- else
- {
- if (EditorInputTransfer.getInstance().isSupportedType(event.dataType))
- {
- if (adapter instanceof ISystemRemoteElementAdapter)
- {
- if (((ISystemRemoteElementAdapter)adapter).canEdit(dragObject))
- {
- event.doit = true;
- }
- else
- {
- event.doit = false;
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- }
- else
- {
- event.doit = true;
- event.detail = DND.DROP_COPY;
- ////FIXME as per bug [142947], drag under feedback now works differently in SWT
- //event.feedback = DND.FEEDBACK_INSERT_AFTER;
- }
- }
- }
- else
- {
- event.doit = false;
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- }
-
- //event.doit = true;
- }
-
-
- /**
- * Method for determining the source (drag) object(s) and
- * encoding those objects in a byte[]. We encode the profile,
- * connection and subsystem, and then we use ISystemDragDropAdapter.getAbsoluteName()
- * to determine the ID for the object within it's subsystem.
- */
- public void dragSetData(DragSourceEvent event)
- {
-
- /*
- * We cannot request the selection from the selection provider at this point since
- * on some platforms (particularly Mac OS X) the selection is forgotten by the underlying
- * OS control immediately after the drag is started. This call is invoked at the end
- * of the drag operation but just before the corresponding drop call in the drop adapter.
- * Thus, we must remember the selection at drag start.
- */
- if (_selection instanceof IStructuredSelection)
- {
- IStructuredSelection ss = (IStructuredSelection) _selection;
-
- if (PluginTransfer.getInstance().isSupportedType(event.dataType))
- {
- StringBuffer dataStream = new StringBuffer(""); //$NON-NLS-1$
- Iterator iterator = ss.iterator();
- while (iterator.hasNext())
- {
- Object dragObject = iterator.next();
-
- if (dragObject instanceof IAdaptable)
- {
- ISystemDragDropAdapter adapter = (ISystemDragDropAdapter) ((IAdaptable) dragObject).getAdapter(ISystemDragDropAdapter.class);
- if (adapter != null)
- {
- if (adapter.canDrag(dragObject))
- {
- serializeObject(dragObject, adapter, dataStream);
-
- if (iterator.hasNext())
- {
- dataStream.append(RESOURCE_SEPARATOR);
- }
- }
- }
- }
- }
-
- PluginTransferData data = new PluginTransferData("org.eclipse.rse.ui.view.DropActions", dataStream.toString().getBytes()); //$NON-NLS-1$
- event.data = data;
- if (dataStream.length() > 0)
- {
- event.doit = true;
- event.detail = DND.DROP_COPY;
-
- }
- else
- {
- event.doit = false;
- event.detail = DND.ERROR_CANNOT_INIT_DRAG;
- }
- }
- else if (FileTransfer.getInstance().isSupportedType(event.dataType))
- {
- // external drag and drop
- String[] fileNames = new String[ss.size()];
- Iterator iterator = ss.iterator();
- int i = 0;
- while (iterator.hasNext())
- {
- Object dragObject = iterator.next();
- if (dragObject instanceof IAdaptable)
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) dragObject).getAdapter(ISystemViewElementAdapter.class);
- if (adapter.canDrag(dragObject))
- {
- IResource resource = getResource((IAdaptable)dragObject);
- if (resource != null)
- {
- String fileName = resource.getLocation().toOSString();
- fileNames[i] = fileName;
- i++;
- }
- }
- }
- }
- if (i > 0)
- {
- event.data = fileNames;
- }
- }
- else if (TextTransfer.getInstance().isSupportedType(event.dataType))
- {
- String[] texts = new String[ss.size()];
- Iterator iterator = ss.iterator();
- int i = 0;
- while (iterator.hasNext())
- {
- Object dragObject = iterator.next();
- if (dragObject instanceof IAdaptable)
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) dragObject).getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null)
- {
- texts[i] = adapter.getText(dragObject);
- i++;
- }
- }
- }
- if (i > 0)
- {
- event.data = texts;
- }
- }
- else if (EditorInputTransfer.getInstance().isSupportedType(event.dataType))
- {
- EditorInputTransfer.EditorInputData[] inputData = new EditorInputTransfer.EditorInputData[ss.size()];
- Iterator iterator = ss.iterator();
- int i = 0;
-
- IEditorRegistry editRegistry = RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
-
- while (iterator.hasNext())
- {
- Object dragObject = iterator.next();
-
- Object adapterObj = ((IAdaptable)dragObject).getAdapter(ISystemRemoteElementAdapter.class);
- if (adapterObj != null)
- {
- ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter)adapterObj;
- if (adapter.canEdit(dragObject))
- {
- ISystemEditableRemoteObject editable = adapter.getEditableRemoteObject(dragObject);
- if (editable != null)
- {
- try
- {
-
- Shell shell = event.display.getActiveShell();
- if (editable.download(shell))
- {
- editable.addAsListener();
- editable.setLocalResourceProperties();
-
- IFile theFile = editable.getLocalResource();
-
- IEditorDescriptor preferredEditor = editRegistry.getDefaultEditor(theFile.getName()); // may be null
- if (preferredEditor == null || preferredEditor.isOpenExternal())
- {
- preferredEditor = getDefaultTextEditor();
-
- }
-
- FileEditorInput fileInput = new FileEditorInput(theFile);
- inputData[i] = EditorInputTransfer.createEditorInputData(preferredEditor.getId(), fileInput);
- i++;
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- }
- if (i > 0)
- {
- event.data = inputData;
- }
- else
- {
- event.data = new EditorInputTransfer.EditorInputData[0];
- event.detail = DND.DROP_NONE;
- }
- }
- }
- }
-
- protected IEditorRegistry getEditorRegistry()
- {
- return RSEUIPlugin.getDefault().getWorkbench().getEditorRegistry();
- }
-
- protected IEditorDescriptor getDefaultTextEditor()
- {
- IEditorRegistry registry = getEditorRegistry();
- return registry.findEditor("org.eclipse.ui.DefaultTextEditor"); //$NON-NLS-1$
- }
-
- private IResource getResource(IAdaptable dragObject)
- {
- IResource resource = null;
- ISystemViewElementAdapter viewAdapter = (ISystemViewElementAdapter) dragObject.getAdapter(ISystemViewElementAdapter.class);
- ISystemRemoteElementAdapter remoteAdapter = (ISystemRemoteElementAdapter)dragObject.getAdapter(ISystemRemoteElementAdapter.class);
-
- if (remoteAdapter != null)
- {
-
- if (remoteAdapter.canEdit(dragObject))
- {
- ISystemEditableRemoteObject editable = remoteAdapter.getEditableRemoteObject(dragObject);
- // corresponds to a file
- IFile file = editable.getLocalResource();
- if (!file.exists())
- {
- // this is a drag and drop to windows explorer
- // because we're dealing with file paths we need to force this to complete before allowing the drop
- // so instead of doing the job, I'm forcing the transfer on this thread
- LazyDownloadJob job = new LazyDownloadJob(editable);
- job.run(new NullProgressMonitor());
- //job.setPriority(Job.INTERACTIVE);
- //job.schedule();
- }
- resource = file;
- }
- else if (viewAdapter != null)
- {
- if (viewAdapter.hasChildren(dragObject))
- {
- IContainer parentFolder = null;
- // corresponds to a folder
- Object[] children = viewAdapter.getChildren(dragObject, new NullProgressMonitor());
- for (int i = 0; i < children.length; i++)
- {
- IAdaptable child = (IAdaptable)children[i];
- IResource childResource = getResource(child);
- if (childResource != null)
- {
- parentFolder = childResource.getParent();
- if (!parentFolder.exists())
- {
- try
- {
- parentFolder.touch(new NullProgressMonitor());
- }
- catch (Exception e)
- {
-
- }
-
- }
- }
- }
-
-
- resource = parentFolder;
- }
- }
- }
- return resource;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java
deleted file mode 100644
index 3ae32d948..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDataDropAdapter.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [192704] work around drag&drop issues from Project Explorer
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [234924] [ftp][dnd][Refresh] Copy/Paste file from Package Explorer doesn't refresh folder
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.internal.model.SystemScratchpad;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.part.EditorInputTransfer;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.PluginTransferData;
-
-
-/**
- * Drop adapter for dropping objects in the Systems views.
- *
- */
-public class SystemViewDataDropAdapter
-//extends PluginDropAdapter
-extends ViewerDropAdapter
-{
- protected Shell shell;
- protected long hoverStart = 0;
-
- protected static final long hoverThreshold = 1500;
- public static final char CONNECTION_DELIMITER = ':';
- public static final String RESOURCE_SEPARATOR = "|"; //$NON-NLS-1$
-
- protected int _sourceType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE;
- /**
- * Constructor for the drop adapter
- *
- */
- public SystemViewDataDropAdapter(StructuredViewer viewer)
- {
- super(viewer);
- setFeedbackEnabled(true);
- }
-
- /**
- * Method for determining whether the drop target is a valid target.
- * We could do extra validation on the source (drag) object(s), although
- * that could get expensive. The SWT drag and drop framework calls this
- * method.
- *
- */
- public boolean validateDrop(Object target, int operation, TransferData transferType)
- {
- if (target == null)
- {
- target = this.getViewer().getInput();
- }
- if (target instanceof IAdaptable)
- {
- ISystemDragDropAdapter adapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
- if (adapter != null)
- {
- return adapter.canDrop(target);
- }
- }
-
- return false;
- }
-
-
- // DKM - hack to see if project explorer resources can be dropped in RSE
- private boolean isLocalSelectionResources(PluginTransferData transferData)
- {
- byte[] result = transferData.getData();
-
- // get the sources
- String[] tokens = (new String(result)).split("\\"+SystemViewDataDropAdapter.RESOURCE_SEPARATOR); //$NON-NLS-1$
-
- ArrayList srcObjects = new ArrayList();
- for (int i = 0;i < tokens.length; i++)
- {
- String srcStr = tokens[i];
- if (srcStr.equals("org.eclipse.ui.navigator.ProjectExplorer")) //$NON-NLS-1$
- {
- return true;
- }
- }
- return false;
- }
-
- private ArrayList getRSESourceObjects(PluginTransferData transferData)
- {
- byte[] result = transferData.getData();
-
- // get the sources
- //StringTokenizer tokenizer = new StringTokenizer(new String(result), RESOURCE_SEPARATOR);
- String[] tokens = (new String(result)).split("\\"+SystemViewDataDropAdapter.RESOURCE_SEPARATOR); //$NON-NLS-1$
-
-
- ArrayList srcObjects = new ArrayList();
- for (int i = 0;i < tokens.length; i++)
- {
- String srcStr = tokens[i];
-
- {
- Object srcObject = getObjectFor(srcStr);
- srcObjects.add(srcObject);
- }
- }
- return srcObjects;
- }
-
- private ArrayList getSourceObjects(Object data)
- {
- ArrayList srcObjects = new ArrayList();
-
- if (srcObjects.isEmpty())
- {
- if (data instanceof PluginTransferData)
- {
- PluginTransferData transferData = (PluginTransferData) data;
- if (isLocalSelectionResources(transferData))
- {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- Iterator selIt = selection.iterator();
- while (selIt.hasNext())
- {
- srcObjects.add(selIt.next());
- }
- _sourceType = SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE;
- }
- else
- {
- srcObjects = getRSESourceObjects(transferData);
- _sourceType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE;
- }
- }
- // different kind of data
- else if (data instanceof IResource[])
- {
- IResource[] resources = (IResource[]) data;
- for (int i = 0; i < resources.length; i++)
- {
- srcObjects.add(resources[i]);
- }
- _sourceType = SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE;
- }
- else if (data instanceof EditorInputTransfer.EditorInputData[])
- {
- EditorInputTransfer.EditorInputData[] editorInput = (EditorInputTransfer.EditorInputData[])data;
- for (int i = 0; i < editorInput.length; i++)
- {
- IPersistableElement inData = editorInput[i].input.getPersistable();
- if (inData instanceof FileEditorInput){
- IFile file = ((FileEditorInput)inData).getFile();
- srcObjects.add(file);
- }
- }
- _sourceType = SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE;
- }
- else if (data instanceof String[])
- {
- String[] resources = (String[]) data;
- for (int i = 0; i < resources.length; i++)
- {
- String resource = resources[i];
- srcObjects.add(resource);
- }
- _sourceType = SystemDNDTransferRunnable.SRC_TYPE_OS_RESOURCE;
- }
- }
-
- return srcObjects;
- }
-
-
- /**
- * Called by SWT after the drop have been validated to perform the
- * drop transfer.
- *
- */
- public boolean performDrop(Object data)
- {
- boolean ok = true;
-
- ArrayList srcObjects = getSourceObjects(data);
-
- if (srcObjects.size() > 0)
- {
- Object target = getCurrentTarget();
- if (target == null)
- {
- target = getViewer().getInput();
- }
-
- List rulesList = new ArrayList();
- int j = 0;
- for (int i = 0; i < srcObjects.size(); i++)
- {
- if (srcObjects.get(i) instanceof ISchedulingRule)
- {
- rulesList.add(srcObjects.get(i));
- j++;
- }
- /** FIXME - can't be coupled with IRemoteFile
- else if (srcObjects.get(i) instanceof IRemoteFile)
- {
- rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)srcObjects.get(i)));
- j++;
- }
- */
- }
- /*
- if (target instanceof ISchedulingRule)
- {
- rulesList.add(target);
- j++;
- }
- */
- /** FIXME - can't be coupled with IRemoteFile
- else if (target instanceof IRemoteFile)
- {
- rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)target));
- }
-
- else if (target instanceof IAdaptable)
- {
- ISystemDragDropAdapter targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- if (targetAdapter != null)
- {
- ISubSystem targetSubSystem = targetAdapter.getSubSystem(target);
- rulesList.add(targetSubSystem);
- j++;
- }
- }
- */
- MultiRule rule = null;
- ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]);
-
- if (j > 0) rule = new MultiRule(rules);
-
- SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(target, srcObjects, getViewer(), _sourceType);
- // DKM - rules are causing problems at the moment
- runnable.setRule(rule);
-
- if (target instanceof SystemScratchpad)
- {
- runnable.run(new NullProgressMonitor());
- }
- else
- {
- runnable.schedule();
- }
- //ok = runnable.dropOkay();
- ok = true;
- }
- return ok;
- }
-
-
- /**
- * Method for decoding an source object ID to the actual source object.
- * We determine the profile, connection and subsystem, and then
- * we use the SubSystem.getObjectWithKey() method to get at the
- * object.
- *
- */
- private Object getObjectFor(String str)
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- // first extract subsystem id
- int connectionDelim = str.indexOf(":"); //$NON-NLS-1$
- if (connectionDelim == -1) // not subsystem, therefore likely to be a connection
- {
- int profileDelim = str.indexOf("."); //$NON-NLS-1$
- if (profileDelim != -1)
- {
- String profileId = str.substring(0, profileDelim);
- String connectionId = str.substring(profileDelim + 1, str.length());
- ISystemProfile profile = registry.getSystemProfile(profileId);
- return registry.getHost(profile, connectionId);
- }
- }
-
-
- int subsystemDelim = str.indexOf(":", connectionDelim + 1); //$NON-NLS-1$
- if (subsystemDelim == -1) // not remote object, therefore likely to be a subsystem
- {
- return registry.getSubSystem(str);
- }
- else
- {
- String subSystemId = str.substring(0, subsystemDelim);
- String srcKey = str.substring(subsystemDelim + 1, str.length());
-
-
- ISubSystem subSystem = registry.getSubSystem(subSystemId);
- if (subSystem != null)
- {
- Object result = null;
- try
- {
- result = subSystem.getObjectWithAbsoluteName(srcKey);
- }
- catch (SystemMessageException e)
- {
- return e.getSystemMessage();
- }
- catch (Exception e)
- {
- }
- if (result != null)
- {
- return result;
- }
- else
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_FILE_NOTFOUND);
- msg.makeSubstitution(srcKey, subSystem.getHostAliasName());
- return msg;
- }
- }
- else
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_CONNECTION_NOTFOUND);
- msg.makeSubstitution(subSystemId);
- return msg;
- }
- }
- }
-
- protected IRunnableContext getRunnableContext(Shell shell)
- {
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc != null)
- {
- return irc;
- }
- else
- {
- /*
- // for other cases, use statusbar
- IWorkbenchWindow win = RSEUIPlugin.getActiveWorkbenchWindow();
- if (win != null)
- {
- Shell winShell = RSEUIPlugin.getActiveWorkbenchShell();
- if (winShell != null && !winShell.isDisposed() && winShell.isVisible())
- {
- RSEUIPlugin.logInfo("Using active workbench window as runnable context");
- shell = winShell;
- return win;
- }
- else
- {
- win = null;
- }
- }
- */
-
- irc = new ProgressMonitorDialog(shell);
- RSEUIPlugin.getTheSystemRegistryUI().setRunnableContext(shell, irc);
- return irc;
- }
- }
-
- public void dragOver(DropTargetEvent event)
- {
- super.dragOver(event);
- event.feedback &= ~DND.FEEDBACK_EXPAND;
- event.detail = DND.DROP_COPY;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDummyObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDummyObject.java
deleted file mode 100644
index ee61f3752..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewDummyObject.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-/**
- * Sometimes we need to supply a dummy object in our events just to prevent a crash.
- * In these cases, use this.
- */
-public class SystemViewDummyObject
-{
- private static SystemViewDummyObject _instance;
-
- /**
- * Constructor for SystemViewDummyObject.
- */
- public SystemViewDummyObject()
- {
- super();
- }
-
- /**
- * Return the singleton of this
- */
- public static SystemViewDummyObject getInstance()
- {
- if (_instance == null)
- _instance = new SystemViewDummyObject();
- return _instance;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java
deleted file mode 100644
index 611c12d14..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterAdapter.java
+++ /dev/null
@@ -1,593 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David Dykstal (IBM) - [224671] [api] org.eclipse.rse.core API leaks non-API types
- * David Dykstal (IBM) - [226761] fix NPE in team view when expanding items
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import java.util.Arrays;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemModifiableContainer;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.model.SystemChildrenContentsType;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.SubSystemHelpers;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFilterName;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-/**
- * Default Adapter for displaying filter objects in tree views.
- * For some subsystems, these are children of SubSystem objects.
- * This class offers default behaviour but can be subclassed to refine the
- * behaviour. If this is done, you must register your subclass with the
- * platform's adapter manager in your plugin class's startup method.
- */
-public class SystemViewFilterAdapter extends AbstractSystemViewAdapter
-{
-
-
- //private static String translatedFilterString = null;
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
- private SystemComboBoxPropertyDescriptor filterStringsDescriptor;
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given filter object.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- //if (selection.size() != 1)
- // return; // does not make sense adding unique actions per multi-selection
- ISystemFilter filter = (ISystemFilter)selection.getFirstElement();
- if (filter.isTransient())
- return;
- ISubSystemConfiguration ssFactory = SubSystemHelpers.getParentSubSystemConfiguration(filter);
- ssFactory.setConnection(null);
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- IAction[] actions = adapter.getFilterActions(menu, selection, shell, menuGroup, ssFactory, filter);
- if (actions != null)
- {
- for (int idx=0; idx<actions.length; idx++)
- {
- IAction action = actions[idx];
- menu.add(menuGroup, action);
- }
- }
- }
-
- private ISystemFilter getFilter(Object element)
- {
- return (ISystemFilter)element;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- * @return the desired image descriptor
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- ImageDescriptor filterImage = null;
- ISystemFilter filter = getFilter(element);
- if (filter.getProvider() != null) {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) filter.getProvider().getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- filterImage = adapter.getSystemFilterImage(filter);
- }
- }
- if (filterImage == null) {
- filterImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
- }
- return filterImage;
- }
-
- /**
- * Return the label for this object. Calls getName on the filter
- */
- public String getText(Object element)
- {
- return getFilter(element).getName();
- }
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return getFilter(element).getName();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- ISystemFilter filter = getFilter(element);
- if (filter.isTransient())
- {
- return filter.getName();
- }
- else
- {
- return filter.getSystemFilterPoolManager().getName() + "." + filter.getParentFilterPool().getName() + "." + filter.getName(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- ISystemFilter filter = getFilter(element);
- if (filter.isTransient())
- return SystemResources.RESID_PP_FILTER_TYPE_VALUE;
- ISubSystemConfiguration ssParentFactory = SubSystemHelpers.getParentSubSystemConfiguration(filter);
- return ssParentFactory.getTranslatedFilterTypeProperty(filter);
- }
-
- /**
- * Return the parent of this object.
- * This will be either a SubSystem object, or a filter object.
- */
- public Object getParent(Object element)
- {
- ISystemFilter filter = getFilter(element);
- if (filter.isTransient())
- return filter.getSubSystem();
- return filter.getParentFilterContainer();
- }
-
- /**
- * Return the children of this filter.
- * This is a combination of nested filters and resolved filter objects.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- ISystemFilter filter = getFilter(element);
- // transient filters...
- if (filter.isTransient())
- {
- if (filter.isPromptable())
- return checkForEmptyList(processPromptingFilter(filter), element, true);
-
- Object[] children = null;
- String[] filterStrings = filter.getFilterStrings();
- // 50167pc: The following was a problem, as the parent in a SystemFilterSimpleImpl is not
- // to be trusted, since we tend to use the same instance for each connection in the list.
- ISubSystem ss = (ISubSystem)filter.getSubSystem();
- String preSelectName = null;
- try
- {
-// Shell shell = getShell();
- // hack to propogate type filters down from connection in select dialogs...
- ISystemViewInputProvider inputProvider = getInput();
- if ((inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl) &&
- (filterStrings != null) && (filterStrings.length > 0) )
- {
- SystemSelectRemoteObjectAPIProviderImpl ip = (SystemSelectRemoteObjectAPIProviderImpl)inputProvider;
- if (ip.filtersNeedDecoration(element))
- {
- String[] adorned = new String[filterStrings.length];
- for (int idx = 0; idx < filterStrings.length; idx++)
- adorned[idx] = ip.decorateFilterString(element, filterStrings[idx]);
- filterStrings = adorned;
- }
- preSelectName = ip.getPreSelectFilterChild();
- }
- if (filter instanceof ISystemModifiableContainer) {
- ISystemModifiableContainer containingFilter = (ISystemModifiableContainer) filter;
- // get children from cache if the children have been cached
- if (ss.getSubSystemConfiguration().supportsFilterCaching() && !containingFilter.isStale() &&
- containingFilter.hasContents(SystemChildrenContentsType.getInstance())) {
- children = containingFilter.getContents(SystemChildrenContentsType.getInstance());
- }
- // otherwise, get children and then cache
- else {
- children = checkForEmptyList(ss.resolveFilterStrings(filterStrings, monitor), element, true);
-
- if (ss.getSubSystemConfiguration().supportsFilterCaching()) {
- containingFilter.setContents(SystemChildrenContentsType.getInstance(), children);
- }
- }
- }
-
-
- if ((children !=null) && (preSelectName != null))
- {
- Object match = null;
- for (int idx=0; (match==null) && (idx<children.length); idx++)
- {
- Object child = children[idx];
- String objName = SystemAdapterHelpers.getViewAdapter(child, getViewer()).getName(child);
- if ((objName != null) && (objName.equals(preSelectName)))
- match = child;
- }
- //if (match != null) always reset even if it is null
- if (inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl)
- {
- ((SystemSelectRemoteObjectAPIProviderImpl) inputProvider).setPreSelectFilterChildObject(match);
- }
- }
- }
- catch (InterruptedException exc)
- {
- children = getCancelledMessageObject();
- }
- catch (Exception exc)
- {
- children = getFailedMessageObject();
- SystemBasePlugin.logError("Exception resolving filters' strings ",exc); //$NON-NLS-1$
- } // message already issued
-
- return children;
- }
-
- if (filter.isPromptable())
- return checkForEmptyList(null, element, false);
-
- // normal filters...
- //Vector strings = filter.getFilterStringsVector();
- ISystemFilterString[] filterStrings = filter.getSystemFilterStrings();
- ISystemFilter[] filters = filter.getSystemFilters();
- Vector vChildren = new Vector();
-
- // start with nested filters...
- for (int idx=0; idx < filters.length; idx++)
- vChildren.addElement(filters[idx]);
- // continue with resolved filter string objects...
- for (int idx=0; idx < filterStrings.length; idx++)
- {
- vChildren.addElement(filterStrings[idx]);
- }
-
- // convert whole thing to an array...
- Object[] children = new Object[vChildren.size()];
- for (int idx=0; idx<vChildren.size(); idx++)
- children[idx] = vChildren.elementAt(idx);
-
- return children;
- }
-
- /**
- * Processing a prompting filter...
- */
- private Object[] processPromptingFilter(ISystemFilter filter)
- {
- Object[] children = new SystemMessageObject[1];
- ISystemViewInputProvider inputProvider = getInput();
- if ( (inputProvider != null) && (inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl) )
- {
- try
- {
- SystemSelectRemoteObjectAPIProviderImpl ip = (SystemSelectRemoteObjectAPIProviderImpl)inputProvider;
- ISystemFilter newFilter = ip.createFilterByPrompting(filter, getShell());
- if (newFilter == null)
- {
- children = getCancelledMessageObject();
- }
- else // filter string successfully created!
- {
- //SystemFilterSimpleImpl simpleFilter = (SystemFilterSimpleImpl)filter;
- //SubSystem ss = (SubSystem)simpleFilter.getParent();
-
- // return "filter created successfully" message object for this node
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FILTERCREATED),
- ISystemMessageObject.MSGTYPE_OBJECTCREATED,filter);
-
- // select the new filter and expand it
- Viewer v = (Viewer)inputProvider.getViewer();
- if (v instanceof ISystemResourceChangeListener)
- {
- SystemResourceChangeEvent event = new SystemResourceChangeEvent(newFilter, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
- RSEUIPlugin.getTheSystemRegistryUI().postEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers!
- }
- }
- } catch (Exception exc)
- {
- children = getFailedMessageObject();
- SystemBasePlugin.logError("Exception prompting for filter ",exc); //$NON-NLS-1$
- }
- }
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"returning children");
- return children;
- }
-
- /**
- * Return true if this object has children
- */
- public boolean hasChildren(IAdaptable element)
- {
- ISystemFilter filter = getFilter(element);
- if (filter.getFilterStringCount() > 0)
- return true;
- else if (filter.getSystemFilterCount() > 0)
- return true;
- else
- return false;
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
-
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- propertyDescriptorArray = new PropertyDescriptor[3];
- int idx = 0;
-
- // parent filter pool
- propertyDescriptorArray[idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTERPOOL,SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP);
- // parent filter
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTER,SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP);
- // number filter strings
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRINGS_COUNT,SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP);
- }
- return propertyDescriptorArray;
- }
- /**
- * Return our unique property values
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param key the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- protected Object internalGetPropertyValue(Object key)
- {
- String name = (String)key;
- ISystemFilter filter = getFilter(propertySourceInput);
- // following not working yet...
- if (name.equals(ISystemPropertyConstants.P_FILTERSTRINGS))
- {
- String[] filterStrings = filter.getFilterStrings();
- filterStringsDescriptor.setValues(filterStrings);
- if ((filterStrings != null) && (filterStrings.length>0))
- return filterStrings[0];
- else
- return "null"; //$NON-NLS-1$
- }
- else if (name.equals(ISystemPropertyConstants.P_FILTERSTRINGS_COUNT))
- {
- int nbrFilterStrings = filter.getFilterStringCount();
- return Integer.toString(nbrFilterStrings);
- }
- else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTER))
- {
- if (filter.isTransient())
- return getTranslatedNotApplicable();
- ISystemFilter parent = filter.getParentFilter();
- if (parent != null)
- return parent.getName();
- else
- return getTranslatedNotApplicable();
- }
- else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
- {
- if (filter.isTransient())
- return getTranslatedNotApplicable();
- ISystemFilterPool parent = filter.getParentFilterPool();
- if (parent != null)
- return parent.getName();
- else
- return null;
- }
- else
- return null;
- }
-
- // FOR COMMON DELETE ACTIONS
- public boolean showDelete(Object element)
- {
- return !getFilter(element).isTransient();
- }
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element)
- {
- return true;
- }
-
- /**
- * Perform the delete action.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
- {
- ISystemFilter filter = getFilter(element);
- ISystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager();
- fpMgr.deleteSystemFilter(filter);
- return true;
- }
-
- // FOR COMMON RENAME ACTIONS
- public boolean showRename(Object element)
- {
- return !getFilter(element).isTransient();
- }
-
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename popup menu item will be enabled.
- */
- public boolean canRename(Object element)
- {
- return true;
- }
- /**
- * Perform the rename action.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- ISystemFilter filter = getFilter(element);
- ISystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager();
- fpMgr.renameSystemFilter(filter,name);
- return true;
- }
- /**
- * @param element either a filter for a rename action, or a filter pool for a "new" action.
- * @return a validator for verifying the new name is correct.
- */
- public ISystemValidator getNameValidator(Object element) {
- ISystemFilter filter = null;
- ISystemFilterPool pool = null;
- String[] filterNames = null;
- if (element instanceof ISystemFilter) {
- filter = (ISystemFilter) element;
- pool = filter.getParentFilterPool();
- if (pool != null)
- filterNames = pool.getSystemFilterNames();
- else {
- ISystemFilter parentFilter = filter.getParentFilter();
- filterNames = parentFilter.getSystemFilterNames();
- }
- } else {
- pool = (ISystemFilterPool) element;
- filterNames = pool.getSystemFilterNames();
- }
- Vector names = new Vector(filterNames.length);
- names.addAll(Arrays.asList(filterNames));
- ISystemValidator nameValidator = new ValidatorFilterName(filterNames);
- return nameValidator;
- }
-
- /**
- * Parent override.
- * <p>
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * Returns mgrName.poolName.filterName, upperCased
- */
- public String getCanonicalNewName(Object element, String newName)
- {
- ISystemFilter filter = (ISystemFilter)element;
- if (!filter.isTransient())
- {
- String mgrName = filter.getSystemFilterPoolManager().getName();
- return (mgrName + "." + filter.getParentFilterPool().getName() + "." + newName).toUpperCase(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else
- return newName.toUpperCase();
- }
-
- // FOR COMMON REFRESH ACTIONS
- public boolean showRefresh(Object element)
- {
- return !getFilter(element).isTransient();
- }
-
- /**
- * Return true if we should show the refresh action in the popup for the given element.
- */
- public boolean showOpenViewActions(Object element)
- {
- return !getFilter(element).isTransient();
- }
-
- /**
- * Test an object to see if it has an attribute with a particular value.
- * From <code>IActionFilter</code> so the popupMenus extension point can use
- * &lt;filter&gt;, &lt;enablement&gt; or &lt;visibility&gt;.
- * We add support for the following attributes:
- * <ol>
- * <li>"filterType"
- * The value is tested against the non-translated filter type.
- * Not all subsystems support different types of filters.
- * <li>name="showChangeFilterStringsPropertyPage".
- * The value is tested against the call to the
- * subsystem configuration method showChangeFilterStringsPropertyPage(SystemFilter).
- * values should be <code>true</code> or <code>false</code>.
- * </ol>
- * @param target the object whose attribute we are testing
- * @param name the attribute to test.
- * @param value the value to test.
- * @return true if the attribute of the given name can be said to have the given value
- * @see IActionFilter#testAttribute(Object, String, String)
- */
- public boolean testAttribute(Object target, String name, String value) {
- boolean result = false;
- if (name.equalsIgnoreCase("filterType")) { //$NON-NLS-1$
- ISystemFilter filter = getFilter(target);
- String type = filter.getType();
- result = (type != null) && (type.length() > 0) && value.equals(type);
- } else if (name.equalsIgnoreCase("showChangeFilterStringPropertyPage")) { //$NON-NLS-1$
- ISystemFilter filter = getFilter(target);
- ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(filter);
- result = (ssf != null) && ssf.showChangeFilterStringsPropertyPage(filter) && value.equals("true"); //$NON-NLS-1$
- } else {
- result = super.testAttribute(target, name, value);
- }
- return result;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolAdapter.java
deleted file mode 100644
index a967f9acb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolAdapter.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David Dykstal (IBM) - [226761] fix NPE in team view when expanding items
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.SubSystemHelpers;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Adapter for displaying SystemFilterPool objects in tree views.
- * These are the masters, and only shown in work-with for the master.
- * These are children of SubSystemConfiguration objects
- */
-public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter
-{
- protected String translatedType;
- //protected Object parent;
-
- // for reset property support
- //private String original_userId, original_port;
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given subsystem object.
- * Calls the method getActions on the subsystem's factory, and places
- * all action objects returned from the call, into the menu.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- //if (selection.size() != 1)
- // return; // does not make sense adding unique actions per multi-selection
- ISystemFilterPool pool = ((ISystemFilterPool)selection.getFirstElement());
- ISubSystemConfiguration ssFactory = SubSystemHelpers.getParentSubSystemConfiguration(pool);
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- IAction[] actions = adapter.getFilterPoolActions(menu, selection, shell, menuGroup, ssFactory, pool);
- if (actions != null)
- {
- for (int idx=0; idx<actions.length; idx++)
- {
- IAction action = actions[idx];
- menu.add(menuGroup, action);
- }
- }
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- * @return the desired image descriptor
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- ImageDescriptor poolImage = null;
- ISystemFilterPool pool = (ISystemFilterPool) element;
- if (pool.getProvider() != null) {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) pool.getProvider().getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- poolImage = adapter.getSystemFilterPoolImage(pool);
- }
- }
- if (poolImage == null) {
- poolImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
- }
- return poolImage;
- }
-
- /**
- * Return the label for this object. Uses getName() on the filter pool object.
- */
- public String getText(Object element)
- {
- return ((ISystemFilterPool)element).getName();
- }
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return ((ISystemFilterPool)element).getName();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- ISystemFilterPool filterPool = (ISystemFilterPool)element;
- return filterPool.getSystemFilterPoolManager().getName() + "." + filterPool.getName(); //$NON-NLS-1$
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- if (translatedType == null)
- translatedType = SystemViewResources.RESID_PROPERTY_FILTERPOOL_TYPE_VALUE;
- return translatedType;
- }
-
- /**
- * Return the parent of this object. The parent of a filter pool is a subsystem factory,
- * in real life. But to a user, it is a subsystem.
- */
- public Object getParent(Object element)
- {
- ISystemFilterPool fp = (ISystemFilterPool)element;
- // hmm, this will only work if a given factory only has one subsystem object...
- ISubSystemConfiguration ssParentFactory = SubSystemHelpers.getParentSubSystemConfiguration(fp);
- return ssParentFactory.getSubSystems(false)[0];
- }
-
- /**
- * Return the children of this object.
- * For filter pools, this is a list of filters.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- ISystemFilterPool fp = (ISystemFilterPool)element;
- return fp.getSystemFilters();
- }
-
- /**
- * Return true if this object has children. That is, has filters.
- */
- public boolean hasChildren(IAdaptable element)
- {
- ISystemFilterPool fp = (ISystemFilterPool)element;
- return fp.getSystemFilterCount() > 0;
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- propertyDescriptorArray = new PropertyDescriptor[3];
- int idx = 0;
-
- // parent filter pool
- propertyDescriptorArray[idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP);
-
- // parent filter pool's profile
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PROFILE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP);
-
- // Related connection
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_RELATED_CONNECTION, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP);
-
- }
- return propertyDescriptorArray;
- }
- /**
- * Return our unique property values
- */
- protected Object internalGetPropertyValue(Object key)
- {
- String name = (String)key;
- ISystemFilterPool pool = (ISystemFilterPool)propertySourceInput;
- if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
- return pool.getName();
- else if (name.equals(ISystemPropertyConstants.P_PROFILE))
- return pool.getSystemFilterPoolManager().getName();
- else if (name.equals(ISystemPropertyConstants.P_RELATED_CONNECTION))
- return (pool.getOwningParentName()==null) ? getTranslatedNotApplicable() : pool.getOwningParentName();
- else
- return null;
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element)
- {
- ISystemFilterPool fp = (ISystemFilterPool)element;
- return fp.isDeletable();
- }
-
- /**
- * Perform the delete action.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
- {
- ISystemFilterPool fp = (ISystemFilterPool)element;
- ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
- fpMgr.deleteSystemFilterPool(fp);
- return true;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename menu item will be enabled.
- */
- public boolean canRename(Object element)
- {
- if (!canDelete(element))
- return false;
- ISystemFilterPool fp = (ISystemFilterPool)element;
- return !fp.isNonRenamable();
- }
-
- /**
- * Perform the rename action. Assumes uniqueness checking was done already.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- ISystemFilterPool fp = (ISystemFilterPool)element;
- ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
- fpMgr.renameSystemFilterPool(fp,name);
- return true;
- }
- /**
- * Return a validator for verifying the new name is correct.
- */
- public ISystemValidator getNameValidator(Object element) {
- ISystemFilterPool fp = (ISystemFilterPool) element;
- ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager();
- String[] names = mgr.getSystemFilterPoolNames();
- ISystemValidator nameValidator = new ValidatorFilterPoolName(names);
- return nameValidator;
- }
-
- /**
- * Parent override.
- * <p>
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * Returns mgrName.poolName, upperCased
- */
- public String getCanonicalNewName(Object element, String newName)
- {
- String mgrName = ((ISystemFilterPool)element).getSystemFilterPoolManager().getName();
- return (mgrName + "." + newName).toUpperCase(); //$NON-NLS-1$
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolReferenceAdapter.java
deleted file mode 100644
index d6ebd844e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterPoolReferenceAdapter.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Tobias Schwarz (Wind River) - [181394] Include Context in getAbsoluteName() for filter and pool references
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.SubSystemHelpers;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFilterPoolName;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Adapter for displaying SystemFilterPool reference objects in tree views.
- * These are children of SubSystem objects
- */
-public class SystemViewFilterPoolReferenceAdapter
- extends AbstractSystemViewAdapter
-{
- protected String translatedType;
- //protected Object parent;
-
- // for reset property support
- //private String original_userId, original_port;
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given subsystem object.
- * Calls the method getActions on the subsystem's factory, and places
- * all action objects returned from the call, into the menu.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- //if (selection.size() != 1)
- // return; // does not make sense adding unique actions per multi-selection
- Object element = selection.getFirstElement();
- ISystemFilterPool pool = getFilterPool(element);
- ISubSystemConfiguration ssFactory = getSubSystemConfiguration(pool);
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- // Lazy Loading: By default, ISubSystemConfigurationAdapter will
- // only be available after its declaring bundle has been loaded,
- // which usually happens on "connect" of a subsystem. Before that
- // time, dynamically contributed actions will not be available.
- // Implementations that want their dynamic actions to be avaialble
- // earlier need to either declare them by static plugin.xml, or
- // provision for more eager loading of the bundle that declares
- // their adapter.
- IAction[] actions = adapter.getFilterPoolActions(menu, selection, shell, menuGroup, ssFactory, pool);
- if (actions != null) {
- for (int idx = 0; idx < actions.length; idx++) {
- IAction action = actions[idx];
- menu.add(menuGroup, action);
- }
- }
- actions = adapter.getFilterPoolReferenceActions(menu, selection, shell, menuGroup, ssFactory, (ISystemFilterPoolReference) element);
- if (actions != null) {
- // menu.addSeparator();
- for (int idx = 0; idx < actions.length; idx++) {
- IAction action = actions[idx];
- menu.add(menuGroup, action);
- }
- }
- }
- }
-
- private ISubSystemConfiguration getSubSystemConfiguration(ISystemFilterPool pool)
- {
- return SubSystemHelpers.getParentSubSystemConfiguration(pool);
- }
-
- /**
- * <i>Overridden from parent.</i><br>
- * Returns the subsystem that contains this object.
- */
- public ISubSystem getSubSystem(Object element)
- {
- ISystemFilterPoolReference ref = (ISystemFilterPoolReference)element;
- return (ISubSystem)ref.getProvider();
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- ImageDescriptor poolImage = null;
- ISystemFilterPool pool = getFilterPool(element);
- if (pool != null) {
- ISystemFilterPoolManagerProvider provider = pool.getProvider();
- if (provider != null) {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) provider.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- // Lazy Loading: Customized filter pool images will only be
- // available once the bundle that declares the
- // ISubSystemConfigurationAdapter has been activated. Until
- // that time, a default image is shown. Clients who want
- // their customized images be available earlier need to
- // provision for more eager loading of their bundles at the
- // right time (e.g. when expanding the SubSystem node,
- // rather than when connecting).
- poolImage = adapter.getSystemFilterPoolImage(pool);
- }
- }
- }
- if (poolImage == null) {
- poolImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
- }
- return poolImage;
- }
-
- private ISystemFilterPool getFilterPool(Object element)
- {
- ISystemFilterPoolReference ref = (ISystemFilterPoolReference)element;
- ISystemFilterPool pool = ref.getReferencedFilterPool();
- return pool; // get master object
- }
-
- /**
- * @param element the filter pool reference masquerading as an object
- * @return the label for this filter pool reference.
- */
- public String getText(Object element) {
- ISystemFilterPoolReference reference = (ISystemFilterPoolReference) element;
- String result = reference.getName();
- ISystemFilterPool pool = getFilterPool(element);
- if (pool != null) {
- result = pool.getName();
- }
- return result;
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return getFilterPool(element).getName();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- //TODO consider caching the absolute name in the FilterPoolReference to avoid unnecessary String operations - the name won't ever change
- ISystemFilterPoolReference filterPoolRef = (ISystemFilterPoolReference)element;
- ISystemFilterPoolReferenceManagerProvider subSystem = filterPoolRef.getProvider();
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(subSystem);
- String parentAbsoluteName = (adapter != null) ? adapter.getAbsoluteName(subSystem) : ""; //$NON-NLS-1$
- String referenceName = filterPoolRef.getName();
- String managerName = filterPoolRef.getReferencedFilterPoolManagerName();
- String absoluteName = parentAbsoluteName + "." + managerName + "." + referenceName; //$NON-NLS-1$ //$NON-NLS-2$
- return absoluteName;
- }
-
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- if (translatedType == null)
- translatedType = SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE;
- return translatedType;
- }
-
- /**
- * Return the parent of this object
- */
- public Object getParent(Object element)
- {
- ISystemFilterPoolReference fpr = (ISystemFilterPoolReference)element;
- return SubSystemHelpers.getParentSubSystem(fpr);
- }
-
- /**
- * Return the children of this object.
- * For filter pools, this is a list of filters.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)element;
- ISubSystem ss = getSubSystem(element);
- return fpRef.getSystemFilterReferences(ss);
- }
-
- /**
- * Return true if this object has children
- */
- public boolean hasChildren(IAdaptable element) {
- int count = 0;
- ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)element;
- if (fpRef != null) {
- ISystemFilterPool filterPool = fpRef.getReferencedFilterPool();
- if (filterPool != null) {
- count = filterPool.getSystemFilterCount();
- }
- }
- return count > 0;
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- propertyDescriptorArray = new PropertyDescriptor[3];
- int idx = 0;
-
- // parent filter pool
- propertyDescriptorArray[idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP);
-
- // parent filter pool's profile
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PROFILE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP);
-
- // Related connection
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_RELATED_CONNECTION, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP);
- }
- return propertyDescriptorArray;
- }
- /**
- * Return our unique property values
- */
- protected Object internalGetPropertyValue(Object key)
- {
- String name = (String)key;
- //SystemFilterPoolReference ref = getFilterPoolReference(propertySourceInput);
- ISystemFilterPool pool = getFilterPool(propertySourceInput);
- if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
- return pool.getName();
- else if (name.equals(ISystemPropertyConstants.P_PROFILE))
- return pool.getSystemFilterPoolManager().getName();
- else if (name.equals(ISystemPropertyConstants.P_RELATED_CONNECTION))
- return (pool.getOwningParentName()==null) ? getTranslatedNotApplicable() : pool.getOwningParentName();
- else
- return null;
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element)
- {
- ISystemFilterPool fp = getFilterPool(element);
- return fp.isDeletable();
- }
-
- /**
- * Perform the delete action.
- * This physically deletes the filter pool and all references.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
- {
- ISystemFilterPool fp = getFilterPool(element);
- ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
- fpMgr.deleteSystemFilterPool(fp);
- //SubSystemConfiguration ssParentFactory = getSubSystemConfiguration(fp);
- //ssParentFactory.deleteFilterPool(fp);
- return true;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename menu item will be enabled.
- */
- public boolean canRename(Object element)
- {
- if (!canDelete(element))
- return false;
- ISystemFilterPool fp = getFilterPool(element);
- return !fp.isNonRenamable();
- }
-
- /**
- * Perform the rename action. Assumes uniqueness checking was done already.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- ISystemFilterPool fp = getFilterPool(element);
- ISystemFilterPoolManager fpMgr = fp.getSystemFilterPoolManager();
- fpMgr.renameSystemFilterPool(fp,name);
- //SubSystemConfiguration ssParentFactory = getSubSystemConfiguration(fp);
- //ssParentFactory.renameFilterPool(fp,name);
- return true;
- }
- /**
- * Return a validator for verifying the new name is correct.
- */
- public ISystemValidator getNameValidator(Object element) {
- ISystemFilterPool fp = null;
- if (element instanceof ISystemFilterPoolReference) {
- fp = getFilterPool(element);
- } else if (element instanceof ISystemFilterPool) {
- fp = (ISystemFilterPool) element;
- } else {
- throw new IllegalArgumentException();
- }
- ISystemFilterPoolManager mgr = fp.getSystemFilterPoolManager();
- String[] names = mgr.getSystemFilterPoolNames();
- ISystemValidator nameValidator = new ValidatorFilterPoolName(names);
- return nameValidator;
- }
- /**
- * Parent override.
- * <p>
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * Returns mgrName.poolName, upperCased
- */
- public String getCanonicalNewName(Object element, String newName)
- {
- String mgrName = ((ISystemFilterPoolReference)element).getReferencedFilterPoolManagerName();
- return (mgrName + "." + newName).toUpperCase(); //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
-
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * This just defaults to getName, but if that is not sufficient override it here.
- */
- public String getMementoHandle(Object element)
- {
- ISystemFilterPoolReference fpRef = (ISystemFilterPoolReference)element;
- return fpRef.getFullName();
- }
- /**
- * Return what to save to disk to identify this element when it is the input object to a secondary
- * Remote System Explorer perspective.
- */
- public String getInputMementoHandle(Object element)
- {
- Object parent = getParent(element);
- return SystemAdapterHelpers.getViewAdapter(parent, getViewer()).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
- }
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- return ISystemMementoConstants.MEMENTO_KEY_FILTERPOOLREFERENCE;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java
deleted file mode 100644
index 9c3b531a1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java
+++ /dev/null
@@ -1,1049 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
- * Tobias Schwarz (Wind River) - [181394] Include Context in getAbsoluteName() for filter and pool references
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Kevin Doyle (IBM) - [187707] Added separator between New Folder and New File in context menu
- * David McKnight (IBM) - [199566] Remove synchronzied from internalGetChildren
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David McKnight (IBM) - [210563] error messages need to be shown if incurred during filter expansion
- * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
- * David McKnight (IBM) - [232148] Invalid thread access exception from SystemViewFilterReferenceAdapter.internalGetChildren()
- * David McKnight (IBM) - [233494] Show in Table Action should be removed from promptable filters
- * David McKnight (IBM) - [238507] Promptable Filters refreshed after modifying filter strings
- * David McKnight (IBM) - [244824] filter not refreshed if child is "empty list" or system message node
- * David McKnight (IBM) - [249245] not showing inappropriate popup actions for: Refresh, Show In Table, Go Into, etc.
- * David McKnight (IBM) - [254614] Promptable filter's shouldn't require supportsCommands on the subsystem to be false
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterContainerReference;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemResourceSet;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.model.SystemChildrenContentsType;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.model.SystemRemoteResourceSet;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.SubSystemHelpers;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFilterName;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Adapter for displaying SystemFilterReference objects in tree views.
- * These are children of SystemFilterPoolReference and SystemFilterReference objects
- */
-public class SystemViewFilterReferenceAdapter
- extends AbstractSystemViewAdapter
-{
- //private static String translatedFilterString = null;
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
- //private SystemComboBoxPropertyDescriptor filterStringsDescriptor, filtersDescriptor;
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given filter object.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- //if (selection.size() != 1)
- // return; // does not make sense adding unique actions per multi-selection
- ISystemFilter filter = getFilter(selection.getFirstElement());
- ISubSystemConfiguration ssFactory = getSubSystemConfiguration(filter);
- ISubSystem currentSubSystem = getFilterReference(selection.getFirstElement()).getSubSystem();
- IHost currentConnection = currentSubSystem.getHost();
- ssFactory.setConnection(currentConnection);
- ssFactory.setCurrentSelection(selection.toArray());
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- // Lazy Loading: Specialized actions on filters are available only
- // after the bundle that declares the ISubSystemConfigurationAdapter
- // has been loaded, which typically is after connecting. We do not
- // load the bundle here because this code is executed as part of
- // showing a context menu. Subsystems who want their actions to be
- // available earlier need to provide them by static plugin.xml
- // markup or provision for more eager loading of their bundle, e.g.
- // through Platform.getAdapterManager().loadAdapter() at the right
- // time.
- IAction[] actions = adapter.getFilterActions(menu, selection, shell, menuGroup, ssFactory, filter);
- if (actions != null)
- {
- for (int idx = 0; idx < actions.length; idx++) {
- IAction action = actions[idx];
- if (action instanceof SystemNewFilterAction)
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new Separator());
- menu.add(menuGroup, action);
- }
- }
- actions = adapter.getFilterReferenceActions(menu, selection, shell, menuGroup, ssFactory, getFilterReference(selection.getFirstElement()));
- if (actions != null)
- {
- for (int idx = 0; idx < actions.length; idx++) {
- IAction action = actions[idx];
- menu.add(menuGroup, action);
- }
- }
- }
- }
-
- private ISubSystemConfiguration getSubSystemConfiguration(ISystemFilter filter)
- {
- return SubSystemHelpers.getParentSubSystemConfiguration(filter);
- }
-
- /**
- * <i>Overridden from parent.</i><br>
- * Returns the subsystem that contains this object.
- */
- public ISubSystem getSubSystem(Object element)
- {
- if (element instanceof ISystemFilterReference)
- return (ISubSystem) (((ISystemFilterReference) element).getProvider());
- else
- return null;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- //return RSEUIPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_FILTER_ID);
- ImageDescriptor filterImage = null;
- ISystemFilter filter = getFilter(element);
- if (filter.getProvider() != null) // getProvider() returns the subsystem factory
- {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)filter.getProvider().getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- // Lazy Loading: Customized Filter Images will be available only
- // after the bundle that declares the
- // ISubSystemConfigurationAdapter has been loaded. Until that
- // time, a default filter image is used. Extenders who want to
- // see their filter images right away need to provision for
- // eager loading of their bundles at the right time (i.e. when
- // expanding the Subsystem node).
- filterImage = adapter.getSystemFilterImage(filter);
- }
- }
- if (filterImage == null)
- filterImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
- return filterImage;
- }
-
- private ISystemFilterReference getFilterReference(Object element)
- {
- return (ISystemFilterReference) element; // get referenced object
- }
-
- private ISystemFilter getFilter(Object element)
- {
- return getFilterReference(element).getReferencedFilter(); // get master object
- }
-
- /**
- * Return the label for this object. Uses getName() on the filter pool object.
- */
- public String getText(Object element)
- {
- return getFilter(element).getName();
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return getFilter(element).getName();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- //TODO consider caching the absolute name in the FilterReference to avoid unnecessary String operations - the name won't ever change
- ISystemFilterPoolReference filterPoolReference = getFilterReference(element).getParentSystemFilterReferencePool();
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(filterPoolReference);
- String parentAbsoluteName = (adapter != null) ? adapter.getAbsoluteName(filterPoolReference) : ""; //$NON-NLS-1$
- return parentAbsoluteName + "." + getName(element); //$NON-NLS-1$
- }
-
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- ISystemFilter filter = getFilter(element);
- ISubSystemConfiguration ssParentFactory = getSubSystemConfiguration(filter);
- return ssParentFactory.getTranslatedFilterTypeProperty(filter);
- }
-
- /**
- * Return the parent of this object
- */
- public Object getParent(Object element)
- {
- ISystemFilterReference fr = getFilterReference(element);
- ISystemFilterContainerReference parentContainer = fr.getParent();
- // if parent is a filter (eg, we are nested) that is always the parent...
- if (parentContainer instanceof ISystemFilterReference)
- return parentContainer;
- // else parent is a filter pool. The parent will be the pool only if
- // we are in "Show Filter Pools" mode, else it is the subsystem.
- boolean showFPs = SystemPreferencesManager.getShowFilterPools();
- if (showFPs)
- return parentContainer;
- else
- return fr.getProvider();
- //return fr.getParent();
- }
-
- /**
- * Return the children of this object.
- * For filters, this is one or more of:
- * <ul>
- * <li>filters if nested filters supported
- * <li>filter strings if user has elected to show filter strings in his preferences
- * <li>resolved objects for each filter string if user has elected NOT to show filter strings in his preferences
- * </ul>
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- return internalGetChildren(element, monitor);
- }
-
- /**
- * Gets all the children and then passes the children to the subsystem configuration adapter for filtering.
- * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(org.eclipse.rse.ui.view.IContextObject, org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object[] getChildren(IContextObject element, IProgressMonitor monitor) {
- Object[] children = getChildren(element.getModelObject(), monitor);
- ISubSystem subsystem = element.getSubSystem();
- ISubSystemConfiguration configuration = subsystem.getSubSystemConfiguration();
- Object adapter = Platform.getAdapterManager().getAdapter(configuration, ISubSystemConfigurationAdapter.class);
-
- if (adapter instanceof ISubSystemConfigurationAdapter)
- {
- children = ((ISubSystemConfigurationAdapter)adapter).applyViewFilters(element, children);
- }
-
- return children;
- }
-
- /*
- * Returns the children of the specified element. If a monitor is passed in then
- * the context is assumed to be modal and, as such, the modal version of ss.resolveFilterStrings
- * is called rather than the main thread version.
- */
- protected Object[] internalGetChildren(Object element, IProgressMonitor monitor)
- {
- Object[] children = null;
- final ISystemFilterReference fRef = getFilterReference(element);
- ISystemFilter referencedFilter = fRef.getReferencedFilter();
- boolean promptable = referencedFilter.isPromptable();
-
- final ISubSystem ss = fRef.getSubSystem();
- final ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(referencedFilter);
-
- // PROMPTING FILTER?...
- if (promptable)
- {
- final Object[] pchildren = new SystemMessageObject[1];
- final Object pelement = element;
- // promptable's need to be run on the main thread since they display dialogs
- Display.getDefault().syncExec(new Runnable()
- {
-
- public void run()
- {
- try
- {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
-
- ISystemFilter newFilter = adapter.createFilterByPrompting(ssf, fRef, getShell());
- if (newFilter == null)
- {
- pchildren[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED), ISystemMessageObject.MSGTYPE_CANCEL, pelement);
- }
- else // filter successfully created!
- {
- // return "filter created successfully" message object for this node
- pchildren[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FILTERCREATED), ISystemMessageObject.MSGTYPE_OBJECTCREATED, pelement);
- // select the new filter reference...
- ISystemFilterReference sfr = fRef.getParentSystemFilterReferencePool().getExistingSystemFilterReference(ss, newFilter);
- ISystemViewInputProvider inputProvider = getInput();
- if ((sfr != null) && (inputProvider != null) && (inputProvider.getViewer() != null))
- {
- SystemResourceChangeEvent event = new SystemResourceChangeEvent(sfr, ISystemResourceChangeEvents.EVENT_SELECT_EXPAND, null);
- Viewer v = (Viewer)inputProvider.getViewer();
- if (v instanceof ISystemResourceChangeListener)
- {
- //sr.fireEvent((ISystemResourceChangeListener)v, event); // only expand in the current viewer, not all viewers!
- RSEUIPlugin.getTheSystemRegistryUI().postEvent((ISystemResourceChangeListener) v, event); // only expand in the current viewer, not all viewers!
- }
- }
- }
- }
- catch (Exception exc)
- {
- pchildren[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED), ISystemMessageObject.MSGTYPE_ERROR, pelement);
- SystemBasePlugin.logError("Exception prompting for filter ", exc); //$NON-NLS-1$
- }
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"returning children");
- }
- });
- return pchildren;
- }
-
- // NON-PROMPTING FILTER?...
- Object[] nestedFilterReferences = fRef.getSystemFilterReferences(ss);
- int nbrFilterStrings = referencedFilter.getFilterStringCount();
- if (nbrFilterStrings == 0)
- return nestedFilterReferences;
- else
- {
- /*
- // show filter strings
- if (ssf.showFilterStrings())
- {
- SystemFilterStringReference[] refFilterStrings = fRef.getSystemFilterStringReferences();
- if ((nestedFilterReferences == null) || (nestedFilterReferences.length == 0))
- return refFilterStrings;
- if ((refFilterStrings == null) || (refFilterStrings.length == 0))
- return nestedFilterReferences;
- int nbrChildren = nestedFilterReferences.length + refFilterStrings.length;
- children = new Object[nbrChildren];
- int idx=0;
- for (idx=0; idx<nestedFilterReferences.length; idx++)
- children[idx] = nestedFilterReferences[idx];
- for (int jdx=0; jdx<refFilterStrings.length; jdx++)
- children[idx++] = refFilterStrings[jdx];
- return children;
- }
- // resolve filter strings
- else
- */ {
- String[] filterStrings = referencedFilter.getFilterStrings();
-
- try
- {
-
- // hack to propogate type filters down from connection in select dialogs...
- ISystemViewInputProvider inputProvider = getInput();
- if ((inputProvider != null) && (inputProvider instanceof SystemSelectRemoteObjectAPIProviderImpl) &&
- (filterStrings != null) && (filterStrings.length > 0))
- {
- SystemSelectRemoteObjectAPIProviderImpl ip = (SystemSelectRemoteObjectAPIProviderImpl) inputProvider;
- if (ip.filtersNeedDecoration(element))
- {
- String[] adorned = new String[filterStrings.length];
- for (int idx = 0; idx < filterStrings.length; idx++)
- adorned[idx] = ip.decorateFilterString(element, filterStrings[idx]);
- filterStrings = adorned;
- }
- }
-
- boolean doQuery = true;
- if (!referencedFilter.isTransient() &&
- ssf.supportsFilterCaching() &&
- !fRef.isStale() &&
- fRef.hasContents(SystemChildrenContentsType.getInstance()))
- {
- doQuery = false;
- children = fRef.getContents(SystemChildrenContentsType.getInstance());
- if (children != null)
- {
- if (children.length == 0){
- doQuery = true;
- fRef.markStale(true);
- }
- else {
- // check for stale children
- for (int i = 0; i < children.length && !doQuery; i++)
- {
- Object child = children[i];
- if (child instanceof ISystemContainer)
- {
- if (((ISystemContainer)child).isStale())
- {
- doQuery = true;
- fRef.markStale(true);
- }
- }
- else if (child instanceof ISystemMessageObject){
- if (((ISystemMessageObject)child).isTransient()){
- doQuery = true;
- fRef.markStale(true);
- }
- }
- }
- }
- }
- }
- if (doQuery)
- {
- Object[] allChildren = null;
-
- if (monitor == null)
- {
- allChildren = ss.resolveFilterStrings(filterStrings, new NullProgressMonitor());
- }
- else
- {
- allChildren = ss.resolveFilterStrings(filterStrings, monitor);
- }
-
- if (allChildren == null)
- {
- // System.out.println("filter children == null!"); //$NON-NLS-1$
- }
- else
- {
- if (allChildren.length == 1 && allChildren[0] instanceof ISystemMessageObject)
- {
- // error to display
- return allChildren; // nothing to sort or cache - just show the error
- }
-
- if (nestedFilterReferences != null)
- {
- int nbrNestedFilters = nestedFilterReferences.length;
- children = new Object[nbrNestedFilters + allChildren.length];
- int idx = 0;
- for (idx = 0; idx < nbrNestedFilters; idx++)
- children[idx] = nestedFilterReferences[idx];
- for (int jdx = 0; jdx < allChildren.length; jdx++)
- children[idx++] = allChildren[jdx];
-
-
- if (!referencedFilter.isTransient() && ssf.supportsFilterCaching())
- {
- fRef.setContents(SystemChildrenContentsType.getInstance(), children);
- }
- }
- }
- }
-
- }
- catch (InterruptedException exc)
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED), ISystemMessageObject.MSGTYPE_CANCEL, element);
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), "Filter resolving cancelled by user."); //$NON-NLS-1$
- }
- catch (Exception exc)
- {
- children = new SystemMessageObject[1];
- children[0] = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED), ISystemMessageObject.MSGTYPE_ERROR, element);
- SystemBasePlugin.logError("Exception resolving filters' strings ", exc); //$NON-NLS-1$
- } // message already issued
-
- return checkForEmptyList(children, element, true);
- }
- }
- }
-
- /**
- * Return true if this object has children.
- * That is, if the referenced filter has nested filters or filter strings.
- */
- public boolean hasChildren(IAdaptable element)
- {
- ISystemFilterReference fRef = getFilterReference(element);
- ISystemFilter referencedFilter = fRef.getReferencedFilter();
-
- ISubSystemConfiguration factory = getSubSystemConfiguration(referencedFilter);
- if (factory.supportsFilterChildren())
- {
- int nbrNestedFilters = referencedFilter.getSystemFilterCount();
- int nbrFilterStrings = referencedFilter.getFilterStringCount();
- return (nbrNestedFilters > 0) || (nbrFilterStrings > 0);
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Return true if this object is a "prompting" object that prompts the user when expanded.
- * For such objects, we do not try to save and restore their expansion state on F5 or between
- * sessions.
- * <p>
- * Default is false unless this is a prompting filter
- */
- public boolean isPromptable(Object element)
- {
- boolean promptable = false;
- ISystemFilter filter = getFilter(element);
- promptable = filter.isPromptable();
- //if (!promptable && !SystemPreferencesManager.getPreferencesManager().getShowFilterStrings())
- if (!promptable)
- {
- //if (isCommandFilter(filter) || isJobFilter(filter))
- if (isCommandFilter(filter))
- promptable = true;
- }
- return promptable;
- }
-
- /**
- * <i>Overide of parent method.</i><br>
- * From <samp>IActionFilter</samp> so the popupMenus extension point can use &lt;filter&gt;, &lt;enablement&gt;
- * or &lt;visibility&gt;. We add support is for the following:
- * <ol>
- * <li>name="filterType". The value is tested against the non-translated filter type. Note all subsystems
- * support different types of filters.
- * <li>name="showChangeFilterStringsPropertyPage". The value is tested against the call to the subsystem factory method showChangeFilterStringsPropertyPage(SystemFilter).
- * Compares against "true" (default) or "false".
- * </ol>
- */
- public boolean testAttribute(Object target, String name, String value)
- {
- if (name.equalsIgnoreCase("filterType")) //$NON-NLS-1$
- {
- ISystemFilterReference ref = getFilterReference(target);
- String type = ref.getReferencedFilter().getType();
- if ((type == null) || (type.length() == 0))
- return false;
- else
- return value.equals(type);
- }
- else if (name.equalsIgnoreCase("showChangeFilterStringPropertyPage")) //$NON-NLS-1$
- {
- ISystemFilterReference ref = getFilterReference(target);
- ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(ref.getReferencedFilter());
- if (value.equals("true")) //$NON-NLS-1$
- return ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter());
- else
- return !ssf.showChangeFilterStringsPropertyPage(ref.getReferencedFilter());
- }
- else
- return super.testAttribute(target, name, value);
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- int nbrOfProperties = 4;
- propertyDescriptorArray = new PropertyDescriptor[nbrOfProperties];
- int idx = 0;
- // parent filter pool
- propertyDescriptorArray[idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTERPOOL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP);
- // parent filter
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTER, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP);
- // number filter strings
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRINGS_COUNT, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL, SystemViewResources.RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP);
- // Related connection
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_CONNECTION_PRIVATE, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP);
- }
- return propertyDescriptorArray;
- }
- /**
- * Return our unique property values
- */
- protected Object internalGetPropertyValue(Object key)
- {
- String name = (String) key;
- ISystemFilter filter = getFilter(propertySourceInput);
- if (name.equals(ISystemPropertyConstants.P_FILTERSTRINGS_COUNT))
- {
- int nbrFilterStrings = filter.getFilterStringCount();
- return Integer.toString(nbrFilterStrings);
- }
- else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTER))
- {
- ISystemFilter parent = filter.getParentFilter();
- if (parent != null)
- return parent.getName();
- else
- return getTranslatedNotApplicable();
- }
- else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
- {
- ISystemFilterPool parent = filter.getParentFilterPool();
- if (parent != null)
- return parent.getName();
- else
- return getTranslatedNotApplicable();
- }
- else if (name.equals(ISystemPropertyConstants.P_IS_CONNECTION_PRIVATE))
- {
- ISystemFilterPool parent = filter.getParentFilterPool();
- return (parent.getOwningParentName()==null) ? getTranslatedNo() : getTranslatedYes();
- }
- else
- return null;
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element)
- {
- ISystemFilter filter = getFilter(element);
- return !filter.isNonDeletable(); // defect 43190
- //return true;
- }
-
- /**
- * Perform the delete action.
- * This physically deletes the filter pool and all references.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
- {
- ISystemFilter filter = getFilter(element);
- ISystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager();
- fpMgr.deleteSystemFilter(filter);
- return true;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename menu item will be enabled.
- */
- public boolean canRename(Object element)
- {
- ISystemFilter filter = getFilter(element);
- return !filter.isNonRenamable(); // defect 43190
- //return true;
- }
-
- /**
- * Perform the rename action. Assumes uniqueness checking was done already.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- ISystemFilter filter = getFilter(element);
- ISystemFilterPoolManager fpMgr = filter.getSystemFilterPoolManager();
- fpMgr.renameSystemFilter(filter, name);
- return true;
- }
-
- /**
- * Return a validator for verifying the new name is correct.
- * @param element either a filter for a rename action, or a filter pool for a "new" action.
- */
- public ISystemValidator getNameValidator(Object element) {
- ISystemFilter filter = null;
- ISystemFilterPool pool = null;
- String[] filterNames = null;
- if (element instanceof ISystemFilterReference) {
- filter = getFilter(element);
- pool = filter.getParentFilterPool();
- if (pool != null)
- filterNames = pool.getSystemFilterNames();
- else {
- ISystemFilter parentFilter = filter.getParentFilter();
- filterNames = parentFilter.getSystemFilterNames();
- }
- } else if (element instanceof ISystemFilter) {
- filter = (ISystemFilter) element;
- pool = filter.getParentFilterPool();
- if (pool != null)
- filterNames = pool.getSystemFilterNames();
- else {
- ISystemFilter parentFilter = filter.getParentFilter();
- filterNames = parentFilter.getSystemFilterNames();
- }
- } else {
- pool = (ISystemFilterPool) element;
- filterNames = pool.getSystemFilterNames();
- }
- ISystemValidator nameValidator = new ValidatorFilterName(filterNames);
- return nameValidator;
- }
-
- /**
- * Parent override.
- * <p>
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * Returns mgrName.poolName.filterName, upperCased
- */
- public String getCanonicalNewName(Object element, String newName)
- {
- ISystemFilterReference fRef = (ISystemFilterReference) element;
- ISystemFilter filter = fRef.getReferencedFilter();
- String mgrName = filter.getSystemFilterPoolManager().getName();
- return (mgrName + "." + filter.getParentFilterPool().getName() + "." + newName).toUpperCase(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Don't show "Open in new perspective" if this is promptable
- */
- public boolean showOpenViewActions(Object element)
- {
- ISystemFilter filter = getFilter(element);
- ISubSystemConfiguration ssParentFactory = getSubSystemConfiguration(filter);
- return !filter.isPromptable() && !ssParentFactory.supportsCommands();
- }
-
-
- /**
- * Don't show generic "Show in Table" if the factory asks not to
- */
- public boolean showGenericShowInTableAction(Object element)
- {
- ISystemFilter filter = getFilter(element);
- ISubSystemConfiguration ssParentFactory = getSubSystemConfiguration(filter);
- return ssParentFactory.showGenericShowInTableOnFilter() && !filter.isPromptable() && !ssParentFactory.supportsCommands();
- }
-
- /**
- * Return true if we should show the refresh action in the popup for the element.
- */
- public boolean showRefresh(Object element)
- {
- ISystemFilter filter = getFilter(element);
- ISubSystemConfiguration ssParentFactory = getSubSystemConfiguration(filter);
- return ssParentFactory.showRefreshOnFilter() && !filter.isPromptable() && !ssParentFactory.supportsCommands();
- }
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
-
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * This just defaults to getName, but if that is not sufficient override it here.
- */
- public String getMementoHandle(Object element)
- {
- ISystemFilterReference fRef = getFilterReference(element);
- ISystemFilter referencedFilter = fRef.getReferencedFilter();
- ISystemFilterPool pool = referencedFilter.getParentFilterPool();
- String handle = pool.getReferenceName() + "="; //$NON-NLS-1$
- ISystemFilter parentFilter = referencedFilter.getParentFilter();
- while (parentFilter != null)
- {
- handle += parentFilter.getName() + ";"; //$NON-NLS-1$
- parentFilter = parentFilter.getParentFilter();
- }
- handle += referencedFilter.getName();
- return handle;
- }
- /**
- * Return what to save to disk to identify this element when it is the input object to a secondary
- * Remote System Explorer perspective.
- */
- public String getInputMementoHandle(Object element)
- {
- Object parent = ((ISystemFilterReference) element).getParent(); //getParent(element); // will be filter (nested) or filter pool
- ISystemViewElementAdapter parentAdapter = SystemAdapterHelpers.getViewAdapter(parent, getViewer());
- boolean showFPs = SystemPreferencesManager.getShowFilterPools();
- if (parent instanceof ISystemFilterPoolReference) // not a nested filter
- {
- if (!showFPs) // not showing the real parent in GUI?
- {
- parent = parentAdapter.getParent(parent); // get the subsystem parent of the filter pool reference
- parentAdapter = SystemAdapterHelpers.getViewAdapter(parent, getViewer()); // get the adapter for the subsystem parent
- }
- }
- return parentAdapter.getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
- }
-
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- return ISystemMementoConstants.MEMENTO_KEY_FILTERREFERENCE;
- }
-
- /**
- * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
- * messages. In these cases return false from this method. The default is true.
- * <p>
- * WE RETURN FALSE IF THIS IS A PROMPTABLE FILTER, COMMAND FILTER OR JOB FILTER.
- */
- public boolean saveExpansionState(Object element)
- {
- boolean savable = true;
- ISystemFilterReference fRef = getFilterReference(element);
- ISystemFilter referencedFilter = fRef.getReferencedFilter();
- boolean promptable = referencedFilter.isPromptable();
- if (promptable)
- savable = false;
- else
- {
- // I thought the types would be set for these filters, but it isn't! Phil.
- /*
- String type = referencedFilter.getType();
- if ((type!=null) && (type.equals("Command") || type.equals("Job")))
- savable = false;
- */
- if (isCommandFilter(referencedFilter))
- savable = false;
- }
- return savable;
- }
-
- /**
- * Return true if the given filter is from a command subsystem
- */
- public static boolean isCommandFilter(ISystemFilter filter)
- {
- ISubSystemConfiguration ssf = (ISubSystemConfiguration) filter.getProvider();
- return ssf.supportsCommands();
- }
-
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION...
- // ------------------------------------------
- /**
- * drag support is handled directly for filter references, rather than delegated here.
- */
- public boolean canDrag(Object element)
- {
- ISystemFilterReference fRef = getFilterReference(element);
- if (fRef != null)
- {
- if (getSubSystemConfiguration(fRef.getReferencedFilter()).supportsFilterStringExport())
- {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Can this object be added as part of the filter?
- */
- public boolean canDrop(Object element)
- {
- ISystemFilterReference fRef = getFilterReference(element);
- if (fRef != null)
- {
- ISubSystemConfiguration factory = getSubSystemConfiguration(fRef.getReferencedFilter());
- if (factory.supportsDropInFilters())
- {
- // if the drop is handled by the subsystem rather than this adapter, this will be true.
- if (factory.providesCustomDropInFilters())
- {
- return true;
- }
-
- if (!fRef.getReferencedFilter().isNonChangable())
- {
- if (factory.supportsMultiStringFilters())
- {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor)
- {
- return set;
- }
-
- /**
- * drag support is handled directory for filter references, rather than delegated here.
- */
- public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
- {
- return element;
- }
-
- /**
- * Add the absolute name of the from object to the list of filter strings for this filter
- */
- public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
- {
- if (sameSystemType)
- {
- ISystemFilterReference fRef = getFilterReference(to);
- ISystemFilter filter = fRef.getReferencedFilter();
-
- if (from instanceof ISystemFilterReference)
- {
- ISystemFilter srcFilter = ((ISystemFilterReference) from).getReferencedFilter();
- String[] filterStrings = srcFilter.getFilterStrings();
- for (int i = 0; i < filterStrings.length; i++)
- {
- filter.addFilterString(filterStrings[i]);
- }
- return fRef;
- }
- else if (from instanceof IAdaptable)
- {
- ISystemRemoteElementAdapter radapter = (ISystemRemoteElementAdapter) ((IAdaptable) from).getAdapter(ISystemRemoteElementAdapter.class);
-
- {
-
- String newFilterStr = radapter.getFilterStringFor(from);
- if (newFilterStr != null)
- {
- filter.addFilterString(newFilterStr);
- return fRef;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Validate that the source and target for the drag and drop operation are
- * compatable.
- */
- public boolean validateDrop(Object src, Object target, boolean sameSystem)
- {
- if (!sameSystem)
- {
- if (src instanceof IResource)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- if (target instanceof ISystemFilterReference)
- {
- ISystemFilterReference filterRef = (ISystemFilterReference) target;
- if (getSubSystemConfiguration(filterRef.getReferencedFilter()).supportsMultiStringFilters())
- {
- if (src instanceof ISystemFilterReference)
- {
- // yantzi: wswb2.1.2 (defect 50994) add check for filter types
- String srcType = ((ISystemFilterReference)src).getReferencedFilter().getType();
- String targetType = filterRef.getReferencedFilter().getType();
- if (targetType != null && srcType != null)
- {
- if (targetType.equals(srcType))
- {
- return true;
- }
- }
- else
- {
- return true;
- }
- }
- // check if src has a filter string
- else if (src instanceof IAdaptable)
- {
- ISystemRemoteElementAdapter adapter = (ISystemRemoteElementAdapter) ((IAdaptable) src).getAdapter(ISystemRemoteElementAdapter.class);
- if (adapter != null)
- {
- if (adapter.getFilterStringFor(src) != null)
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
-
- /*
- * Return whether deferred queries are supported.
- * Defer to the subsystem configuration.
- */
- public boolean supportsDeferredQueries(ISubSystem subSys)
- {
- return subSys.getSubSystemConfiguration().supportsDeferredQueries();
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterStringAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterStringAdapter.java
deleted file mode 100644
index d6b170e2d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterStringAdapter.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David Dykstal (IBM) - [226761] fix NPE in team view when expanding items
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Default Adapter for displaying filter string objects in tree views.
- */
-public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter
-{
- //private static String translatedFilterString = null;
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given filter object.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- //if (selection.size() != 1)
- // return; // does not make sense adding unique actions per multi-selection
- ISystemFilterString filterString = getFilterString(selection.getFirstElement());
- if (filterString.getParentSystemFilter().isTransient())
- return;
- }
-
- private ISystemFilterString getFilterString(Object element)
- {
- return (ISystemFilterString)element;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- * @return the desired image descriptor
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- ImageDescriptor filterImage = null;
- ISystemFilterString filterString = getFilterString(element);
- if (filterString.getProvider() != null) {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) filterString.getProvider().getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- filterImage = adapter.getSystemFilterStringImage(filterString);
- }
- }
- if (filterImage == null) {
- filterImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERSTRING_ID);
- }
- return filterImage;
- }
-
- /**
- * Return the label for this object. Calls getName on the filter
- */
- public String getText(Object element)
- {
- return getFilterString(element).getString();
- }
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return getFilterString(element).getString();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- ISystemFilterString filterString = getFilterString(element);
- ISystemFilter filter = filterString.getParentSystemFilter();
- return filter.getSystemFilterPoolManager().getName() + "." + filter.getParentFilterPool().getName() + "." + filter.getName() + "." + filterString.getString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- //SystemFilterString filterString = getFilterString(element);
- //if (filterString.getParentSystemFilter().isTransient())
- return SystemResources.RESID_PP_FILTERSTRING_TYPE_VALUE;
- //SubSystemConfiguration ssParentFactory = SubSystemHelpers.getParentSubSystemConfiguration(filterString.getParentSystemFilter());
- //return ssParentFactory.getTranslatedFilterStringTypeProperty(filterString);
- }
-
- /**
- * Return the parent of this object.
- * This will be either a SubSystem object, or a filter object.
- */
- public Object getParent(Object element)
- {
- ISystemFilterString filterString = getFilterString(element);
- return filterString.getParentSystemFilter();
- }
-
- /**
- * Return the children of this filter.
- * This returns an empty list.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- return null;
- }
-
-
- /**
- * Return true if this object has children. We return false;
- */
- public boolean hasChildren(IAdaptable element)
- {
- return false;
- }
-
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- propertyDescriptorArray = new PropertyDescriptor[3];
- // parent filter pool
- propertyDescriptorArray[0] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTERPOOL,SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP);
- // parent filter
- propertyDescriptorArray[1] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_PARENT_FILTER,SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_LABEL, SystemViewResources.RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP);
- // filter string
- propertyDescriptorArray[2] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_FILTERSTRING,SystemViewResources.RESID_PROPERTY_FILTERSTRING_LABEL, SystemViewResources.RESID_PROPERTY_FILTERSTRING_TOOLTIP);
- }
- return propertyDescriptorArray;
- }
- /**
- * Returns the current value for the named property.
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param key the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- protected Object internalGetPropertyValue(Object key)
- {
- String name = (String)key;
- ISystemFilterString filterString = getFilterString(propertySourceInput);
-
- if (name.equals(ISystemPropertyConstants.P_FILTERSTRING))
- {
- return filterString.getString();
- }
- else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTER))
- {
- return filterString.getParentSystemFilter().getName();
- }
- else if (name.equals(ISystemPropertyConstants.P_PARENT_FILTERPOOL))
- {
- if (filterString.getParentSystemFilter().isTransient())
- return getTranslatedNotApplicable();
- ISystemFilterPool parent = filterString.getParentSystemFilter().getParentFilterPool();
- if (parent != null)
- return parent.getName();
- else
- return null;
- }
- else
- return null;
- }
-
- // FOR COMMON DELETE ACTIONS
- public boolean showDelete(Object element)
- {
- return !getFilterString(element).getParentSystemFilter().isTransient();
- }
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element)
- {
- return true;
- }
-
- /**
- * Perform the delete action.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception {
- ISystemFilterString filterString = getFilterString(element);
- ISystemFilter filter = filterString.getParentSystemFilter();
- ISystemFilterPoolManager fpMgr = filterString.getSystemFilterPoolManager();
- String[] oldStrings = filter.getFilterStrings();
- List workingStrings = new ArrayList(oldStrings.length);
- for (int i = 0; i < oldStrings.length; i++) {
- String oldString = oldStrings[i];
- if (!filterString.equals(oldStrings[i])) {
- workingStrings.add(oldString);
- }
- }
- String[] newStrings = new String[workingStrings.size()];
- workingStrings.toArray(newStrings);
- fpMgr.updateSystemFilter(filter, filter.getName(), newStrings);
- return true;
- }
-
- // FOR COMMON RENAME ACTIONS
- public boolean showRename(Object element)
- {
- //return !getFilterString(element).getParentSystemFilter().isTransient();
- return false;
- }
-
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename popup menu item will be enabled.
- */
- public boolean canRename(Object element)
- {
- return false; //true;
- }
- /**
- * Perform the rename action.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- return true;
- }
-
- // FOR COMMON REFRESH ACTIONS
- public boolean showRefresh(Object element)
- {
- return false;
- }
-
- /**
- * Return true if we should show the refresh action in the popup for the given element.
- */
- public boolean showOpenViewActions(Object element)
- {
- return false;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewForm.java
deleted file mode 100644
index 09d9ab559..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewForm.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Kevin Doyle (IBM) - [187553] - Removed code and related methods for toolbar/button bar.
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [187711] select SystemView APIs exposed by the ISystemTree interface
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-package org.eclipse.rse.internal.ui.view;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.view.ISystemLongRunningRequestListener;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.SystemLongRunningRequestEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-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.Item;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-
-/**
- * This re-usable widget is for a single widget that displays a
- * toolbar underneath which is a systems view tree.
- */
-public class SystemViewForm extends Composite implements ISystemTree
-{
- private ToolBar toolbar = null;
- private ToolBarManager toolbarMgr = null;
- private Button refreshButton, getListButton;
- private SystemView tree = null;
- private ISystemMessageLine msgLine = null;
- private boolean showActions = true;
- private boolean deferLoading = false;
- private boolean requestInProgress = false;
- private ISystemViewInputProvider inputProvider = null;
- private ISystemViewInputProvider emptyProvider = new SystemEmptyListAPIProviderImpl();
- private Vector requestListeners = null;
- public static final int DEFAULT_WIDTH = 300;
- public static final int DEFAULT_HEIGHT = 300;
-
- // the following allows us to identify dialog/wizard hosting this widget so we can
- // disable it's close capability while a remote request is in place.
- protected Object caller;
- protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog;
-
- // viewer filters
- protected ViewerFilter[] initViewerFilters = null;
-
- /**
- * Constructor
- * @param shell The owning window
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically SWT.NULL
- * @param inputProvider Who is supplying the roots for the system viewer?
- * @param singleSelectionMode Are users allowed to select multiple things at once?
- * @param msgLine where to show messages and tooltip text
- */
- public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider,
- boolean singleSelectionMode, ISystemMessageLine msgLine)
- {
- this(shell, parent, style, inputProvider, singleSelectionMode, msgLine, 1, 1);
- }
- /**
- * Constructor when you want to span more than one column or row
- * @param shell The owning window
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically SWT.NULL
- * @param inputProvider Who is supplying the roots for the system viewer?
- * @param singleSelectionMode Are users allowed to select multiple things at once?
- * @param msgLine where to show messages and tooltip text
- * @param horizontalSpan how many columns in parent composite to span
- * @param verticalSpan how many rows in parent composite to span
- */
- public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider,
- boolean singleSelectionMode, ISystemMessageLine msgLine,
- int horizontalSpan, int verticalSpan)
- {
- this(shell, parent, style, inputProvider, singleSelectionMode, msgLine, horizontalSpan, verticalSpan, null);
- }
-
- /**
- * Constructor when you want to span more than one column or row
- * @param shell The owning window
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically SWT.NULL
- * @param inputProvider Who is supplying the roots for the system viewer?
- * @param singleSelectionMode Are users allowed to select multiple things at once?
- * @param msgLine where to show messages and tooltip text
- * @param horizontalSpan how many columns in parent composite to span
- * @param verticalSpan how many rows in parent composite to span
- * @param initViewerFilters the initial viewer filters to apply.
- */
- public SystemViewForm(Shell shell, Composite parent, int style, ISystemViewInputProvider inputProvider,
- boolean singleSelectionMode, ISystemMessageLine msgLine,
- int horizontalSpan, int verticalSpan, ViewerFilter[] initViewerFilters)
- {
- super(parent, style);
- this.inputProvider = inputProvider;
- this.msgLine = msgLine;
- callerInstanceOfWizardPage = (caller instanceof WizardPage);
- callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
- prepareComposite(1, horizontalSpan, verticalSpan);
-
- // set viewer filters
- this.initViewerFilters = initViewerFilters;
-
- createSystemView(shell, inputProvider, singleSelectionMode);
-
- }
-
- /**
- * Return the toolbar widget manager
- */
- public ToolBarManager getToolBarManager()
- {
- return toolbarMgr;
- }
- /**
- * Return the system view tree viewer
- */
- public ISystemTree getSystemTree()
- {
- return tree;
- }
- /**
- * Return the system view tree viewer tree widget
- */
- public Tree getTreeControl()
- {
- return tree.getTree();
- }
-
- /**
- * Set the tree's tooltip text
- */
- public void setToolTipText(String tip)
- {
- tree.getTree().setToolTipText(tip);
- }
-
- /**
- * Refresh contents
- */
- public void refresh()
- {
- tree.refreshAll();
- }
-
- /**
- * Reset contents
- */
- public void reset(ISystemViewInputProvider inputProvider)
- {
- this.inputProvider = inputProvider;
- if (deferLoading)
- {
- tree.setSelection(null);
- tree.setInputProvider(emptyProvider);
- }
- else
- {
- tree.setSelection(null);
- tree.setInputProvider(inputProvider);
- }
- }
-
- /*
- * Turn off right-click actions
- *
- NOW SET VIA INPUT PROVIDER METHODS
- public void setShowActions(boolean show)
- {
- this.showActions = show;
- if (tree != null)
- tree.setShowActions(show);
- }*/
-
- /**
- * Disable/Enable all the child controls.
- */
- public void setEnabled(boolean enabled)
- {
- if (toolbar != null)
- toolbar.setEnabled(enabled);
- tree.setEnabled(enabled);
- //if ((tree != null) && (tree.getTree() != null))
- // tree.getTree().setEnabled(enabled);
- //super.setEnabled(enabled);
- }
- /**
- * Register a listener interested in an item is selected in the system view
- * @see #removeSelectionChangedListener(ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- tree.addSelectionChangedListener(listener);
- }
- /**
- * Remove a previously set system view selection listener.
- * @see #addSelectionChangedListener(ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- tree.removeSelectionChangedListener(listener);
- }
- /**
- * Add a listener that is informed when a remote list request starts and stops.
- * This allows for the listener to do things like disable the Close button
- */
- public void addListRequestListener(ISystemLongRunningRequestListener listener)
- {
- if (requestListeners == null)
- requestListeners = new Vector();
- requestListeners.addElement(listener);
- }
- /**
- * Add a listener that is informed when a remote list request starts and stops.
- * This allows for the listener to do things like disable the Close button
- */
- public void removeListRequestListener(ISystemLongRunningRequestListener listener)
- {
- if (requestListeners != null)
- requestListeners.removeElement(listener);
- }
-
- /**
- * Return the selection of the tree viewer
- */
- public ISelection getSelection()
- {
- return tree.getSelection();
- }
-
-
- // --------------------------------------------
- // ISystemTree methods to facilitate our GUI...
- // ... all these are delegated to the SystemView tree
- // --------------------------------------------
- /**
- * Returns true if any of the selected items are currently expanded
- */
- public boolean areAnySelectedItemsExpanded()
- {
- return tree.areAnySelectedItemsExpanded();
- }
- /**
- * Returns true if any of the selected items are expandable but not yet expanded
- */
- public boolean areAnySelectedItemsExpandable()
- {
- return tree.areAnySelectedItemsExpandable();
- }
- /**
- * This is called to ensure all elements in a multiple-selection have the same parent in the
- * tree viewer. If they don't we automatically disable all actions.
- * <p>
- * Designed to be as fast as possible by going directly to the SWT widgets
- */
- public boolean sameParent()
- {
- return tree.sameParent();
- }
- /**
- * This is called to accurately get the parent object for the current selection
- * for this viewer.
- * <p>
- * The getParent() method in the adapter is very unreliable... adapters can't be sure
- * of the context which can change via filtering and view options.
- */
- public Object getSelectedParent()
- {
- return tree.getSelectedParent();
- }
- /**
- * This returns the element immediately before the first selected element in this tree level.
- * Often needed for enablement decisions for move up actions.
- */
- public Object getPreviousElement()
- {
- return tree.getPreviousElement();
- }
- /**
- * This returns the element immediately after the last selected element in this tree level
- * Often needed for enablement decisions for move down actions.
- */
- public Object getNextElement()
- {
- return tree.getNextElement();
- }
-
- /**
- * This is called to walk the tree back up to the roots and return the visible root
- * node for the first selected object.
- */
- public Object getRootParent()
- {
- return tree.getRootParent();
- }
- /**
- * This returns an array containing each element in the tree, up to but not including the root.
- * The array is in reverse order, starting at the leaf and going up.
- */
- public Object[] getElementNodes(Object element)
- {
- return tree.getElementNodes(element);
- }
- /**
- * Helper method to determine if a given object is currently selected.
- * Does consider if a child node of the given object is currently selected.
- */
- public boolean isSelectedOrChildSelected(Object parentElement)
- {
- return tree.isSelectedOrChildSelected(parentElement);
- }
-
- /**
- * Return the number of immediate children in the tree, for the given tree node
- */
- public int getChildCount(Object element)
- {
- return tree.getChildCount(element);
- }
-
- /**
- * Called when a property is updated and we need to inform the Property Sheet viewer.
- * There is no formal mechanism for this so we simulate a selection changed event as
- * this is the only event the property sheet listens for.
- */
- public void updatePropertySheet()
- {
- tree.updatePropertySheet();
- }
-
- /**
- * Called to select an object within the tree, and optionally expand it
- */
- public void select(Object element, boolean expand)
- {
- tree.select(element, expand);
- }
-
- /**
- * Returns the tree item of the first selected object. Used for setViewerItem in a resource
- * change event.
- */
- public Item getViewerItem()
- {
- return tree.getViewerItem();
- }
-
- /**
- * Returns true if it is ok to close the dialog or wizard page. Returns false if there
- * is a remote request currently in progress.
- */
- public boolean okToClose()
- {
- return !requestInProgress; //d43433
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
- /**
- * Prepares this composite control and sets the default layout data.
- * @param Number of columns the new group will contain.
- */
- protected Composite prepareComposite(int numColumns,
- int horizontalSpan, int verticalSpan)
- {
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- data.widthHint = DEFAULT_WIDTH;
- data.heightHint = DEFAULT_HEIGHT;
- data.horizontalSpan = horizontalSpan;
- data.verticalSpan = verticalSpan;
- composite.setLayoutData(data);
- return composite;
- }
-
- protected void createSystemView(Shell shell, ISystemViewInputProvider inputProvider, boolean singleSelectionMode)
- {
- // TREE
- int style = (singleSelectionMode ? SWT.SINGLE : SWT.MULTI) | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
- tree = new SystemView(shell, this, style, deferLoading ? emptyProvider : inputProvider, msgLine, initViewerFilters);
- GridData treeData = new GridData();
- treeData.horizontalAlignment = GridData.FILL;
- treeData.verticalAlignment = GridData.FILL;
- treeData.grabExcessHorizontalSpace = true;
- treeData.grabExcessVerticalSpace = true;
- treeData.widthHint = 300;
- treeData.heightHint= 200;
- tree.getTree().setLayoutData(treeData);
- tree.setShowActions(showActions);
- }
-
- protected void addOurMouseListener()
- {
- MouseListener mouseListener = new MouseAdapter()
- {
- public void mouseDown(MouseEvent e)
- {
- //requestActivation();
- }
- };
- toolbar.addMouseListener(mouseListener);
- }
-
- /**
- * Fire long running request listener event
- */
- protected void fireRequestStartEvent()
- {
- if (requestListeners != null)
- {
- SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent();
- for (int idx=0; idx<requestListeners.size(); idx++)
- ((ISystemLongRunningRequestListener)requestListeners.elementAt(idx)).startingLongRunningRequest(event);
- }
- }
-
- /**
- * Fire long running request listener event
- */
- protected void fireRequestStopEvent()
- {
- if (requestListeners != null)
- {
- SystemLongRunningRequestEvent event = new SystemLongRunningRequestEvent();
- for (int idx=0; idx<requestListeners.size(); idx++)
- ((ISystemLongRunningRequestListener)requestListeners.elementAt(idx)).endingLongRunningRequest(event);
- }
- }
-
-
-
- /**
- * wrapper method to satisfy the ISystemTree interface
- */
- public void createTreeItems(TreeItem widget, Object[] children)
- {
- tree.createTreeItems(widget, children);
- }
-
- /**
- * wrapper method to satisfy the ISystemTree interface
- */
- public List findAllRemoteItemReferences(Object element,
- Object elementObject, List matches) {
- return tree.findAllRemoteItemReferences(element, elementObject, matches);
- }
-
- /**
- * wrapper method to satisfy the ISystemTree interface
- */
- public Item findFirstRemoteItemReference(Object remoteObject,
- Item parentItem) {
- return tree.findFirstRemoteItemReference(remoteObject, parentItem);
- }
-
- /**
- * wrapper method to satisfy the ISystemTree interface
- */
- public Tree getTree() {
- return tree.getTree();
- }
-
- /**
- * wrapper method to satisfy the ISystemTree interface
- */
- public ISystemFilterReference revealAndExpand(ISubSystem parentSubSystem,
- ISystemFilter filter) {
- return tree.revealAndExpand(parentSubSystem, filter);
- }
- public void addDoubleClickListener(IDoubleClickListener listener) {
- tree.addDoubleClickListener(listener);
- }
- public void addFilter(ViewerFilter filter) {
- tree.addFilter(filter);
-
- }
- public void expandTo(Object parentObject, Object remoteObject) {
- tree.expandTo(parentObject, remoteObject);
-
- }
- public void expandTo(String filterString) {
- tree.expandTo(filterString);
-
- }
- public boolean isExpandable(Object elementOrTreePath) {
- return tree.isExpandable(elementOrTreePath);
- }
- public void setAutoExpandLevel(int level) {
- tree.setAutoExpandLevel(level);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewLabelAndContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewLabelAndContentProvider.java
deleted file mode 100644
index e54897537..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewLabelAndContentProvider.java
+++ /dev/null
@@ -1,498 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Martin Oberhuber (Wind River) - [197550] Fix NPE when refreshing Pending items
- * David McKnight (IBM) - [236505] Remote systems dialog not working
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-
-import java.util.Hashtable;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.RSEImageMap;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.operations.SystemDeferredTreeContentManager;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.PendingUpdateAdapter;
-
-
-/**
- * Provides tree contents for objects that have the ISystemViewElement
- * adapter registered. Also provides label contents, so can be used for
- * both a content and label provider for TreeViewers.
- * <p>
- * This has a general flavor, which is used in most cases, and also has
- * a specialized flavor for universal file systems, which allows restricting
- * the list to files only or folders only. It also allows further subsetting by
- * setting an input filter or filter string.
- */
-public class SystemViewLabelAndContentProvider extends LabelProvider
- implements ITreeContentProvider, ILabelProvider, ITableLabelProvider
- // ,IResourceChangeListener
-{
- private static final Object[] NO_OBJECTS = new Object[0];
-
- protected Viewer viewer;
- private boolean filesOnly, foldersOnly;
- private String filterString = null;
- private Hashtable resolvedChildrenPerFolder = null; // local cache to improve performance
- private boolean _enableDeferredQueries = true;
- private SystemDeferredTreeContentManager manager;
-
- /**
- * Constructor
- */
- public SystemViewLabelAndContentProvider()
- {
- // System.out.println("inside ctor for LCProvider " + this);
- }
- /**
- * Constructor to restrict to remote folders or files
- */
- public SystemViewLabelAndContentProvider(boolean foldersOnly, boolean filesOnly)
- {
- this();
- this.foldersOnly = foldersOnly;
- this.filesOnly = filesOnly;
- }
- /**
- * Set a filter string to subset the list by. For example, "A*.java" or "java,class,"
- * Only valid if filesOnly or foldersOnly mode. If the latter, its recorded and used
- * the next time files are requested from any folder.
- */
- public void setFilterString(String filterString)
- {
- this.filterString = filterString;
-
- flushCache();
- }
- /**
- * Get the current filter string being used to subset the list by.
- * Will be null unless setFilterString has previously been called.
- */
- public String getFilterString()
- {
- return filterString;
- }
-
-
-
- /**
- * Flush the in-memory cache which remembers the result of the last
- * getChildren request when we are in files-only or folders-only
- * mode. Only applies when the two-boolean constructor is used.
- */
- public void flushCache()
- {
- resolvedChildrenPerFolder = null;
- }
-
- /**
- * Return the current viewer we are associated with
- */
- public Viewer getViewer()
- {
- return viewer;
- }
-
- /**
- * The visual part that is using this content provider is about
- * to be disposed. Deallocate all allocated SWT resources.
- */
- public void dispose()
- {
- // AS LONG AS WE DON'T SUPPORT IWORKSPACE OBJECT THIS IS NOT NEEDED.
- // WE LEAVE IT IN BECAUSE IT IS HARMLESS AND MIGHT BE OF VALUE SOMEDAY.
- if (viewer != null)
- {
- Object obj = viewer.getInput();
- if (obj != null)
- {
- if (obj instanceof IWorkspace)
- {
- //IWorkspace workspace = (IWorkspace) obj;
- //workspace.removeResourceChangeListener(this);
- }
- else if (obj instanceof IContainer)
- {
- //IWorkspace workspace = ((IContainer) obj).getWorkspace();
- //workspace.removeResourceChangeListener(this);
- }
- }
- }
- }
-
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- if (o instanceof IContextObject)
- {
- o = ((IContextObject)o).getModelObject();
- }
- ISystemViewElementAdapter adapter = null;
- if (o == null)
- {
- SystemBasePlugin.logWarning("ERROR: null passed to getAdapter in SystemViewLabelAndContentProvider"); //$NON-NLS-1$
- }
- else
- {
- if (o instanceof IAdaptable)
- {
- adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
- }
- else
- {
- adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class);
- }
- if (adapter == null)
- {
- if (!(o instanceof PendingUpdateAdapter))
- {
- SystemBasePlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName()); //$NON-NLS-1$
- }
- }
- }
- if ((adapter!=null) && (viewer != null))
- {
- Shell shell = null;
- if (viewer instanceof ISystemShellProvider)
- shell = ((ISystemShellProvider)viewer).getShell();
- else
- shell = viewer.getControl().getShell();
- adapter.setShell(shell);
- //System.out.println("Inside getAdapter for LCProvider "+this+", setting viewer of adapter to "+viewer);
- adapter.setViewer(viewer);
- if (viewer.getInput() instanceof ISystemViewInputProvider)
- {
- ISystemViewInputProvider inputProvider = (ISystemViewInputProvider)viewer.getInput();
- //inputProvider.setShell(shell); this is now done in the getInput() method of viewer.
- adapter.setInput(inputProvider);
- }
- }
- else if (viewer == null)
- SystemBasePlugin.logWarning("VIEWER IS NULL FOR SYSTEMVIEWLABELANDCONTENTPROVIDER"); //$NON-NLS-1$
- return adapter;
- }
-
- /**
- * Cancel any jobs that are fetching content from the given location.
- * @param location
- */
- public void cancelJobs(Object location)
- {
- if (manager != null) {
- manager.cancel(location);
- }
- }
-
- protected boolean supportsDeferredQueries()
- {
- //IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
- //return store.getBoolean(ISystemPreferencesConstants.USE_DEFERRED_QUERIES);
- //return true; // DKM now enforcing deferred queries
- return _enableDeferredQueries;
- }
-
- public void setEnableDeferredQueries(boolean enable)
- {
- _enableDeferredQueries = enable;
- }
-
-
- /**
- * @see ITreeContentProvider
- */
- public Object[] getChildren(Object object)
- {
- Object element = object;
- if (object instanceof IContextObject)
- {
- element = ((IContextObject)object).getModelObject();
- }
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (supportsDeferredQueries())
- {
- // The adapter needs to be checked to be not null, otherwise
- // we run into an NPE here.
- if (manager != null && adapter != null)
- {
- ISubSystem ss = null;
- if (object instanceof IContextObject)
- {
- ss = ((IContextObject)object).getSubSystem();
- }
- else
- {
- ss = adapter.getSubSystem(object);
- }
- if (ss != null && adapter.supportsDeferredQueries(ss))
- {
- // if (ss.isConnected())
- {
-
- Object[] children = manager.getChildren(object, getViewer());
- if (children != null)
- {
- // This will be a placeholder to indicate
- // that the real children are being fetched
- return children;
- }
- }
- }
- }
- }
-
-
- //System.out.println("inside getChildren for landcProvider");
- //System.out.println("...element = " + element);
- //System.out.println("...adapter = " + adapter);
- if (adapter != null)
- {
- // we first test to see if this is an expand-to filter in effect for this
- // object, and if so use it...
- if ((viewer instanceof SystemView) && (((SystemView)viewer).getSystemViewPart() != null) &&
- (adapter instanceof ISystemRemoteElementAdapter))
- {
- String expandToFilter = ((SystemView)viewer).getExpandToFilter(element);
- if (expandToFilter != null)
- return adapter.getChildrenUsingExpandToFilter(element, expandToFilter);
- }
- Object[] children = null;
- // The re-usable Eclipse GUI widgets are not very efficient.
- // The are always re-asking for children, which for remote requests
- // causes a lot of flashing and unnecessary trips to the host.
- // To overcome this, once we successfully resolve a request,
- // we remember the result so on the subsequent request for the
- // same files or folders, we can return that remembered cache.
- // The tricky part is what to key each request by. We use the element
- // as the key ... this is the parent folder which children are being
- // asked for. However, for the same folder we will be asked for
- // folders and files in separate requests. It turns out this is not
- // not a problem though, because a separate instance of us is used
- // for files versus folders so each maintains its own cache.
-
- if ((filesOnly || foldersOnly) && (resolvedChildrenPerFolder != null))
- {
- children = (Object[])resolvedChildrenPerFolder.get(element);
- if (children != null) // found cached list?
- return children; // return it to caller
- }
-
- if (object instanceof IContextObject)
- {
- children = adapter.getChildren((IContextObject)object, new NullProgressMonitor());
- }
- else
- {
- children = adapter.getChildren((IAdaptable)object, new NullProgressMonitor());
- }
-
-
- if ((filesOnly || foldersOnly) &&
- // an array of one SystemMessageObject item implies some kind of error, so don't cache...
- ((children.length != 1) || !(children[0] instanceof SystemMessageObject)) )
- {
- if (resolvedChildrenPerFolder == null)
- resolvedChildrenPerFolder = new Hashtable();
- resolvedChildrenPerFolder.put(element, children);
- }
-
- return children;
- }
- return NO_OBJECTS;
- }
- /**
- * @see ITreeContentProvider
- */
- public Object[] getElements(Object element)
- {
- return getChildren(element);
- }
- /**
- * @see ITreeContentProvider
- */
- public Object getParent(Object element)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter != null)
- return adapter.getParent(element);
- return null;
- }
- /**
- * hasChildren method comment.
- * This method has been optimized over its original code so
- * that we don't actually retrieve all the children (horrors!)
- * just to decide if it has children. For performance reasons we
- * just assume if it can have children it does. That means we always
- * get a plus but that is way better than a very slow remote
- * system query just to decide if we want a plus or not!
- */
- public boolean hasChildren(Object element)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter!=null) {
- if (element instanceof IContextObject)
- {
- return adapter.hasChildren((IContextObject)element);
- }
- else
- {
- return adapter.hasChildren((IAdaptable)element);
- }
- }
- else
- {
- if (element instanceof IContextObject) {
- element = ((IContextObject)element).getModelObject();
- }
- if (manager != null && manager.isDeferredAdapter(element)) {
- return manager.mayHaveChildren(element);
- }
- }
- return false;
- }
-
- /**
- * inputChanged method comment.
- * AS LONG AS WE DON'T SUPPORT IWORKSPACE OBJECT THIS IS NOT NEEDED.
- * WE LEAVE IT IN BECAUSE IT IS HARMLESS AND MIGHT BE OF VALUE SOMEDAY.
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- //System.out.println("Inside LCProvider "+this+". viewer = " + viewer);
- this.viewer = viewer;
- if (newInput instanceof IWorkspace)
- {
- //IWorkspace workspace = (IWorkspace)newInput;
- //workspace.addResourceChangeListener(this);
- }
- else if (newInput instanceof IContainer)
- {
- //IWorkspace workspace = ((IContainer)newInput).getWorkspace();
- //workspace.addResourceChangeListener(this);
- }
- if (viewer instanceof AbstractTreeViewer)
- {
- manager = new SystemDeferredTreeContentManager(this, (AbstractTreeViewer) viewer);
- }
- }
-
- public Image getColumnImage(Object element, int columnIndex)
- {
- return getImage(element);
- }
- public String getColumnText(Object element, int columnIndex)
- {
- return getText(element);
- }
- public Image getImage(Object element)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- //System.out.println("Inside getImage. element = " + element + ", adapter = " + adapter);
- if (adapter == null)
- return null;
-
- ImageDescriptor descriptor = adapter.getImageDescriptor(element);
-
- if (descriptor == null)
- return null;
-
- //add any annotations to the image descriptor
- descriptor = decorateImage(descriptor, element);
- //obtain the cached image corresponding to the descriptor
- Image image = RSEImageMap.get(descriptor);
- if (image == null)
- {
- image = descriptor.createImage();
- RSEImageMap.put(descriptor, image);
- }
-
- return image;
- }
- /**
- * Returns the label text for the given object.
- */
- public String getText(Object element)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- //System.out.println("INSIDE GETTEXT FOR SVLandCprovider: " + element + ", adapter = " + adapter);
- if (adapter == null)
- {
- IWorkbenchAdapter wadapter = (IWorkbenchAdapter)((IAdaptable) element).getAdapter(IWorkbenchAdapter.class);
-
- if (wadapter == null)
- {
- return super.getText(element);
- }
- return wadapter.getLabel(element);
- }
- //return the decorated label (FROM WorkbenchLabelProvider)
- return decorateText(adapter.getText(element), element);
- }
-
- /**
- * Returns an image descriptor that is based on the given descriptor,
- * but decorated with additional information relating to the state
- * of the provided object.
- *
- * Subclasses may reimplement this method to decorate an object's
- * image.
- * @see org.eclipse.jface.resource.ImageDescriptor
- */
- protected ImageDescriptor decorateImage(ImageDescriptor input, Object element)
- {
- return input;
- }
- /**
- * Returns a label that is based on the given label,
- * but decorated with additional information relating to the state
- * of the provided object.
- *
- * Subclasses may implement this method to decorate an object's
- * label.
- */
- protected String decorateText(String input, Object element)
- {
- return input;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMenuListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMenuListener.java
deleted file mode 100644
index fb4a2ce7c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMenuListener.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.actions.ISystemViewMenuListener;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.events.ArmEvent;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Widget;
-
-
-/**
- * A class that listens for menu show events for the purpose of applying mnemonics
- * to the menu items.
- */
-public class SystemViewMenuListener
-implements ISystemViewMenuListener
-{
-
-
- protected boolean menuListenerAdded = false;
- protected boolean menuMnemonicsAdded = false;
- protected boolean doOnce = false;
- protected boolean armListeners = false;
- protected Mnemonics m = new Mnemonics();
- protected ISystemMessageLine msgLine;
-
- /**
- * Default constructor
- */
- public SystemViewMenuListener()
- {
- }
- /**
- * Constructor for a persistent menu (vs a popup that's fresh each time)
- */
- public SystemViewMenuListener(boolean doOnce)
- {
- this.doOnce = doOnce;
- }
- /**
- * Enable tooltip text for the menu items too?
- * Requires a message line to display the text on.
- */
- public void setShowToolTipText(boolean set, ISystemMessageLine msgLine)
- {
- this.armListeners = set;
- this.msgLine = msgLine;
- }
-
- // ---------------------
- // IMenuListener methods
- // ---------------------
- /**
- * Called when the context menu is about to open.
- */
- public void menuAboutToShow(IMenuManager menu)
- {
- if (!menuListenerAdded)
- {
- if (menu instanceof MenuManager)
- {
- Menu m = ((MenuManager)menu).getMenu();
- if (m != null)
- {
- menuListenerAdded = true;
- m.addMenuListener(this);
- }
- }
- }
- }
-
- // --------------------
- // MenuListener methods
- // --------------------
- /**
- * Menu hidden
- */
- public void menuHidden(MenuEvent event)
- {
-
- }
- /**
- * Menu shown
- */
- public void menuShown(MenuEvent event)
- {
- if (!menuMnemonicsAdded || !doOnce)
- {
- m.clear();
- Menu menu = (Menu)event.getSource();
- m.setMnemonics(menu);
- if (armListeners) {
- setArmListener(menu);
- }
- menuMnemonicsAdded = true;
- if (doOnce)
- ((Menu)event.getSource()).removeMenuListener(this);
- }
- }
-
- private void setArmListener(Menu menu) {
- MenuItem[] items = menu.getItems();
- for (int i = 0; i < items.length; i++) {
- MenuItem menuItem = items[i];
- setArmListener(menuItem);
- }
- }
-
- private void setArmListener(MenuItem item) {
- item.addArmListener(this);
- Menu menu = item.getMenu();
- if (menu != null) {
- setArmListener(menu);
- }
- }
-
- // --------------------
- // ArmListener methods
- // --------------------
- /**
- * Menu item is currently selected by user. Try to show tooltip text.
- */
- public void widgetArmed(ArmEvent event)
- {
- if (msgLine == null)
- return;
- msgLine.clearMessage();
- Widget w = event.widget;
- //System.out.println("inside widgetArmed. w = "+w.getClass().getName());
- if (w instanceof MenuItem)
- {
- MenuItem mi = (MenuItem)w;
- Object data = mi.getData();
- //System.out.println("... data = "+data+", msgLine null? "+(msgLine==null));
- if (data != null)
- {
- String tip = null; //data.getClass().getName();
- if (data instanceof ActionContributionItem)
- tip = ((ActionContributionItem)data).getAction().getToolTipText();
- else if (data instanceof SystemSubMenuManager)
- tip = ((SystemSubMenuManager)data).getToolTipText();
- if (tip != null)
- msgLine.setMessage(tip);
- }
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMessageAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMessageAdapter.java
deleted file mode 100644
index ddcf5cdc9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewMessageAdapter.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-
-
-/**
- * Adapter for displaying temporary message objects when an expand fails or is cancelled.
- * <p>
- */
-public class SystemViewMessageAdapter
- extends AbstractSystemViewAdapter
-{
-
- /**
- * Add actions to context menu.
- * We don't add any for message objects, at this point.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- ISystemMessageObject msg = (ISystemMessageObject)element;
- int type = msg.getType();
- if (type==ISystemMessageObject.MSGTYPE_ERROR)
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_ERROR_ID);
- else if (type==ISystemMessageObject.MSGTYPE_CANCEL)
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_INFO_TREE_ID);
- // DY: icon vetoed by UCD
- // return RSEUIPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_CANCEL_ID);
- else if (type==ISystemMessageObject.MSGTYPE_EMPTY)
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EMPTY_ID);
- else if (type==ISystemMessageObject.MSGTYPE_OBJECTCREATED)
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_OK_ID);
- else
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_INFO_TREE_ID);
- }
-
- /**
- * Return the label for this object. Uses getMessage() on the given ISystemMessageObject object.
- */
- public String getText(Object element)
- {
- ISystemMessageObject msg = (ISystemMessageObject)element;
- return msg.getMessage();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- return getText(element);
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- return SystemViewResources.RESID_PROPERTY_MESSAGE_TYPE_VALUE;
- }
-
- /**
- * Return the parent of this object.
- */
- public Object getParent(Object element)
- {
- ISystemMessageObject msg = (ISystemMessageObject)element;
- return msg.getParent();
- }
-
- /**
- * Return the children of this object. Not applicable for us.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- return null;
- }
-
- /**
- * Return true if this object has children. Always false for us.
- */
- public boolean hasChildren(IAdaptable element)
- {
- return false;
- }
- /**
- * Return our unique property descriptors
- */
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
-
- return null;
- }
- /**
- * Return our unique property values
- */
- public Object internalGetPropertyValue(Object key)
- {
- return null;
- }
- /**
- * Don't show delete
- */
- public boolean showDelete(Object element)
- {
- return false;
- }
-
- /**
- * Don't show rename
- */
- public boolean showRename(Object element)
- {
- return false;
- }
-
- /**
- * Don't show refresh
- */
- public boolean showRefresh(Object element)
- {
- return false;
- }
-
- /**
- * Don't show "Open in new perspective"
- */
- public boolean showOpenViewActions(Object element)
- {
- return false;
- }
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
-
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * This just defaults to getName, but if that is not sufficient override it here.
- */
- public String getMementoHandle(Object element)
- {
- return getName(element);
- }
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- return "Msg"; //$NON-NLS-1$
- }
-
- /**
- * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
- * messages. In these cases return false from this method. The default is true.
- * <p>
- * WE RETURN FALSE.
- */
- public boolean saveExpansionState(Object element)
- {
- return false;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewNewConnectionPromptAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewNewConnectionPromptAdapter.java
deleted file mode 100644
index 8b84716ce..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewNewConnectionPromptAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemRunAction;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Adapter class for new connection prompt objects.
- */
-public class SystemViewNewConnectionPromptAdapter extends SystemViewPromptableAdapter {
-
- /**
- * @see org.eclipse.rse.internal.ui.view.SystemViewPromptableAdapter#getRunAction(org.eclipse.swt.widgets.Shell)
- */
- protected SystemRunAction getRunAction(Shell shell) {
- return (new SystemRunAction(SystemResources.ACTION_NEWCONN_LABEL, SystemResources.ACTION_NEWCONN_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTION_ID), shell));
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java
deleted file mode 100644
index 73791babd..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java
+++ /dev/null
@@ -1,2053 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Kevin Doyle (IBM) - [180875] - Added double click listener that handles opening of files
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - Replace SystemRegistry by ISystemRegistry
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [185552] Remove remoteSystemsViewPreferencesActions extension point
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- * Martin Oberhuber (Wind River) - [190195] Cannot enable new connection prompt in system view
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David Dykstal (IBM) - [191311] enable global properties action
- * Martin Oberhuber (Wind River) - [196936] Hide disabled system types
- * Martin Oberhuber (Wind River) - [197025] Wait for model complete before restoring initial state
- * Martin Oberhuber (Wind River) - [197025][197167] Improved wait for model complete
- * David McKnight (IBM) - [199424] restoring memento state asynchronously
- * David McKnight (IBM) - [187711] Link with Editor handled by extension
- * David Dykstal (IBM) - [226728] NPE during init with clean workspace
- * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
- * David Dykstal (IBM) - [216858] Need the ability to Import/Export RSE connections for sharing
- * Kevin Doyle (IBM) - [186769] Enable Contributions to Drop Down menu of Remote Systems view -> Preferences
- * David McKnight (IBM) - [244807] System view does not handle restore from cache
- * Li Ding (IBM) - [256135] Subsystem not restored in system view tree if subsystem configuration does not support filter
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemPreferenceChangeEvent;
-import org.eclipse.rse.core.events.ISystemPreferenceChangeEvents;
-import org.eclipse.rse.core.events.ISystemPreferenceChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.core.RSEInitJob;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemCollapseAllAction;
-import org.eclipse.rse.internal.ui.actions.SystemImportConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemPreferenceQualifyConnectionNamesAction;
-import org.eclipse.rse.internal.ui.actions.SystemPreferenceRestoreStateAction;
-import org.eclipse.rse.internal.ui.actions.SystemPreferenceShowFilterPoolsAction;
-import org.eclipse.rse.internal.ui.actions.SystemShowPreferencesPageAction;
-import org.eclipse.rse.internal.ui.actions.SystemWorkWithProfilesAction;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
-import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAllAction;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.view.ContextObject;
-import org.eclipse.rse.ui.view.IRSEViewPart;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.IViewLinker;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.views.framelist.FrameList;
-/**
- * This is the desktop view wrapper of the System View viewer.
- */
-public class SystemViewPart
- extends ViewPart
- implements ISetSelectionTarget, IShellProvider, ISystemMessageLine, IElementFactory, IPersistableElement, IAdapterFactory, ISystemPreferenceChangeListener, ISelectionChangedListener, IRSEViewPart
-{
-
-
-
- protected SystemView systemView;
- protected ISystemViewInputProvider input = null;
- protected String message, errorMessage;
- protected SystemMessage sysErrorMessage;
- protected IStatusLineManager statusLine = null;
- protected boolean inputIsRoot = true;
-
-
- protected FrameList frameList;
- protected SystemViewPartGotoActionGroup gotoActionGroup;
-
- // link with editor stuff
- protected boolean _isLinkingEnabled = false;
-
- // view linker is used when a link with editor is required
- protected IViewLinker _viewLinker;
-
- // remember-state variables...
-
- protected IMemento fMemento;
- protected IAdapterManager platformManager;
- // preference toggle actions that need to be updated when preferences change
- protected SystemPreferenceQualifyConnectionNamesAction qualifyConnectionNamesAction;
- protected SystemPreferenceShowFilterPoolsAction showFilterPoolsAction;
- protected SystemPreferenceRestoreStateAction restoreStateAction;
- //protected SystemPreferenceShowFilterStringsAction showFilterStringsAction;
- protected static SystemWorkWithProfilesAction wwProfilesAction;
- // copy and paste actions
- protected SystemCopyToClipboardAction _copyAction;
- protected SystemPasteFromClipboardAction _pasteAction;
-
- // Persistence tags.
- static final String TAG_RELEASE = "release"; //$NON-NLS-1$
- static final String TAG_SELECTION = "selection"; //$NON-NLS-1$
- static final String TAG_EXPANDED_TO = "expandedTo"; //$NON-NLS-1$
- static final String TAG_EXPANDED = "expanded"; //$NON-NLS-1$
- static final String TAG_ELEMENT = "element"; //$NON-NLS-1$
- static final String TAG_PATH = "path"; //$NON-NLS-1$
- static final String TAG_FILTER = "filter"; //$NON-NLS-1$
- static final String TAG_INPUT = "svInput"; //$NON-NLS-1$
- static final String TAG_VERTICAL_POSITION = "verticalPosition"; //$NON-NLS-1$
- static final String TAG_HORIZONTAL_POSITION = "horizontalPosition"; //$NON-NLS-1$
- static final String TAG_SHOWFILTERPOOLS = "showFilterPools"; //$NON-NLS-1$
- static final String TAG_SHOWFILTERSTRINGS = "showFilterStrings"; //$NON-NLS-1$
- static final String TAG_LINKWITHEDITOR = "linkWithEditor"; //$NON-NLS-1$
-
- public static final String MEMENTO_DELIM = "///"; //$NON-NLS-1$
-
- // constants
- public static final String ID = "org.eclipse.rse.ui.view.systemView"; // matches id in plugin.xml, view tag //$NON-NLS-1$
-
- /**
- * SystemViewPart constructor.
- */
- public SystemViewPart()
- {
- super();
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"INSIDE CTOR FOR SYSTEMVIEWPART.");
- }
- /**
- * Easy access to the TreeViewer object
- */
- public SystemView getSystemView()
- {
- return systemView;
- }
-
- public Viewer getRSEViewer()
- {
- return systemView;
- }
-
- /**
- * When an element is added/deleted/changed/etc and we have focus, this
- * method is called. See SystemStaticHelpers.selectReveal method.
- */
- public void selectReveal(ISelection selection)
- {
- systemView.setSelection(selection, true);
- }
-
- /**
- * Returns the name for the given element.
- * Used as the name for the current frame.
- */
- protected String getFrameName(Object element)
- {
- return ((ILabelProvider) getSystemView().getLabelProvider()).getText(element);
- }
-
- /**
- * Returns the tool tip text for the given element.
- * Used as the tool tip text for the current frame, and for the view title tooltip.
- */
- protected String getFrameToolTipText(Object element)
- {
- return ((ILabelProvider) getSystemView().getLabelProvider()).getText(element);
- }
-
- public boolean isLinkingEnabled()
- {
- return _isLinkingEnabled;
- }
-
- public void setLinkingEnabled(boolean flag, IViewLinker viewLinker)
- {
- _isLinkingEnabled = flag;
- if (_isLinkingEnabled)
- {
- _viewLinker = viewLinker;
- IWorkbenchWindow activeWindow = SystemBasePlugin.getActiveWorkbenchWindow();
- IWorkbenchPage activePage = activeWindow.getActivePage();
- IEditorPart editor = activePage.getActiveEditor();
- if (editor != null)
- {
- editorActivated(editor);
- }
- }
- }
-
- /**
- * An editor has been activated. Sets the selection in this navigator
- * to be the editor's input, if linking is enabled.
- *
- * @param editor the active editor
- */
- protected void editorActivated(IEditorPart editor)
- {
- if (!_isLinkingEnabled)
- return;
-
- if (_viewLinker != null){
- _viewLinker.linkEditorToView(editor, systemView);
- }
- }
- /**
- * Updates the title text and title tool tip.
- * Called whenever the input of the viewer changes.
- */
- protected void updateTitle()
- {
- //IAdaptable inputObj = getSite().getPage().getInput();
- Object inputObj = getSystemView().getInput();
- SystemBasePlugin.logInfo("Inside updateTitle. inputObject class type: " + inputObj.getClass().getName()); //$NON-NLS-1$
-
- {
- setTitleToolTip(getFrameToolTipText(input));
- String viewName = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
- if (inputObj instanceof IHost)
- {
- IHost conn = (IHost) inputObj;
- setPartName(viewName + " : " + conn.getAliasName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISubSystem)
- {
- ISubSystem ss = (ISubSystem) inputObj;
- setPartName(viewName + " : " + ss.getName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISystemFilterPoolReference)
- {
- ISystemFilterPoolReference sfpr = (ISystemFilterPoolReference) inputObj;
- setPartName(viewName + " : " + sfpr.getName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISystemFilterReference)
- {
- ISystemFilterReference sfr = (ISystemFilterReference) inputObj;
- setPartName(viewName + " : " + sfr.getName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISystemFilterStringReference)
- {
- ISystemFilterStringReference sfsr = (ISystemFilterStringReference) inputObj;
- setPartName(viewName + " : " + sfsr.getString()); //$NON-NLS-1$
- }
- else
- {
- setPartName(viewName);
- setTitleToolTip(""); //$NON-NLS-1$
- }
- }
- }
-
- /*
- * Set our input provider that will be used to populate the tree view
- *
- public void setInputProvider(ISystemViewInputProvider input)
- {
- RSEUIPlugin.logDebugMessage(this.getClass().getName(),"INSIDE SETINPUTPROVIDER FOR SYSTEMVIEWPART.");
- this.input = input;
- }*/
- /**
- * Creates the SWT controls for a part.
- * Called by Eclipse framework.
- */
- public void createPartControl(Composite parent)
- {
- //RSEUIPlugin.logInfo("INSIDE CREATEPARTCONTROL FOR SYSTEMVIEWPART.");
- if (input == null)
- //input = RSECorePlugin.getTheSystemRegistry();
- input = getInputProvider();
- systemView = new SystemView(getShell(), parent, input, this);
- frameList = createFrameList();
-
- gotoActionGroup = new SystemViewPartGotoActionGroup(this);
- IActionBars actionBars = getActionBars();
- if (actionBars != null)
- {
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), systemView.getDeleteAction());
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), systemView.getSelectAllAction());
- actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), systemView.getPropertyDialogAction());
- actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), systemView.getRefreshAction());
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), systemView.getRenameAction());
-
- statusLine = actionBars.getStatusLineManager();
- }
-
- // register global edit actions
- Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
-
- CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
-
- _copyAction = new SystemCopyToClipboardAction(systemView.getShell(), clipboard);
- _pasteAction = new SystemPasteFromClipboardAction(systemView.getShell(), clipboard);
-
- editorActionHandler.setCopyAction(_copyAction);
- editorActionHandler.setPasteAction(_pasteAction);
- editorActionHandler.setDeleteAction(systemView.getDeleteAction());
- editorActionHandler.setSelectAllAction(systemView.getSelectAllAction());
-
- systemView.addSelectionChangedListener(this);
- //hook the part focus to the viewer's control focus.
- //hookFocus(systemView.getControl());
-
- systemView.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
-
- //prime the selection
- //selectionChanged(null, getSite().getDesktopWindow().getSelectionService().getSelection());
-
- boolean showConnectionActions = true;
- fillLocalToolBar(showConnectionActions);
-
- // -----------------------------
- // Enable right-click popup menu
- // -----------------------------
- getSite().registerContextMenu(systemView.getContextMenuManager(), systemView);
-
- // ----------------------------------------------------------------------
- // Enable property sheet updates when tree items are selected.
- // Note for this to work each item in the tree must either implement
- // IPropertySource, or support IPropertySource.class as an adapter type
- // in its AdapterFactory.
- // ----------------------------------------------------------------------
- getSite().setSelectionProvider(systemView);
- // listen to editor events for linking
- getSite().getPage().addPartListener(partListener);
-
- SystemWidgetHelpers.setHelp(parent, RSEUIPlugin.HELPPREFIX + "sysv0000"); //$NON-NLS-1$
-
- // ----------------------
- // Restore previous state
- // ----------------------
- final RSEInitJob initRSEJob = RSEInitJob.getInstance();
- if (initRSEJob == null) {
- //Already initialized - Profiles are loaded, we can restore state right away without blocking
- restoreInitialState();
- } else {
- //Wait until model fully restored, then fire a callback to restore state.
- //Remember current display, since we're definitely on the display thread here
- final Display display = Display.getCurrent();
- Job waitForRestoreCompleteJob = new Job("WaitForRestoreComplete") { //$NON-NLS-1$
- protected IStatus run(IProgressMonitor monitor) {
- try {
- //Wait for initRSEJob.
- initRSEJob.waitForCompletion();
- //callback
- display.asyncExec(new Runnable() {
- public void run() {
- restoreInitialState();
- }
- });
- } catch(InterruptedException e) {
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
- };
- waitForRestoreCompleteJob.setSystem(true);
- waitForRestoreCompleteJob.schedule();
- }
- }
-
- /**
- * Restore initial state of the SystemView. Can only be done
- * once the RSE Model has been fully restored, so this may
- * need to run in a callback.
- */
- private void restoreInitialState() {
- if ((fMemento != null) && (input instanceof ISystemRegistry))
- restoreState(fMemento);
- //fMemento = null;
-
- // Register for preference change events
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.addSystemPreferenceChangeListener(this);
-
- // if this is the primary RSE view, and there are no user-defined
- // connections, auto-expand the New Connection prompt...
- if ((input == RSECorePlugin.getTheSystemRegistry()) && (RSECorePlugin.getTheSystemRegistry().getHosts().length == 1))
- {
- // assume this is the primary RSE view
-
- // WE GET ALL THE WAY HERE, BUT THESE LINES OF CODE ARE INEFFECTIVE FOR SOME REASON!!
-
- if (systemView.getTree().getItemCount() > 0) {
- TreeItem firstItem = systemView.getTree().getItems()[0];
- systemView.setSelection(new StructuredSelection(firstItem.getData()));
- systemView.setExpandedState(firstItem.getData(), true);
- }
- }
- }
-
- /**
- * Handles double clicks in viewer.
- * Opens editor if file double-clicked.
- */
- protected void handleDoubleClick(DoubleClickEvent event) {
- if (!systemView.enabledMode) {
- //event.doit = false;
- return;
- }
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (element == null) return;
- ISystemViewElementAdapter adapter = systemView.getViewAdapter(element);
- if (adapter != null)
- adapter.handleDoubleClick(element);
-
- }
-
- /**
- * Creates the frame source and frame list, and connects them.
- */
- protected FrameList createFrameList()
- {
- SystemViewPartFrameSource frameSource = new SystemViewPartFrameSource(this);
- FrameList frameList = new FrameList(frameSource);
- frameSource.connectTo(frameList);
- return frameList;
- }
- /**
- * Return the FrameList object for this view part
- */
- public FrameList getFrameList()
- {
- return frameList;
- }
-
- /**
- * Return the Goto action group
- */
- public SystemViewPartGotoActionGroup getGotoActionGroup()
- {
- return gotoActionGroup;
- }
-
- /**
- * Return the shell for this view part
- */
- public Shell getShell()
- {
- if (systemView != null)
- return systemView.getTree().getShell();
- else
- return getSite().getShell();
- }
- /**
- * Return the action bars for this view part
- */
- public IActionBars getActionBars()
- {
- return getViewSite().getActionBars();
- }
-
- /**
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus()
- {
- //System.out.println("INSIDE SETFOCUS FOR SYSTEMVIEWPART. SYSTEMVIEW NULL? " + (systemView==null));
- IWorkbench wb = PlatformUI.getWorkbench();
- wb.getActiveWorkbenchWindow().getShell().setFocus();
- systemView.getControl().setFocus();
- /* the following was an attempt to fix problem with scrollbar needing two clicks to activate. didn't help.
- if (!SystemPreferencesGlobal.getGlobalSystemPreferences().getRememberState())
- {
- TreeItem[] roots = systemView.getTree().getItems();
- if ((roots != null) && (roots.length>0))
- systemView.setSelection(new StructuredSelection(roots[0].getData()));
- }
- */
-
- }
-
- public void selectionChanged(SelectionChangedEvent e)
- {
- IStructuredSelection sel = (IStructuredSelection) e.getSelection();
- _copyAction.setEnabled(_copyAction.updateSelection(sel));
- _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
- //systemView.getPropertyDialogAction();
- if (_isLinkingEnabled)
- {
- linkToEditor(sel);
- }
- }
-
-
- // link back to editor
- protected void linkToEditor(IStructuredSelection selection)
- {
- if (_viewLinker != null)
- {
- Object obj = selection.getFirstElement();
- IWorkbenchPage page = getSite().getPage();
- _viewLinker.linkViewToEditor(obj, page);
- }
- }
-
-
- /**
- * Fills the local tool bar with actions.
- */
- protected void fillLocalToolBar(boolean showConnectionActions)
- {
- IActionBars actionBars = getViewSite().getActionBars();
- SystemRefreshAction refreshAction = new SystemRefreshAction(getShell());
- refreshAction.setId(ActionFactory.REFRESH.getId());
- refreshAction.setActionDefinitionId("org.eclipse.ui.file.refresh"); //$NON-NLS-1$
- refreshAction.setSelectionProvider(systemView);
- actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
-
- // Note: Keep the group marker and separators in place! ISV's needs
- // them to find their places within the toolbar. Re-use as
- // much constants from the remote system view context menu as possible.
- // This in particular makes orientating and contributing via plugin.xml
- // much easier.
-
- IToolBarManager toolBarMgr = actionBars.getToolBarManager();
- if (showConnectionActions)
- {
- toolBarMgr.add(new GroupMarker(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING));
- SystemNewConnectionAction newConnAction = new SystemNewConnectionAction(getShell(), false, systemView); // false implies not from popup menu
- toolBarMgr.add(newConnAction);
- }
-
- toolBarMgr.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BUILD));
- refreshAction.setSelectionProvider(systemView);
- toolBarMgr.add(refreshAction);
-
- toolBarMgr.add(new Separator(ISystemContextMenuConstants.GROUP_GOTO));
- SystemViewPartGotoActionGroup gotoActions = new SystemViewPartGotoActionGroup(this);
- gotoActions.fillActionBars(actionBars);
-
- // defect 41203
- toolBarMgr.add(new Separator(ISystemContextMenuConstants.GROUP_EXPAND));
- SystemCollapseAllAction collapseAllAction = new SystemCollapseAllAction(getShell());
- collapseAllAction.setSelectionProvider(systemView);
- toolBarMgr.add(collapseAllAction);
-
- IMenuManager menuMgr = actionBars.getMenuManager();
- populateSystemViewPulldownMenu(menuMgr, getShell(), showConnectionActions, this, systemView);
-
- // [179181] [api] Dynamic system type provider need a hook to add dynamic system type specific toolbar groups.
- IRSESystemType[] systemTypes = SystemWidgetHelpers.getValidSystemTypes(null);
- for (int i = 0; i < systemTypes.length; i++) {
- IRSESystemType systemType = systemTypes[i];
- Object adapter = systemType.getAdapter(RSESystemTypeAdapter.class);
- if (adapter instanceof RSESystemTypeAdapter) {
- ((RSESystemTypeAdapter)adapter).addCustomToolbarGroups(this);
- }
- }
- }
-
- /**
- * Pulldown the local toolbar menu with actions
- */
- public static void populateSystemViewPulldownMenu(IMenuManager menuMgr, Shell shell, boolean showConnectionActions, IWorkbenchPart viewPart, ISelectionProvider sp)
- {
- SystemRefreshAllAction refreshAllAction = new SystemRefreshAllAction(shell);
- //SystemCascadingUserIdPerSystemTypeAction userIdPerSystemTypeAction = new SystemCascadingUserIdPerSystemTypeAction(shell); d51541
- SystemPreferenceShowFilterPoolsAction showFilterPoolsAction = new SystemPreferenceShowFilterPoolsAction(shell);
- SystemPreferenceQualifyConnectionNamesAction qualifyConnectionNamesAction = null;
- SystemPreferenceRestoreStateAction restoreStateAction = new SystemPreferenceRestoreStateAction(shell);
-
- if (viewPart instanceof SystemViewPart)
- {
- ((SystemViewPart) viewPart).showFilterPoolsAction = showFilterPoolsAction; // set non-static field
- ((SystemViewPart) viewPart).restoreStateAction = restoreStateAction; // set non-static field
- }
-
- if (showConnectionActions)
- {
- boolean fromPopup = false;
- boolean wantIcon = false;
- SystemNewConnectionAction newConnectionAction = new SystemNewConnectionAction(shell, fromPopup, wantIcon, sp);
- SystemImportConnectionAction importConnectionAction = new SystemImportConnectionAction();
- importConnectionAction.setShell(shell);
- importConnectionAction.setText(SystemResources.RESID_IMPORT_CONNECTION_LABEL_LONG);
- SystemWorkWithProfilesAction wwProfilesAction = new SystemWorkWithProfilesAction(shell);
- menuMgr.add(newConnectionAction);
- menuMgr.add(importConnectionAction);
- menuMgr.add(new Separator());
- menuMgr.add(wwProfilesAction);
- menuMgr.add(new Separator());
- // moved Qualify Connection Names from here for d51541
- //menuMgr.add(new Separator()); d51541
- }
- menuMgr.add(refreshAllAction);
- menuMgr.add(new Separator());
- if (showConnectionActions)
- {
- qualifyConnectionNamesAction = new SystemPreferenceQualifyConnectionNamesAction(shell);
- if (viewPart instanceof SystemViewPart)
- ((SystemViewPart) viewPart).qualifyConnectionNamesAction = qualifyConnectionNamesAction;
- menuMgr.add(qualifyConnectionNamesAction); // moved here for d51541
- }
- //menuMgr.add(userIdPerSystemTypeAction.getSubMenu()); d51541
- menuMgr.add(showFilterPoolsAction);
- menuMgr.add(restoreStateAction); // d51541
-
- // Now display any contributed action shortcuts for bringing up
- // a particular preference page...
- MenuManager subMenu = new MenuManager(SystemResources.ACTION_CASCADING_PREFERENCES_LABEL, ISystemContextMenuConstants.MENU_PREFERENCES);
- menuMgr.add(subMenu);
-
- // The initial "RSE" Preference page action is added hardcoded.
- // This comes from the former SystemCascadingPreferencesAction.
- // FIXME will be moved to using command/hander extension point as per
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=186769
- SystemShowPreferencesPageAction action = new SystemShowPreferencesPageAction();
- action.setPreferencePageID("org.eclipse.rse.ui.preferences.RemoteSystemsPreferencePage"); //$NON-NLS-1$
- action.setText(SystemResources.ACTION_SHOW_PREFERENCEPAGE_LABEL);
- action.setToolTipText(SystemResources.ACTION_SHOW_PREFERENCEPAGE_TOOLTIP);
- action.setHelp("org.eclipse.rse.ui.aprefrse"); //$NON-NLS-1$
- subMenu.add(action);
- subMenu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_ADDITIONS));
-
- SystemViewMenuListener menuListener = new SystemViewMenuListener(true); // true says this is a persistent menu
- if (viewPart instanceof ISystemMessageLine)
- menuListener.setShowToolTipText(true, (ISystemMessageLine) viewPart);
- menuMgr.addMenuListener(menuListener);
-
- }
-
- /**
- *
- */
- public void dispose()
- {
- super.dispose();
- if (platformManager != null)
- unregisterWithManager(platformManager);
- RSECorePlugin.getTheSystemRegistry().removeSystemPreferenceChangeListener(this);
- getSite().getPage().removePartListener(partListener);
- //System.out.println("INSIDE DISPOSE FOR SYSTEMVIEWPART.");
- }
-
- /**
- * Returns the initial input provider for the viewer.
- * Tries to deduce the appropriate input provider based on current input.
- */
- protected ISystemViewInputProvider getInputProvider()
- {
- IAdaptable inputObj = getSite().getPage().getInput();
- inputIsRoot = false;
- ISystemViewInputProvider inputProvider = RSECorePlugin.getTheSystemRegistry();
- if (inputObj != null)
- {
- platformManager = Platform.getAdapterManager();
- if (inputObj instanceof IHost)
- {
- IHost conn = (IHost) inputObj;
- inputProvider = new SystemViewAPIProviderForConnections(conn);
- setPartName(getTitle() + " : " + conn.getAliasName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISubSystem)
- {
- ISubSystem ss = (ISubSystem) inputObj;
- inputProvider = new SystemViewAPIProviderForSubSystems(ss);
- setPartName(getTitle() + " : " + ss.getName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISystemFilterPoolReference)
- {
- ISystemFilterPoolReference sfpr = (ISystemFilterPoolReference) inputObj;
- inputProvider = new SystemViewAPIProviderForFilterPools(sfpr);
- setPartName(getTitle() + " : " + sfpr.getName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISystemFilterReference)
- {
- ISystemFilterReference sfr = (ISystemFilterReference) inputObj;
- inputProvider = new SystemViewAPIProviderForFilters(sfr);
- setPartName(getTitle() + " : " + sfr.getName()); //$NON-NLS-1$
- }
- else if (inputObj instanceof ISystemFilterStringReference)
- {
- ISystemFilterStringReference sfsr = (ISystemFilterStringReference) inputObj;
- inputProvider = new SystemViewAPIProviderForFilterStrings(sfsr);
- setPartName(getTitle() + " : " + sfsr.getString()); //$NON-NLS-1$
- }
- else
- {
- platformManager = null;
- inputIsRoot = true;
- }
-
- if (platformManager != null)
- registerWithManager(platformManager, inputObj);
- //msg = "INSIDE GETINPUTPROVIDER FOR SYSTEMVIEWPART: inputObj="+inputObj+", input class="+inputObj.getClass().getName()+", inputProvider="+inputProvider;
- }
- else
- {
- //msg = "INSIDE GETINPUTPROVIDER FOR SYSTEMVIEWPART: inputObj is null, inputProvider="+inputProvider;
- }
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),msg);
- //System.out.println("INSIDE getInputProvider. inputProvider = "+inputProvider);
- return inputProvider;
- }
-
- // --------------------------------------------
- // ISystemPreferenceChangeListener interface...
- // --------------------------------------------
- public void systemPreferenceChanged(ISystemPreferenceChangeEvent event)
- {
- if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES) && (qualifyConnectionNamesAction != null))
- qualifyConnectionNamesAction.setChecked(SystemPreferencesManager.getQualifyConnectionNames());
- else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS) && (showFilterPoolsAction != null))
- showFilterPoolsAction.setChecked(SystemPreferencesManager.getShowFilterPools());
- else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_RESTORESTATE) && (restoreStateAction != null))
- restoreStateAction.setChecked(SystemPreferencesManager.getRememberState());
-
- //else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_SHOWFILTERSTRINGS) &&
- // (showFilterStringsAction != null))
- // showFilterStringsAction.setChecked(SystemPreferencesManager.getPreferencesManager().getShowFilterStrings());
-
- }
-
- // -------------------------------
- // ISystemMessageLine interface...
- // -------------------------------
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- errorMessage = null;
- sysErrorMessage = null;
- if (statusLine != null)
- statusLine.setErrorMessage(errorMessage);
- }
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- message = null;
- if (statusLine != null)
- statusLine.setMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage()
- {
- return errorMessage;
- }
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage()
- {
- return message;
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- this.errorMessage = message;
- if (statusLine != null)
- statusLine.setErrorMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- return sysErrorMessage;
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- sysErrorMessage = message;
- setErrorMessage(message.getLevelOneText());
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(Throwable exc)
- {
- setErrorMessage(exc.getMessage());
- }
-
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- this.message = message;
- if (statusLine != null)
- statusLine.setMessage(message);
- }
- /**
- *If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- setMessage(message.getLevelOneText());
- }
-
- // -------------------------------------------
- // MEMENTO SUPPORT (SAVING/RESTORING STATE)...
- // -------------------------------------------
- /**
- * Initializes this view with the given view site. A memento is passed to
- * the view which contains a snapshot of the views state from a previous
- * session. Where possible, the view should try to recreate that state
- * within the part controls.
- * <p>
- * The parent's default implementation will ignore the memento and initialize
- * the view in a fresh state. Subclasses may override the implementation to
- * perform any state restoration as needed.
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException
- {
- init(site);
- fMemento = memento;
- //System.out.println("INSIDE INIT");
- }
-
- /**
- * Returns the image descriptor with the given relative path.
- */
- protected ImageDescriptor getNavigatorImageDescriptor(String relativePath)
- {
- return RSEUIPlugin.getDefault().getImageDescriptorFromIDE(relativePath); // more reusable
- /*
- String iconPath = "icons/full/"; //$NON-NLS-1$
- try
- {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
-
- URL url = new URL(installURL, iconPath + relativePath);
- ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
- return descriptor;
- }
- catch (MalformedURLException e)
- {
- // should not happen
- return ImageDescriptor.getMissingImageDescriptor();
- }*/
- }
-
- /**
- * Method declared on IViewPart.
- */
- public void saveState(IMemento memento)
- {
- //System.out.println("INSIDE SAVESTATE");
- if (!SystemPreferencesManager.getRememberState())
- return;
- if (systemView == null)
- {
- // part has not been created
- if (fMemento != null) //Keep the old state;
- memento.putMemento(fMemento);
- return;
- }
-
- if (_isLinkingEnabled)
- {
- memento.putString(TAG_LINKWITHEDITOR, "t"); //$NON-NLS-1$
- }
- else
- {
- memento.putString(TAG_LINKWITHEDITOR, "f"); //$NON-NLS-1$
- }
-
- // We record the current release for future in case anything significant changes from release to release
- memento.putString(TAG_RELEASE, RSECorePlugin.CURRENT_RELEASE_NAME);
-
- // We record the current preferences for show filter string and show filter pools.
- // We do this to ensure the states match on restore. If they don't we will be in trouble
- // restoring expansion state and hence will abandon it.
-
- memento.putString(TAG_SHOWFILTERPOOLS, SystemPreferencesManager.getShowFilterPools() ? "t" : "f"); //$NON-NLS-1$ //$NON-NLS-2$
- //memento.putString(TAG_SHOWFILTERSTRINGS, SystemPreferencesManager.getPreferencesManager().getShowFilterStrings() ? "t" : "f");
-
- String inputMemento = memento.getString("factoryID"); // see IWorkbenchWindow ... this is only clue I can figure out! //$NON-NLS-1$
- if (inputMemento != null)
- {
- saveInputState(memento);
- return;
- }
-
- Tree tree = systemView.getTree();
-
- // SAVE EXPAND-TO HASHTABLE
- Hashtable expandToFilters = systemView.getExpandToFilterTable();
- if ((expandToFilters != null) && (expandToFilters.size() > 0))
- {
- IMemento expandedMem = memento.createChild(TAG_EXPANDED_TO);
- Enumeration keys = expandToFilters.keys();
- while (keys.hasMoreElements())
- {
- Object key = keys.nextElement();
- Object value = expandToFilters.get(key);
- if (value != null)
- {
- IMemento elementMem = expandedMem.createChild(TAG_ELEMENT);
- elementMem.putString(TAG_PATH, (String) key);
- elementMem.putString(TAG_FILTER, (String) value);
- }
- }
- }
-
- // SAVE EXPANSION STATE
- //Object expandedElements[]= systemView.getExpandedElements();
- Object expandedElements[] = systemView.getVisibleExpandedElements();
- if ((expandedElements != null) && (expandedElements.length > 0))
- {
- IMemento expandedMem = memento.createChild(TAG_EXPANDED);
- for (int i = 0; i < expandedElements.length; i++)
- {
- Object o = expandedElements[i];
- ISystemViewElementAdapter adapter = systemView.getViewAdapter(o);
- //ISystemRemoteElementAdapter radapter = systemView.getRemoteAdapter(o);
- //if (adapter.saveExpansionState(o) && (radapter==null))
- if (adapter.saveExpansionState(o))
- {
- IMemento elementMem = expandedMem.createChild(TAG_ELEMENT);
- elementMem.putString(TAG_PATH, getMementoHandle(o, adapter));
- //System.out.println("Added to saved expansion list: " + getMementoHandle(o, adapter));
- }
- }
- }
-
- // SAVE SELECTION STATE
- Object elements[] = ((IStructuredSelection) systemView.getSelection()).toArray();
- if ((elements != null) && (elements.length > 0))
- {
- IMemento selectionMem = memento.createChild(TAG_SELECTION);
- for (int i = 0; i < elements.length; i++)
- {
- Object o = elements[i];
- ISystemViewElementAdapter adapter = systemView.getViewAdapter(o);
- //ISystemRemoteElementAdapter radapter = systemView.getRemoteAdapter(o);
- //if (adapter.saveExpansionState(o) && (radapter==null))
- if (adapter.saveExpansionState(o))
- {
- IMemento elementMem = selectionMem.createChild(TAG_ELEMENT);
- elementMem.putString(TAG_PATH, getMementoHandle(o, adapter));
- }
- }
- }
-
- //save vertical position
- ScrollBar bar = tree.getVerticalBar();
- int position = bar != null ? bar.getSelection() : 0;
- memento.putString(TAG_VERTICAL_POSITION, String.valueOf(position));
- //save horizontal position
- bar = tree.getHorizontalBar();
- position = bar != null ? bar.getSelection() : 0;
- memento.putString(TAG_HORIZONTAL_POSITION, String.valueOf(position));
-
- }
-
- /**
- * Defer to the adapter to get the memento handle key plus the memento handle for
- * each part leading up to the current object.
- */
- protected String getMementoHandle(Object o, ISystemViewElementAdapter adapter)
- {
- StringBuffer idBuffer = new StringBuffer(adapter.getMementoHandleKey(o));
- Object[] elementNodes = systemView.getElementNodes(o);
- if (elementNodes != null)
- {
- for (int idx = elementNodes.length - 1; idx >= 0; idx--)
- {
- o = elementNodes[idx];
- adapter = systemView.getViewAdapter(o);
- idBuffer.append(MEMENTO_DELIM + adapter.getMementoHandle(o));
- }
- }
- //System.out.println("MEMENTO HANDLE: " + idBuffer.toString());
- return idBuffer.toString();
- }
-
- /**
- * Our own method for restoring state
- */
- protected void restoreState(IMemento memento)
- {
- RestoreStateRunnable restoreAction = new RestoreStateRunnable(memento);
- restoreAction.setRule(RSECorePlugin.getTheSystemRegistry());
- restoreAction.schedule();
-
- /* DKM - Moved to RestoreStateRunnable
- * - resolves invalid shell problem at startup
- * *
- //System.out.println("SYSTEMVIEWPART: restoreState");
- if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
- return;
-
- // restore the show filter pools and show filter strings settings as they were when this was saved
- boolean showFilterPools = false;
- boolean showFilterStrings = false;
- String savedValue = memento.getString(TAG_SHOWFILTERPOOLS);
- if (savedValue != null)
- showFilterPools = savedValue.equals("t");
- else
- showFilterPools = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
-
- savedValue = memento.getString(TAG_SHOWFILTERSTRINGS); // historical
- if (savedValue != null)
- showFilterStrings = savedValue.equals("t");
- //else
- //showFilterStrings = SystemPreferencesManager.getPreferencesManager().getShowFilterStrings();
-
- IMemento childMem = null;
-
- // restore expand-to hashtable state
- childMem= memento.getChild(TAG_EXPANDED_TO);
- if (childMem != null)
- {
- IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
- Hashtable ht = new Hashtable();
- for (int i= 0; i < elementMem.length; i++)
- {
- String key = elementMem[i].getString(TAG_PATH);
- String value = elementMem[i].getString(TAG_FILTER);
- if ((key != null) && (value != null))
- ht.put(key, value);
- }
- if (ht.size() > 0)
- systemView.setExpandToFilterTable(ht);
- }
-
- // restore expansion state
- childMem= memento.getChild(TAG_EXPANDED);
- if (childMem != null)
- {
- ArrayList elements= new ArrayList();
- Vector remoteElements = new Vector();
- IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
- // walk through list of expanded nodes, breaking into 2 lists: non-remote and remote
- for (int i= 0; i < elementMem.length; i++)
- {
- Object element= getObjectFromMemento(showFilterPools, showFilterStrings, elementMem[i].getString(TAG_PATH));
- if (element != null)
- if (element instanceof RemoteObject) // this is a remote object
- {
- remoteElements.add(element);
- //System.out.println("Added to remote expansion list: " + element);
- }
- else
- {
- elements.add(element);
- //System.out.println("Added to non-remote expansion list: " + element);
- }
- }
- // expand non-remote...
- systemView.setExpandedElements(elements.toArray());
- // expand remote...
- if (remoteElements.size() > 0)
- {
- SystemResourceChangeEvent event = null;
- for (int idx=0; idx<remoteElements.size(); idx++)
- {
- RemoteObject ro = (RemoteObject)remoteElements.elementAt(idx);
- //event = new SystemResourceChangeEvent(ro.name,ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE,
- // SystemViewDummyObject.getInstance()); // This tells SystemView to expand this remote object, but don't select a child
- //systemView.systemResourceChanged(event);
- systemView.refreshRemoteObject(ro.name, SystemViewDummyObject.getInstance(), true);
- }
- }
- }
-
- // restoreSelection
- childMem= memento.getChild(TAG_SELECTION);
- if (childMem != null)
- {
- ArrayList list= new ArrayList();
- Vector remoteElements = new Vector();
- IMemento[] elementMem= childMem.getChildren(TAG_ELEMENT);
- for (int i= 0; i < elementMem.length; i++)
- {
- Object element= getObjectFromMemento(showFilterPools, showFilterStrings, elementMem[i].getString(TAG_PATH));
- if (element != null)
- if (element instanceof RemoteObject) // this is a remote object
- remoteElements.add(element);
- else
- list.add(element);
- //System.out.println("Added to selection list: " + element);
- }
- systemView.setSelection(new StructuredSelection(list));
- if (remoteElements.size() > 0)
- {
- Vector v = new Vector();
- for (int idx=0; idx<remoteElements.size(); idx++)
- {
- RemoteObject ro = (RemoteObject)remoteElements.elementAt(idx);
- v.addElement(ro.name);
- }
- SystemResourceChangeEvent event = new SystemResourceChangeEvent(v,ISystemResourceChangeEvents.EVENT_SELECT_REMOTE,null);
- systemView.systemResourceChanged(event);
- }
- }
- Tree tree= systemView.getTree();
- //restore vertical position
- ScrollBar bar= tree.getVerticalBar();
- if (bar != null)
- {
- try
- {
- String posStr= memento.getString(TAG_VERTICAL_POSITION);
- if (posStr != null)
- {
- int position;
- position= new Integer(posStr).intValue();
- bar.setSelection(position);
- }
- } catch (NumberFormatException e)
- {
- }
- }
- //restore vertical position
- bar= tree.getHorizontalBar();
- if (bar != null)
- {
- try
- {
- String posStr= memento.getString(TAG_HORIZONTAL_POSITION);
- if (posStr != null)
- {
- int position;
- position= new Integer(posStr).intValue();
- bar.setSelection(position);
- }
- } catch (NumberFormatException e)
- {
- }
- }
- */
- }
-
- /**
- * protected method to deconstruct an expanded/selected memento into an actual object
- */
- protected Object getObjectFromMemento(boolean showFilterPools, boolean showFilterStrings, String memento)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- ISystemProfile profile = null;
- IHost conn = null;
- String ssfId = null;
- ISubSystemConfiguration ssf = null;
- ISubSystem subsystem = null;
- ISystemFilterPoolReference fpRef = null;
- ISystemFilterReference fRef = null;
- ISystemFilterStringReference fsRef = null;
- RemoteObject remoteObject = null;
-
- //System.out.println("PARSING MEMENTO: " + memento);
-
- if (memento == null)
- return null;
-
- Vector v = tokenize(memento, MEMENTO_DELIM);
-
- String elementType = ""; //$NON-NLS-1$
- String ssName = null;
- //String connName = null;
- //String subsystemName = null;
- // 0. element type
- // 1. connections
- // 2. subsystems
- // 3. filter pools (optional)
- // 4. filters
- // 5. filter strings (optional)
- // 6. remote objects
- // 1. connections
- // 2. subsystems
- // 3. filters
- // 4. filter strings (optional)
- // 5. remote objects
- // 1. connections
- // 2. subsystems
- // 3. filter pools (optional)
- // 4. filters
- // 5. remote objects
- // 1. connections
- // 2. subsystems
- // 3. filters
- // 4. remote objects
-
- int index = 0;
- for (int idx = 0; idx < v.size(); idx++)
- {
- String token = (String) v.elementAt(idx);
- switch (idx)
- {
- // type of element
- case 0 :
- elementType = token;
- break;
- // connection
- case 1 :
- index = token.indexOf('.');
- if (index > 0)
- {
- profile = sr.getSystemProfile(token.substring(0, index));
- if (profile != null)
- conn = sr.getHost(profile, token.substring(index + 1));
- }
- break;
- // subsystem
- case 2 :
- index = token.indexOf('=');
- ssfId = index != -1 ? token.substring(0, index) : null;
- ssName = token.substring(index + 1);
- if (ssfId != null)
- ssf = sr.getSubSystemConfiguration(ssfId);
- if ((ssf != null) && (conn != null))
- {
- ISubSystem[] subsystems = ssf.getSubSystems(conn, true); // force to life
- if (subsystems != null)
- for (int ssidx = 0;(subsystem == null) && (ssidx < subsystems.length); ssidx++)
- if (subsystems[ssidx].getName().equals(ssName))
- subsystem = subsystems[ssidx];
- }
- break;
- // filter pool or filter (depends on showFilterPools)
- case 3 :
-
- if (!(subsystem.getSubSystemConfiguration().supportsFilters())) {
- remoteObject = new RemoteObject(token, subsystem, null, null);
- break;
- }
-
- if (showFilterPools)
- {
- if (subsystem != null)
- {
- String poolName = token;
- ISystemFilterPoolReference[] refs = subsystem.getFilterPoolReferenceManager().getSystemFilterPoolReferences();
- if (refs != null)
- for (int refidx = 0;(fpRef == null) && (refidx < refs.length); refidx++)
- {
- if (refs[refidx].getFullName().equals(poolName))
- fpRef = refs[refidx];
- }
- }
- }
- else
- {
- index = token.indexOf('=');
- if (index != -1)
- {
- String filterName = token.substring(index + 1);
- String poolName = token.substring(0, index);
- if (subsystem != null)
- {
- ISystemFilterPoolReference[] refs = subsystem.getFilterPoolReferenceManager().getSystemFilterPoolReferences();
- if (refs != null)
- for (int refidx = 0;(fpRef == null) && (refidx < refs.length); refidx++)
- if (refs[refidx].getFullName().equals(poolName))
- fpRef = refs[refidx];
- }
-
- // TODO: handle nested filters. in this case they are separated by ';'. See SystemFilterReferenceAdapter's getMementoHandle()
- if (fpRef != null)
- {
- ISystemFilterReference[] refs = fpRef.getSystemFilterReferences(subsystem);
- if (refs != null)
- for (int refidx = 0;(fRef == null) && (refidx < refs.length); refidx++)
- if (refs[refidx].getName().equals(filterName))
- fRef = refs[refidx];
- }
- }
- }
- break;
- // filter or filter string (depends on showFilterPools) or remote object (depends on showFilterStrings)
- case 4 :
-
- if (!(subsystem.getSubSystemConfiguration().supportsFilters())) {
- remoteObject = new RemoteObject(token, subsystem, null, null);
- break;
- }
-
- if (showFilterPools) // definitely a filter
- {
- index = token.indexOf('=');
- String filterName = token.substring(index + 1);
-// String poolName = token.substring(0, index);
- // TODO: handle nested filters. in this case they are separated by ';'. See SystemFilterReferenceAdapter's getMementoHandle()
- if (fpRef != null) // should have already been parsed in case 3
- {
- ISystemFilterReference[] refs = fpRef.getSystemFilterReferences(subsystem);
- if (refs != null)
- for (int refidx = 0;(fRef == null) && (refidx < refs.length); refidx++)
- if (refs[refidx].getName().equals(filterName))
- fRef = refs[refidx];
- }
- }
- else if (showFilterStrings) // children of filters are filter strings or resolved remote objects
- {
- // at this point we know the parent filter reference as that was parsed in case 3
- if (fRef != null)
- {
- ISystemFilterStringReference[] refs = fRef.getSystemFilterStringReferences();
- if (refs != null)
- for (int refidx = 0;(fsRef == null) && (refidx < refs.length); refidx++)
- if (refs[refidx].getString().equals(token))
- fsRef = refs[refidx];
- }
- }
- else // if both pools and strings are turned off, then at level four we are definitely dealing with remote objects
- {
- if ((subsystem != null) && (fRef != null))
- remoteObject = new RemoteObject(token, subsystem, fRef, fsRef);
- }
-
- break;
- // filter string (depends on showFilterStrings) or remote object
- case 5 :
-
- if (!(subsystem.getSubSystemConfiguration().supportsFilters())) {
- remoteObject = new RemoteObject(token, subsystem, null, null);
- break;
- }
-
- if (showFilterPools && showFilterStrings) // definitely a filter string
- {
- // at this point we know the parent filter reference as that was parsed in case 4
- if (fRef != null)
- {
- ISystemFilterStringReference[] refs = fRef.getSystemFilterStringReferences();
- if (refs != null)
- for (int refidx = 0;(fsRef == null) && (refidx < refs.length); refidx++)
- if (refs[refidx].getString().equals(token))
- fsRef = refs[refidx];
- }
- }
- else // definitely remote
- {
- if ((subsystem != null) && (fRef != null))
- remoteObject = new RemoteObject(token, subsystem, fRef, fsRef);
- }
-
- break;
- default : // definitely a remote object
-
- if (!(subsystem.getSubSystemConfiguration().supportsFilters())) {
- remoteObject = new RemoteObject(token, subsystem, null, null);
- break;
- }
-
- if ((subsystem != null) && (fRef != null))
- remoteObject = new RemoteObject(token, subsystem, fRef, fsRef);
- }
- }
-
- if (elementType.equals(ISystemMementoConstants.MEMENTO_KEY_CONNECTION))
- return conn;
- else if (elementType.equals(ISystemMementoConstants.MEMENTO_KEY_SUBSYSTEM))
- return subsystem;
- else if (elementType.equals(ISystemMementoConstants.MEMENTO_KEY_FILTERPOOLREFERENCE))
- return fpRef;
- else if (elementType.equals(ISystemMementoConstants.MEMENTO_KEY_FILTERREFERENCE))
- return fRef;
- else if (elementType.equals(ISystemMementoConstants.MEMENTO_KEY_FILTERSTRINGREFERENCE))
- return fsRef;
- else
- return remoteObject;
-
- //return null;
- }
-
- /**
- * Parse a string into tokens. Unlike StringTokenizer, this supports delimiter strings versus
- * only delimiter characters
- */
- public static Vector tokenize(String inputString, String delimiter)
- {
- Vector v = new Vector();
- StringBuffer token = new StringBuffer();
- String lastToken = null;
- int inpLen = inputString.length();
- int delimLen = delimiter.length();
- char delimChar1 = delimiter.charAt(0);
- for (int idx = 0; idx < inpLen; idx++)
- {
- int remLen = inpLen - idx;
- char currChar = inputString.charAt(idx);
- if ((currChar == delimChar1) && (remLen >= delimLen) && inputString.substring(idx, idx + delimLen).equals(delimiter))
- {
- lastToken = token.toString();
- v.addElement(lastToken);
- //System.out.println("...token: " + token);
- token.setLength(0);
- idx += delimLen - 1;
- }
- else
- token.append(currChar);
- }
- if (token.length() > 0)
- {
- lastToken = token.toString();
- v.addElement(lastToken);
- //System.out.println("...token: " + token);
- }
- return v;
- }
-
- protected class ShowRestoredRemoteObject implements Runnable
- {
- private Object _restoredObject;
- private Object[] _children;
- public ShowRestoredRemoteObject(Object restoredObject, Object[] children)
- {
- _restoredObject = restoredObject;
- _children = children;
- }
-
- public void run()
- {
- Vector matches = new Vector();
- systemView.findAllRemoteItemReferences(_restoredObject, _restoredObject, matches);
- if (matches.size() > 0){
- TreeItem item = (TreeItem)matches.get(0);
- systemView.createTreeItems(item, _children);
- item.setExpanded(true);
- }
-
- }
- }
-
-
- protected class RestoreRemoteObjects extends Job
- {
- private Vector _remoteObjectsToRestore;
- private List _cacheSubSystemList;
- private Vector _remoteObjectsToSelect;
-
- public RestoreRemoteObjects(Vector remoteObjects, List cacheSubSystemList, Vector remoteObjectsToSelect)
- {
- super("Restore Remote Objects"); //$NON-NLS-1$
- _remoteObjectsToRestore = remoteObjects;
- _cacheSubSystemList = cacheSubSystemList;
- _remoteObjectsToSelect = remoteObjectsToSelect;
- }
-
- protected IStatus run(IProgressMonitor monitor)
- {
- IStatus status = doRestore(monitor);
- if (status.isOK()){
- status = doSelect(monitor);
- }
- return status;
- }
-
- protected IStatus doSelect(IProgressMonitor monitor)
- {
- Vector v = new Vector();
- for (int i = 0; i < _remoteObjectsToSelect.size(); i++){
-
- Object object = _remoteObjectsToSelect.get(i);
- if (object instanceof RemoteObject)
- {
- RemoteObject robject = (RemoteObject)object;
- v.addElement(robject.name);
- }
- }
- SystemResourceChangeEvent event = new SystemResourceChangeEvent(v, ISystemResourceChangeEvents.EVENT_SELECT_REMOTE, null);
- systemView.systemResourceChanged(event);
-
- return Status.OK_STATUS;
- }
-
-
- protected IStatus doRestore(IProgressMonitor monitor)
- {
- for (int i = 0; i < _remoteObjectsToRestore.size(); i++){
-
- if (monitor.isCanceled()){
- return Status.CANCEL_STATUS;
- }
-
- Object object = _remoteObjectsToRestore.get(i);
- if (object instanceof RemoteObject)
- {
- RemoteObject robject = (RemoteObject)object;
-
- ISubSystem ss = robject.subsystem;
-
- // yantzi: artemis 6.0: notify subsystems that this is a restore from memento so they
- // can optionally use the cache if desired
- if (ss != null && ss.supportsCaching())
- {
- ss.getCacheManager().setRestoreFromMemento(true);
- }
-
- if (!ss.isOffline()){
- String path = robject.name;
- ISystemFilterReference fref = robject.fRef;
-
- try
- {
- Object actualObject = ss.getObjectWithAbsoluteName(path, monitor);
-
- if (actualObject instanceof IAdaptable)
- {
- // get the adapter
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)actualObject).getAdapter(ISystemViewElementAdapter.class);
-
- // get the context
- ContextObject contextObject = new ContextObject(actualObject, ss, fref);
-
- // get the children
- Object[] children = adapter.getChildren(contextObject, monitor);
-
- ShowRestoredRemoteObject showRunnable = new ShowRestoredRemoteObject(actualObject, children);
- Display.getDefault().asyncExec(showRunnable);
- }
-
- }
- catch (Exception e)
- {
- // unexpected
- }
-
- // yantzi: artemis 6.0: reset restore from memento flag
- if (ss != null && ss.supportsCaching())
- {
- ss.getCacheManager().setRestoreFromMemento(false);
- }
- }
- }
- else if (object instanceof ISystemFilterReference)
- {
-
- ISystemFilterReference fref = (ISystemFilterReference)object;
- ISubSystem ss = fref.getSubSystem();
-
- boolean isRestoringCache = ss.getCacheManager() != null && ss.getCacheManager().isRestoreFromMemento();
-
- if (!ss.isOffline()){
- if (!ss.isConnected() && !isRestoringCache){
- try
- {
- ss.connect(monitor, false);
- }
- catch (Exception e){
- return Status.CANCEL_STATUS;
- }
- }
- if (ss.isConnected() || isRestoringCache)
- {
- // get the adapter
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)object).getAdapter(ISystemViewElementAdapter.class);
-
- // get the context
- ContextObject contextObject = new ContextObject(fref, ss, fref);
-
- // get the children
- Object[] children = adapter.getChildren(contextObject, monitor);
-
- ShowRestoredRemoteObject showRunnable = new ShowRestoredRemoteObject(fref, children);
- Display.getDefault().asyncExec(showRunnable);
- }
- }
- }
- }
- boolean restoreFromCache = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE);
- // yantzi: artemis 6.0, restore memento flag for affected subsystems
- if (restoreFromCache)
- {
- for (int i = 0; i < _cacheSubSystemList.size(); i++)
- {
- ((ISubSystem) _cacheSubSystemList.get(i)).getCacheManager().setRestoreFromMemento(false);
- }
- }
-
- return Status.OK_STATUS;
- }
- }
-
- protected class RemoteObject
- {
- public String name;
- public ISubSystem subsystem;
- public ISystemFilterReference fRef;
- public ISystemFilterStringReference fsRef;
-
- public RemoteObject(String name, ISubSystem ss, ISystemFilterReference fRef, ISystemFilterStringReference fsRef)
- {
- this.name = name;
- this.subsystem = ss;
- this.fRef = fRef;
- this.fsRef = fsRef;
- }
-
- public String toString()
- {
- return "Remote object: " + name; //$NON-NLS-1$
- }
-
- public boolean equals(RemoteObject compared)
- {
- if (name.equals(compared.name) &&
- subsystem == compared.subsystem &&
- fRef == compared.fRef)
- return true;
-
- return false;
- }
- }
-
- protected IPartListener partListener = new IPartListener()
- {
- public void partActivated(IWorkbenchPart part)
- {
- if (part instanceof IEditorPart)
- editorActivated((IEditorPart) part);
- }
- public void partBroughtToTop(IWorkbenchPart part)
- {
- }
- public void partClosed(IWorkbenchPart part)
- {
- }
- public void partDeactivated(IWorkbenchPart part)
- {
- }
- public void partOpened(IWorkbenchPart part)
- {
- }
- };
-
- public class RestoreStateRunnable extends UIJob
- {
- protected IMemento _memento;
- public RestoreStateRunnable(IMemento memento)
- {
- super("Restore RSE Tree"); //$NON-NLS-1$
- _memento = memento;
-
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor)
- {
- IMemento memento = _memento;
- //System.out.println("SYSTEMVIEWPART: restoreState");
- if (!SystemPreferencesManager.getRememberState())
- return Status.CANCEL_STATUS;
-
- // restore the show filter pools and show filter strings settings as they were when this was saved
- boolean showFilterPools = false;
- boolean showFilterStrings = false;
-
-
- String savedValue = memento.getString(TAG_SHOWFILTERPOOLS);
- if (savedValue != null)
- showFilterPools = savedValue.equals("t"); //$NON-NLS-1$
- else
- showFilterPools = SystemPreferencesManager.getShowFilterPools();
- savedValue = memento.getString(TAG_SHOWFILTERSTRINGS); // historical
- if (savedValue != null)
- showFilterStrings = savedValue.equals("t"); //$NON-NLS-1$
- //else
- //showFilterStrings = SystemPreferencesManager.getPreferencesManager().getShowFilterStrings();
-
- IMemento childMem = null;
-
- // restore expand-to hashtable state
- childMem = memento.getChild(TAG_EXPANDED_TO);
- if (childMem != null)
- {
- IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT);
- Hashtable ht = new Hashtable();
- for (int i = 0; i < elementMem.length; i++)
- {
- String key = elementMem[i].getString(TAG_PATH);
- String value = elementMem[i].getString(TAG_FILTER);
- if ((key != null) && (value != null))
- ht.put(key, value);
- }
- if (ht.size() > 0)
- systemView.setExpandToFilterTable(ht);
- }
- // restore expansion state
- childMem = memento.getChild(TAG_EXPANDED);
- Vector remoteElementsToRestore = new Vector();
- List cacheSubSystemList = new ArrayList();
- if (childMem != null)
- {
- ArrayList elements = new ArrayList();
-
- IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT);
-
- // yantzi: artemis6.0, keep track subsystems which have their memento flag set in order
- // to restore system view from cache (if the subsystem supports this)
-
- ISubSystem cacheSubSystem;
- boolean restoreFromCache = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE);
-
- // walk through list of expanded nodes, breaking into 2 lists: non-remote and remote
- for (int i = 0; i < elementMem.length; i++)
- {
- Object element = getObjectFromMemento(showFilterPools, showFilterStrings, elementMem[i].getString(TAG_PATH));
- if (element != null)
- if (element instanceof RemoteObject) // this is a remote object
- {
- remoteElementsToRestore.add(element);
- //System.out.println("Added to remote expansion list: " + element);
- }
- else if (element instanceof ISystemFilterReference)
- {
- remoteElementsToRestore.add(element); // filters trigger asynchronous queries, so best to expand this with remote items
-
- if (restoreFromCache)
- {
- // yantzi: artemis 6.0, see comment above
- cacheSubSystem = ((ISystemFilterReference)element).getSubSystem();
- if (cacheSubSystem.supportsCaching() && cacheSubSystem.getCacheManager() != null)
- {
- cacheSubSystem.getCacheManager().setRestoreFromMemento(true);
- cacheSubSystemList.add(cacheSubSystem);
- }
- }
- }
- else
- {
- elements.add(element);
- //System.out.println("Added to non-remote expansion list: " + element);
- }
- }
- // expand non-remote...
- systemView.setExpandedElements(elements.toArray());
- }
-
- // restoreSelection
- childMem = memento.getChild(TAG_SELECTION);
-
- Vector remoteElementsToSelect = new Vector();
- if (childMem != null)
- {
- ArrayList list = new ArrayList();
-
- IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT);
- for (int i = 0; i < elementMem.length; i++)
- {
- Object element = getObjectFromMemento(showFilterPools, showFilterStrings, elementMem[i].getString(TAG_PATH));
- if (element != null)
- if (element instanceof RemoteObject) // this is a remote object
- remoteElementsToSelect.add(element);
- else
- list.add(element);
- //System.out.println("Added to selection list: " + element);
- }
- if (list.size()>0) {
- systemView.setSelection(new StructuredSelection(list));
- }
- }
-
- if (remoteElementsToRestore.size() > 0)
- {
- RestoreRemoteObjects restoreRemoteJob = new RestoreRemoteObjects(remoteElementsToRestore, cacheSubSystemList, remoteElementsToSelect);
- restoreRemoteJob.schedule();
- }
-
- Tree tree = systemView.getTree();
- //restore vertical position
- ScrollBar bar = tree.getVerticalBar();
- if (bar != null)
- {
- try
- {
- String posStr = memento.getString(TAG_VERTICAL_POSITION);
- if (posStr != null)
- {
- int position;
- position = new Integer(posStr).intValue();
- bar.setSelection(position);
- }
- }
- catch (NumberFormatException e)
- {
- }
- }
- //restore vertical position
- bar = tree.getHorizontalBar();
- if (bar != null)
- {
- try
- {
- String posStr = memento.getString(TAG_HORIZONTAL_POSITION);
- if (posStr != null)
- {
- int position;
- position = new Integer(posStr).intValue();
- bar.setSelection(position);
- }
- }
- catch (NumberFormatException e)
- {
- }
- }
-
-
- String linkWithEditor = memento.getString(TAG_LINKWITHEDITOR);
- if (linkWithEditor != null)
- {
- if (linkWithEditor.equals("t")) //$NON-NLS-1$
- _isLinkingEnabled = true;
- else
- _isLinkingEnabled = false;
- }
- else
- {
- _isLinkingEnabled = false;
- }
-
-
-
- return Status.OK_STATUS;
- }
-
- }
-
- // THE FOLLOWING ARE TO ENABLE PERSISTENCE OF NON-PRIMARY REMOTE SYSTEM EXPLORER VIEWS OPENED UP BY THE
- // USER RIGHT CLICKING AND SELECTING "OPEN IN NEW PERSPECTIVE".
-
- // --------------------------
- // IElementFactory methods...
- // --------------------------
- /**
- * Given the memento created by saveState, for the input to the perspective, recreate the input object
- * at startup time.
- * See the extension point for "org.eclipse.ui.elementFactories" in plugin.xml
- */
- public IAdaptable createElement(IMemento memento)
- {
- //System.out.println("INSIDE CREATEELEMENT IN SYSTEMVIEWPART. TAG_INPUT STRING = "+memento.getString(TAG_INPUT));
- IAdaptable element = null;
- Object object = null;
-
- // restore the show filter pools and show filter strings settings as they were when this was saved
- boolean showFilterPools = false;
- boolean showFilterStrings = false;
- String savedValue = memento.getString(TAG_SHOWFILTERPOOLS);
- if (savedValue != null)
- showFilterPools = savedValue.equals("t"); //$NON-NLS-1$
- else
- showFilterPools = SystemPreferencesManager.getShowFilterPools();
-
- savedValue = memento.getString(TAG_SHOWFILTERSTRINGS);
- if (savedValue != null)
- showFilterStrings = savedValue.equals("t"); //$NON-NLS-1$
- //else
- // showFilterStrings = SystemPreferencesManager.getPreferencesManager().getShowFilterStrings();
-
- object = getObjectFromMemento(showFilterPools, showFilterStrings, memento.getString(TAG_INPUT));
-
- // For now we don't allow secondary perspectives to be opened on remote objects, so we are lucky!
- if (object instanceof RemoteObject)
- {
- }
- else if (object instanceof IAdaptable)
- element = (IAdaptable) object;
- //System.out.println("... RETURNING "+element);
- return element;
- }
-
- // ------------------------------
- // IPersistableElement methods...
- // ------------------------------
- /**
- * Return the element factory ID as declared in the extension point for "org.eclipse.ui.elementFactories" in plugin.xml
- */
- public String getFactoryId()
- {
- //System.out.println("INSIDE GETFACTORYID IN SYSTEMVIEWPART");
- return "org.eclipse.rse.systemview.elementfactory"; //$NON-NLS-1$
- }
-
- /*
- * The workbench is closing, and we are being asked to save the state of the input object in one of the secondary perspectives
- *
- public void saveState(IMemento memento)
- {
-
- }*/
-
- /**
- * The workbench is closing, and we are being asked to save the state of the input object in one of the secondary perspectives.
- * This method is called by our saveState when it detects this is a save for the input vs a page save.
- */
- protected void saveInputState(IMemento memento)
- {
- //System.out.println("INSIDE SAVEINPUTSTATE IN SYSTEMVIEWPART");
- IAdaptable inputObj = getSite().getPage().getInput();
- ISystemViewElementAdapter adapter = systemView.getViewAdapter(inputObj);
- if ((adapter != null) && (adapter.saveExpansionState(inputObj)))
- {
- String handle = getInputMementoHandle(inputObj, adapter);
- if (handle != null)
- {
- //System.out.println("... saving memento string: "+handle);
- memento.putString(TAG_INPUT, handle);
- }
- }
- }
- protected String getInputMementoHandle(Object o, ISystemViewElementAdapter adapter)
- {
- StringBuffer idBuffer = new StringBuffer(adapter.getMementoHandleKey(o));
- idBuffer.append(MEMENTO_DELIM + adapter.getInputMementoHandle(o));
- return idBuffer.toString();
- }
-
- // --------------------------------
- // IAdapterFactory methods...
- // --------------------------------
- /**
- * @see IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList()
- {
- return new Class[] { IPersistableElement.class };
- }
-
- /**
- * Called by our plugin's startup method to register our adaptable object types
- * with the platform. We prefer to do it here to isolate/encapsulate all factory
- * logic in this one place.
- */
- public void registerWithManager(IAdapterManager manager, Object input)
- {
- //System.out.println("INSIDE REGISTERWITHMANAGER IN SYSTEMVIEWPART");
- // these are all the object types we allow the user to select "Open in New Perspective" on...
- manager.registerAdapters(this, input.getClass());
- }
- /**
- * Called by our plugin's startup method to register our adaptable object types
- * with the platform. We prefer to do it here to isolate/encapsulate all factory
- * logic in this one place.
- */
- public void unregisterWithManager(IAdapterManager manager)
- {
- //System.out.println("INSIDE UNREGISTERWITHMANAGER IN SYSTEMVIEWPART");
- // these are all the object types we allow the user to select "Open in New Perspective" on...
- manager.unregisterAdapters(this);
- }
-
- /**
- * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- //System.out.println("INSIDE GETADAPTER IN SYSTEMVIEWPART. adaptableObject = "+adaptableObject+", adapterType = "+adapterType.getName());
- // we don't try to restore these secondary perspectives unless user has elected to do so...
- if (!SystemPreferencesManager.getRememberState())
- return null;
- else
- return this;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartFrameSource.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartFrameSource.java
deleted file mode 100644
index 0650836d7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartFrameSource.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.ui.views.framelist.TreeFrame;
-import org.eclipse.ui.views.framelist.TreeViewerFrameSource;
-
-/**
- * Enables frameset for the Remote System Explorer view part
- */
-class SystemViewPartFrameSource extends TreeViewerFrameSource
-{
-
- // has same interface as org.eclipse.ui.views.navigator.NavigatorFrameSource
-
- private SystemViewPart fSystemViewPart;
-
- SystemViewPartFrameSource(SystemViewPart viewPart)
- {
- super(viewPart.getSystemView());
- fSystemViewPart = viewPart;
- }
-
- protected TreeFrame createFrame(Object input)
- {
- TreeFrame frame = super.createFrame(input);
- frame.setName(fSystemViewPart.getFrameName(input));
- frame.setToolTipText(fSystemViewPart.getFrameToolTipText(input));
- return frame;
- }
-
- /**
- * Also updates the title of the Remote Systems view part
- */
- protected void frameChanged(TreeFrame frame)
- {
- super.frameChanged(frame);
- fSystemViewPart.updateTitle();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartGotoActionGroup.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartGotoActionGroup.java
deleted file mode 100644
index afc81cf81..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPartGotoActionGroup.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.rse.internal.ui.GenericMessages;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.views.framelist.BackAction;
-import org.eclipse.ui.views.framelist.ForwardAction;
-import org.eclipse.ui.views.framelist.FrameList;
-import org.eclipse.ui.views.framelist.UpAction;
-
-
-
-/**
- * Enables typical frameset actions for Remote System Explorer view part
- */
-public class SystemViewPartGotoActionGroup extends ActionGroup
-{
-
- protected SystemViewPart fSystemViewPart;
- protected BackAction backAction;
- protected ForwardAction forwardAction;
- //private GoIntoAction goIntoAction;
- protected UpAction upAction;
-
-
- /**
- * Constructor
- */
- public SystemViewPartGotoActionGroup(SystemViewPart viewPart)
- {
- fSystemViewPart = viewPart;
- makeActions();
- }
-
- /**
- * Returns the RSE view part associated with this action group
- */
- public SystemViewPart getSystemViewPart()
- {
- return fSystemViewPart;
- }
-
- protected void makeActions()
- {
- FrameList frameList = fSystemViewPart.getFrameList();
- //goIntoAction = new GoIntoAction(frameList);
- backAction = new BackAction(frameList);
- forwardAction = new ForwardAction(frameList);
- upAction = new UpAction(frameList);
- }
-
- public void fillContextMenu(IMenuManager menu)
- {
- // we actually don't call this! See instead SystemCascadingGoToAction
- //menu.add(goIntoAction); // done in SystemView
- MenuManager gotoMenu =
- new MenuManager(GenericMessages.ResourceNavigator_goto);
- menu.add(gotoMenu);
- gotoMenu.add(backAction);
- gotoMenu.add(forwardAction);
- gotoMenu.add(upAction);
- }
-
- public void fillActionBars(IActionBars actionBars)
- {
- //actionBars.setGlobalActionHandler(
- // ActionFactory.GO_INTO,
- // goIntoAction);
- actionBars.setGlobalActionHandler(
- ActionFactory.BACK.getId(),
- backAction);
- actionBars.setGlobalActionHandler(
- ActionFactory.FORWARD.getId(),
- forwardAction);
- actionBars.setGlobalActionHandler(ActionFactory.UP.getId(),upAction);
-
- IToolBarManager toolBar = actionBars.getToolBarManager();
- toolBar.add(backAction);
- toolBar.add(forwardAction);
- toolBar.add(upAction);
- }
-
- public void updateActionBars()
- {
- getContext().getSelection();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java
deleted file mode 100644
index 8e413ef34..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPromptableAdapter.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.ui.actions.SystemRunAction;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.model.ISystemPromptableObject;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Adapter for displaying special-case prompt objects in the system views.
- * These are objects that, when expanded, launch a wizard to create something.
- */
-public class SystemViewPromptableAdapter
- extends AbstractSystemViewAdapter
-{
- protected SystemRunAction runAction;
-
- /**
- * Return the actions to show in the popup menu for the current selection
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- ISystemPromptableObject object = (ISystemPromptableObject)selection.getFirstElement();
- if ((object != null) && !object.hasChildren())
- {
- if (runAction == null)
- runAction = getRunAction(shell);
- menu.add(menuGroup, runAction);
- }
- }
-
- /**
- * Only called if the selected object has no children.
- * @param shell the shell.
- * @return the run action.
- */
- protected SystemRunAction getRunAction(Shell shell) {
- return (new SystemRunAction(shell));
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- return ((ISystemPromptableObject)element).getImageDescriptor();
- }
-
- /**
- * Return the label for this object.
- */
- public String getText(Object element)
- {
- return ((ISystemPromptableObject)element).getText();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- return getText(element);
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- return ((ISystemPromptableObject)element).getType();
- }
-
- /**
- * Return the parent of this object.
- */
- public Object getParent(Object element)
- {
- return ((ISystemPromptableObject)element).getParent();
- }
-
- /**
- * Return the children of this object. Not applicable for us.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- // Note: Do _not_ call promptable.run(getShell()) here. It leads only to
- // senseless invocations of the new connection wizard dialog on refreshs!
- // It cannot be a desirable effect of refreshing the system view to create
- // new connections. We leave the invocation of the dialog to the double
- // click handler and the context menu.
- ISystemPromptableObject promptable = (ISystemPromptableObject)element;
- return promptable.getChildren();
- }
-
- /**
- * Return true if this object has children.
- * We return true, as either we'll expand and prompt, or expand and show child prompts
- */
- public boolean hasChildren(IAdaptable element)
- {
- ISystemPromptableObject promptable = (ISystemPromptableObject)element;
- return promptable.hasChildren();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#handleDoubleClick(java.lang.Object)
- */
- public boolean handleDoubleClick(Object element) {
- ISystemPromptableObject promptable = (ISystemPromptableObject)element;
- promptable.run(getShell());
- return true;
- }
-
- /**
- * Return our unique property descriptors
- */
- protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- return null;
- }
- /**
- * Return our unique property values
- */
- public Object internalGetPropertyValue(Object key)
- {
- return null;
- }
- /**
- * Don't show delete
- */
- public boolean showDelete(Object element)
- {
- return false;
- }
-
- /**
- * Don't show rename
- */
- public boolean showRename(Object element)
- {
- return false;
- }
-
- /**
- * Do show refresh, expand and collapse, but only if there are children
- */
- public boolean showRefresh(Object element)
- {
- ISystemPromptableObject promptable = (ISystemPromptableObject)element;
- return promptable.hasChildren();
- }
-
- /**
- * Don't show "Open in new perspective"
- */
- public boolean showOpenViewActions(Object element)
- {
- return false;
- }
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
-
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * This just defaults to getName, but if that is not sufficient override it here.
- */
- public String getMementoHandle(Object element)
- {
- return getName(element);
- }
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- return "Prompt"; //$NON-NLS-1$
- }
-
- /**
- * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
- * messages. In these cases return false from this method. The default is true.
- * <p>
- * WE RETURN FALSE.
- */
- public boolean saveExpansionState(Object element)
- {
- return false;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java
deleted file mode 100644
index 37718f4c2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
- * David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- * Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.osgi.util.NLS;
-
-
-/**
- * Constants used throughout the SystemView plugin
- */
-public class SystemViewResources extends NLS {
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.ui.view.SystemViewResources"; //$NON-NLS-1$
-
- // -------------------------
- // Property names...
- // -------------------------
- // Property sheet values: Common
- public static String RESID_PROPERTY_NBRCHILDREN_LABEL;
- public static String RESID_PROPERTY_NBRCHILDREN_TOOLTIP;
-
- // Property sheet values: Connections
- public static String RESID_PROPERTY_PROFILE_TYPE_VALUE;
-
- public static String RESID_PROPERTY_PROFILESTATUS_LABEL;
- public static String RESID_PROPERTY_PROFILESTATUS_TOOLTIP;
-
- public static String RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL;
-
- public static String RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL;
-
- public static String RESID_PROPERTY_CONNECTION_TYPE_VALUE;
-
- public static String RESID_PROPERTY_SYSTEMTYPE_LABEL;
- public static String RESID_PROPERTY_SYSTEMTYPE_TOOLTIP;
-
- public static String RESID_PROPERTY_CONNECTIONSTATUS_LABEL;
- public static String RESID_PROPERTY_CONNECTIONSTATUS_TOOLTIP;
- public static String RESID_PROPERTY_CONNECTIONSTATUS_CONNECTED_VALUE;
-
- public static String RESID_PROPERTY_CONNECTIONSTATUS_DISCONNECTED_VALUE;
-
-
- public static String RESID_PROPERTY_HOSTNAME_LABEL;
- public static String RESID_PROPERTY_HOSTNAME_TOOLTIP;
-
- public static String RESID_PROPERTY_DEFAULTUSERID_LABEL;
- public static String RESID_PROPERTY_DEFAULTUSERID_TOOLTIP;
-
- public static String RESID_PROPERTY_CONNDESCRIPTION_LABEL;
- public static String RESID_PROPERTY_CONNDESCRIPTION_TOOLTIP;
-
- public static String RESID_PROPERTY_PROFILE_LABEL;
- public static String RESID_PROPERTY_PROFILE_TOOLTIP;
-
-
- // Property sheet values: SubSystems
- public static String RESID_PROPERTY_SUBSYSTEM_TYPE_VALUE;
-
- public static String RESID_PROPERTY_USERID_LABEL;
- public static String RESID_PROPERTY_USERID_TOOLTIP;
-
- public static String RESID_PROPERTY_PORT_LABEL;
- public static String RESID_PROPERTY_PORT_TOOLTIP;
-
- public static String RESID_PROPERTY_CONNECTED_TOOLTIP;
- public static String RESID_PROPERTY_CONNECTED_LABEL;
-
- public static String RESID_PROPERTY_VRM_LABEL;
- public static String RESID_PROPERTY_VRM_TOOLTIP;
-
- // Property sheet values: Filter Pools
- public static String RESID_PROPERTY_FILTERPOOL_TYPE_VALUE;
-
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE;
-
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL;
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP;
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL;
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP;
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL;
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP;
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL;
- public static String RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP;
-
- // Property sheet values: Filters
- public static String RESID_PROPERTY_FILTERSTRING_LABEL;
- public static String RESID_PROPERTY_FILTERSTRING_TOOLTIP;
-
- public static String RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL;
- public static String RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP;
-
- public static String RESID_PROPERTY_FILTERPARENTFILTER_LABEL;
- public static String RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP;
-
- public static String RESID_PROPERTY_FILTERPARENTPOOL_LABEL;
- public static String RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP;
-
- // files - still needed outside of files.ui
- public static String RESID_PROPERTY_FILE_TYPE_FILE_VALUE;
- public static String RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE;
- public static String RESID_PROPERTY_FILE_TYPE_ROOT_VALUE;
-
- public static String RESID_PROPERTY_FILE_PATH_LABEL;
- public static String RESID_PROPERTY_FILE_PATH_TOOLTIP;
-
-
- // Property sheet values: Messages
- public static String RESID_PROPERTY_MESSAGE_TYPE_VALUE;
-
- // Property sheet values: Categories in Team view
- public static String RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE;
- public static String RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE;
- public static String RESID_PROPERTY_TEAM_PROPERTYSET_TYPE_VALUE;
-
- // Miscellaneous / common
- public static String RESID_SCRATCHPAD;
- public static String RESID_REMOTE_SCRATCHPAD;
-
- public static String RESID_FETCHING;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, SystemViewResources.class);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties
deleted file mode 100644
index f8babdf3d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewResources.properties
+++ /dev/null
@@ -1,117 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Initial Contributors:
-# The following IBM employees contributed to the Remote System Explorer
-# component that contains this file: David McKnight, Kushal Munir,
-# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
-# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
-#
-# Contributors:
-# David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
-# David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
-# David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
-# Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
-###############################################################################
-
-# NLS_MESSAGEFORMAT_VAR
-# NLS_ENCODING=UTF-8
-
-#COMMON PROPERTIES
-RESID_PROPERTY_NBRCHILDREN_LABEL=Number of children
-RESID_PROPERTY_NBRCHILDREN_TOOLTIP=Number of children currently under this parent
-
-#CONNECTION PROPERTIES
-RESID_PROPERTY_SYSTEMTYPE_LABEL=Remote system type
-RESID_PROPERTY_SYSTEMTYPE_TOOLTIP=System type of remote host
-RESID_PROPERTY_PROFILE_TYPE_VALUE=Profile
-RESID_PROPERTY_PROFILESTATUS_LABEL=Status
-RESID_PROPERTY_PROFILESTATUS_TOOLTIP=Active status of this profile. Connections and filters are shown for active profiles only
-RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL=Active
-RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL=Not active
-RESID_PROPERTY_CONNECTION_TYPE_VALUE=Connection
-RESID_PROPERTY_CONNECTIONSTATUS_LABEL=Connection status
-RESID_PROPERTY_CONNECTIONSTATUS_TOOLTIP=Connection status of subsystems
-RESID_PROPERTY_CONNECTIONSTATUS_CONNECTED_VALUE=Some subsystems connected
-RESID_PROPERTY_CONNECTIONSTATUS_DISCONNECTED_VALUE=No subsystems connected
-
-RESID_PROPERTY_HOSTNAME_LABEL=Host name
-RESID_PROPERTY_HOSTNAME_TOOLTIP=Host name or IP address of remote system
-
-RESID_PROPERTY_DEFAULTUSERID_LABEL=Default User ID
-RESID_PROPERTY_DEFAULTUSERID_TOOLTIP=Default user ID when no user ID in subsystem
-
-RESID_PROPERTY_CONNDESCRIPTION_LABEL=Description
-RESID_PROPERTY_CONNDESCRIPTION_TOOLTIP=Description of this connection
-
-RESID_PROPERTY_PROFILE_LABEL=Parent profile
-RESID_PROPERTY_PROFILE_TOOLTIP=Profile that owns this connection
-
-
-#SUBSYSTEM PROPERTIES
-RESID_PROPERTY_SUBSYSTEM_TYPE_VALUE=Subsystem
-
-RESID_PROPERTY_USERID_LABEL=User ID
-RESID_PROPERTY_USERID_TOOLTIP=User ID for connecting to this service
-
-RESID_PROPERTY_PORT_LABEL=Port
-RESID_PROPERTY_PORT_TOOLTIP=Port to use when connecting to this remote subsystem
-
-RESID_PROPERTY_CONNECTED_TOOLTIP=Currently connected to this service?
-RESID_PROPERTY_CONNECTED_LABEL=Connected
-
-RESID_PROPERTY_VRM_LABEL=Version
-RESID_PROPERTY_VRM_TOOLTIP=Version, release and modification of remote system, if available
-
-
-#FILTER POOL PROPERTIES
-RESID_PROPERTY_FILTERPOOL_TYPE_VALUE=Filter pool
-RESID_PROPERTY_FILTERPOOLREFERENCE_TYPE_VALUE=Filter pool reference
-
-RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_LABEL=Referenced filter pool
-RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPOOL_TOOLTIP=Filter pool this references
-RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_LABEL=Parent profile
-RESID_PROPERTY_FILTERPOOLREFERENCE_PARENTPROFILE_TOOLTIP=Profile containing referenced filter pool
-RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_LABEL=Related connection
-RESID_PROPERTY_FILTERPOOLREFERENCE_RELATEDCONNECTION_TOOLTIP=If this is a connection-private filter pool, this is the name of that connection
-RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_LABEL=Connection-private
-RESID_PROPERTY_FILTERPOOLREFERENCE_IS_CONNECTIONPRIVATE_TOOLTIP=Is this is a connection-private filter pool, which only exists for this connection?
-
-
-#FILTER PROPERTIES
-RESID_PROPERTY_FILTERSTRING_LABEL=Filter string
-RESID_PROPERTY_FILTERSTRING_TOOLTIP=Filter string used to get this resource
-
-RESID_PROPERTY_FILTERSTRINGS_COUNT_LABEL=Number of filter strings
-RESID_PROPERTY_FILTERSTRINGS_COUNT_TOOLTIP=How many filter strings contained in this filter
-
-RESID_PROPERTY_FILTERPARENTFILTER_LABEL=Parent filter
-RESID_PROPERTY_FILTERPARENTFILTER_TOOLTIP=Filter containing this nested filter
-
-RESID_PROPERTY_FILTERPARENTPOOL_LABEL=Parent filter pool
-RESID_PROPERTY_FILTERPARENTPOOL_TOOLTIP=Filter pool that directly or indirectly contains this filter
-
-# generic files - needed outside of files.ui
-RESID_PROPERTY_FILE_TYPE_FILE_VALUE=File
-RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE=Folder
-RESID_PROPERTY_FILE_TYPE_ROOT_VALUE=Root
-RESID_PROPERTY_FILE_PATH_LABEL=Location
-RESID_PROPERTY_FILE_PATH_TOOLTIP=Path containing this file or folder
-
-#MESSAGE PROPERTIES
-RESID_PROPERTY_MESSAGE_TYPE_VALUE=Message
-
-#TEAM VIEW PROPERTIES
-RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE=Category
-RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE=SubSystem factory
-RESID_PROPERTY_TEAM_PROPERTYSET_TYPE_VALUE=Property set
-
-
-RESID_SCRATCHPAD=Scratchpad
-RESID_REMOTE_SCRATCHPAD=Remote Scratchpad
-
-RESID_FETCHING = Fetching Remote Resources
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java
deleted file mode 100644
index 96cafe7cb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [190195] Cannot enable new connection prompt in system view
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [216252] [nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Adapter for the root-providing object of the SystemView tree viewer.
- */
-public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter
-{
- private SystemNewConnectionPromptObject newConnPrompt;
- private Object[] newConnPromptArray;
-
- /**
- * Ctor
- */
- public SystemViewRootInputAdapter()
- {
-
- }
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given element.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
-
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- return null;
- }
-
- /**
- * Return the label for this object
- */
- public String getText(Object element)
- {
- return SystemResources.RESID_SYSTEMREGISTRY_CONNECTIONS;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- return getText(element);
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- //return "System Root Provider"; // should never be called
- // DKM - MRI hack to get "root"
- return SystemViewResources.RESID_PROPERTY_FILE_TYPE_ROOT_VALUE;
- }
-
- /**
- * Return the parent of this object
- */
- public Object getParent(Object element)
- {
- return null;
- }
-
- /**
- * Return the children of this object
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- ISystemViewInputProvider provider = (ISystemViewInputProvider)element;
-
- if ((provider instanceof ISystemRegistry) && showNewConnectionPrompt())
- {
- Object[] children = provider.getSystemViewRoots();
- if ((children == null) || (children.length == 0))
- {
- return getNewConnectionPromptObjectAsArray();
- }
- else
- {
- Object[] allChildren = new Object[children.length+1];
- allChildren[0] = getNewConnectionPromptObject();
- for (int idx=0; idx<children.length; idx++)
- allChildren[idx+1] = children[idx];
- return allChildren;
- }
- }
- return provider.getSystemViewRoots();
- }
-
- /**
- * Return true if this object has children
- */
- public boolean hasChildren(IAdaptable element)
- {
- ISystemViewInputProvider provider = (ISystemViewInputProvider)element;
- if ((provider instanceof ISystemRegistry) && showNewConnectionPrompt())
- {
- return true;
- }
- return provider.hasSystemViewRoots();
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * We don't support delete at all.
- */
- public boolean showDelete(Object element)
- {
- return false;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * We don't support rename at all.
- */
- public boolean showRename(Object element)
- {
- return false;
- }
- /**
- * Return a validator for verifying the new name is correct.
- */
- public ISystemValidator getNameValidator(Object element)
- {
- return null;
- }
-
- // PRIVATE METHODS...
-
- private boolean showNewConnectionPrompt()
- {
- return SystemPreferencesManager.getShowNewConnectionPrompt();
- }
-
- private SystemNewConnectionPromptObject getNewConnectionPromptObject()
- {
- if (newConnPrompt == null)
- newConnPrompt = new SystemNewConnectionPromptObject();
- return newConnPrompt;
- }
-
- private Object[] getNewConnectionPromptObjectAsArray()
- {
- if (newConnPromptArray == null)
- newConnPromptArray = new Object[1];
- newConnPromptArray[0] = getNewConnectionPromptObject();
- return newConnPromptArray;
- }
- /**
- * Return our unique property descriptors
- */
- protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- return null;
- }
- /**
- * Return our unique property values
- */
- public Object internalGetPropertyValue(Object key)
- {
- return null;
- }
-
-
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * We return "Connections"
- */
- public String getMementoHandle(Object element)
- {
- return "Connections"; // this is what getName() returns, but if we xlate the name we want this to remain in english. //$NON-NLS-1$
- }
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- // this really should not be translated... but changing it now might cause a problem restoring
- // from a previous release. Phil.
- return getType(element);
- //return "root";
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewScratchpadAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewScratchpadAdapter.java
deleted file mode 100644
index 5097b8b62..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewScratchpadAdapter.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.internal.model.SystemScratchpad;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Adapter for the root-providing object of the SystemView tree viewer.
- */
-public class SystemViewScratchpadAdapter extends AbstractSystemViewAdapter implements ISystemRemoteElementAdapter,ISystemDragDropAdapter
-{
-
- private SystemPasteFromClipboardAction _pasteToScratchpadAction = null;
-
- public SystemViewScratchpadAdapter()
- {
- }
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given element.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- if (_pasteToScratchpadAction == null)
- {
- _pasteToScratchpadAction = new SystemPasteFromClipboardAction(shell, RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard());
- }
- menu.add(menuGroup, _pasteToScratchpadAction);
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- return null;
- }
-
- /**
- * Return the label for this object
- */
- public String getText(Object element)
- {
- return SystemViewResources.RESID_REMOTE_SCRATCHPAD;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- return getText(element);
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- return SystemViewResources.RESID_SCRATCHPAD;
- }
-
- /**
- * Return the parent of this object
- */
- public Object getParent(Object element)
- {
- return null;
- }
-
- /**
- * Return the children of this object
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- SystemScratchpad pad = (SystemScratchpad)element;
- return pad.getChildren();
- }
-
- /**
- * Return true if this object has children
- */
- public boolean hasChildren(IAdaptable element)
- {
- SystemScratchpad pad = (SystemScratchpad)element;
- return pad.hasChildren();
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * We don't support delete at all.
- */
- public boolean showDelete(Object element)
- {
- return false;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * We don't support rename at all.
- */
- public boolean showRename(Object element)
- {
- return false;
- }
- /**
- * Return a validator for verifying the new name is correct.
- */
- public ISystemValidator getNameValidator(Object element)
- {
- return null;
- }
-
-
- /**
- * Return our unique property descriptors
- */
- protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- return null;
- }
- /**
- * Return our unique property values
- */
- public Object internalGetPropertyValue(Object key)
- {
- return null;
- }
-
-
- public boolean canDrop(Object element)
- {
- return true;
- }
-
- public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
- {
- if (to instanceof SystemScratchpad)
- {
- if (from instanceof List)
- {
- List set = (List)from;
- for (int i = 0;i < set.size(); i++)
- {
- ((SystemScratchpad)to).addChild(set.get(i));
- }
- }
- else
- {
- ((SystemScratchpad)to).addChild(from);
- }
- return from;
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getAbsoluteParentName(java.lang.Object)
- */
- public String getAbsoluteParentName(Object element)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getSubSystemConfigurationId(java.lang.Object)
- */
- public String getSubSystemConfigurationId(Object element)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteTypeCategory(java.lang.Object)
- */
- public String getRemoteTypeCategory(Object element)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteType(java.lang.Object)
- */
- public String getRemoteType(Object element)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubType(java.lang.Object)
- */
- public String getRemoteSubType(Object element)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#refreshRemoteObject(java.lang.Object, java.lang.Object)
- */
- public boolean refreshRemoteObject(Object oldElement, Object newElement)
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParent(org.eclipse.swt.widgets.Shell, java.lang.Object)
- */
- public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteParentNamesInUse(org.eclipse.swt.widgets.Shell, java.lang.Object)
- */
- public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean validateDrop(Object src, Object target, boolean sameSystem)
- {
- return true;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewSubSystemAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewSubSystemAdapter.java
deleted file mode 100644
index 5546b573a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewSubSystemAdapter.java
+++ /dev/null
@@ -1,818 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David Dykstal (IBM) - [217556] remove service subsystem types
- * Martin Oberhuber (Wind River) - [195399] Improve String display for default port 0
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapter;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorPortInput;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-
-
-/**
- * Adapter for displaying SubSystem objects in tree views.
- * These are children of SystemConnection objects
- */
-public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
-{
- protected String translatedType;
- // for reset property support
- private String original_portData;
- private SystemInheritablePropertyData original_userIdData = new SystemInheritablePropertyData();
- //private SystemInheritablePropertyData original_portData = new SystemInheritablePropertyData();
- private TextPropertyDescriptor propertyPortDescriptor;
- private boolean changed_userId, changed_port;
- private boolean port_editable = true;
- // -------------------
- // property descriptors
- // -------------------
- private PropertyDescriptor[] propertyDescriptorArray = null;
- //private SystemInheritablePropertyData portData = new SystemInheritablePropertyData();
- //private SystemInheritableTextPropertyDescriptor portDescriptor;
- private SystemInheritablePropertyData userIdData = new SystemInheritablePropertyData();
- private SystemInheritableTextPropertyDescriptor userIdDescriptor = null;
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given subsystem object.
- * Calls the method getActions on the subsystem's factory, and places
- * all action objects returned from the call, into the menu.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- // does not make sense adding unique actions per multi-selection
- if (selection.size() == 1) {
- Object element = selection.getFirstElement();
- ISubSystem ss = (ISubSystem)element;
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter == null) {
- // FIXME Fallback to default SubSystemConfigurationAdapter, such
- // that we get at least the "connect" and other common actions
- // for subsystems before their adapter is loaded. Note that this
- // means that the popular "launch Shell" action will not be
- // available before the rse.shells.ui plugin is loaded; but that
- // should be fixed by contributing that action via plugin.xml,
- // rather than forcing full bundle activation here from the
- // menu. See
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=226550
- // //adapter = new SubSystemConfigurationAdapter();
- Platform.getAdapterManager().loadAdapter(ssFactory, ISubSystemConfigurationAdapter.class.getName());
- adapter = (ISubSystemConfigurationAdapter) ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- // if (adapter == null) {
- // //TODO is this right? It deprives clients from the ability
- // //to get rid of the standard actions contributed by the
- // //default adapter. We shouldn't do that.
- // adapter = new SubSystemConfigurationAdapter();
- // }
- }
- if (adapter != null) {
- // Lazy Loading: Dynamic contributed subsystem actions will be
- // provided only once the corresponding plugin is activated
- // (adapter factory loaded). This means, that by default,
- // dynamic actions are only shown after connecting a subsystem.
- // If a subsystem needs to show these earlier, it needs to
- // provision for eager bundle activation to ensure that its
- // ISubSystemConfigurationAdapter is loaded -- or, provide these
- // actions by static plugin.xml markup.
- IAction[] actions = adapter.getSubSystemActions(menu, selection, shell, menuGroup, ssFactory, ss);
- if (actions != null)
- {
- for (int idx = 0; idx < actions.length; idx++) {
- IAction action = actions[idx];
- menu.add(menuGroup, action);
- }
- }
- }
- }
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, new GroupMarker(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING));// user or BP/ISV additions
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- //System.out.println("INSIDE GETIMAGEDESCRIPTOR FOR SUBSYSTEM VIEW ADAPTER: "+element);
- ISubSystem ss = (ISubSystem)element;
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
- if (ssFactory != null)
- {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- if (ss.isConnected())
- return adapter.getLiveImage(ssFactory);
- else
- return adapter.getImage(ssFactory);
- } else {
- // get image from proxy
- ISubSystemConfigurationProxy proxy = ssFactory.getSubSystemConfigurationProxy();
- SubSystemConfigurationProxyAdapter proxyAdapter = (SubSystemConfigurationProxyAdapter) Platform.getAdapterManager().getAdapter(proxy,
- SubSystemConfigurationProxyAdapter.class);
- if (proxyAdapter != null) {
- if (ss.isConnected())
- return proxyAdapter.getLiveImageDescriptor();
- else
- return proxyAdapter.getImageDescriptor();
- } else {
- SystemBasePlugin.logWarning("Unexpected error: SubSystemConfiguration has no adapter and no proxyAdapter: " + ss.getName()); //$NON-NLS-1$
- return null;
- }
- }
- }
- else
- {
- SystemBasePlugin.logWarning("Unexpected error: SubSystemConfiguration is null for ss " + ss.getName()); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Return the label for this object. Uses getName() on the subsystem object.
- */
- public String getText(Object element)
- {
- return ((ISubSystem)element).getName();
- }
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return ((ISubSystem)element).getName();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- ISubSystem ss = (ISubSystem)element;
- String suffix = ss.getName();
- Class serviceType = ss.getServiceType();
- if (serviceType != null) {
- suffix = serviceType.toString();
- }
- return ss.getSystemProfileName() + "." + ss.getHostAliasName() + "." + suffix; //$NON-NLS-1$ //$NON-NLS-2$
- }
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- if (translatedType == null)
- translatedType = SystemViewResources.RESID_PROPERTY_SUBSYSTEM_TYPE_VALUE;
- return translatedType;
- }
-
-
- /**
- * Return the parent of this object. This is a connection object.
- */
- public Object getParent(Object element)
- {
- //System.out.println("INSIDE GETPARENT FOR SUBSYSTEM VIEW ADAPTER: "+element);
- ISubSystem ss = (ISubSystem)element;
- return RSECorePlugin.getTheSystemRegistry().getHost(ss.getSystemProfile(),ss.getHostAliasName());
- }
-
- /**
- * Return the children of this object
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- //System.out.println("INSIDE GETCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element);
- ISubSystem ss = (ISubSystem)element;
- Object[] children = ss.getChildren();
- return children;
- }
-
- /**
- * Return true if this object has children
- */
- public boolean hasChildren(IAdaptable element)
- {
- //System.out.println("INSIDE HASCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element);
- ISubSystem ss = (ISubSystem)element;
- return ss.hasChildren();
- }
-
- // ----------------------------------
- // Property sheet supplier methods...
- // ----------------------------------
-
- /**
- * Returns the current collection of property descriptors for connection objects.
- * @return an array containing all descriptors.
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- PropertyDescriptor[] defaultProperties = (PropertyDescriptor[])getDefaultDescriptors();
- propertyDescriptorArray = new PropertyDescriptor[defaultProperties.length + 4];
- int idx = 0;
- for (idx = 0; idx < defaultProperties.length; idx++)
- propertyDescriptorArray[idx] = defaultProperties[idx];
-
- // add our unique property descriptors...
- //idx = defaultProperties.length; assertion
-
- // user id
- //propertyDescriptorArray[idx] = new TextPropertyDescriptor(ISystemPropertyConstants.P_USERID,
- // SystemViewResources.RESID_PROPERTY_USERID_LABEL));
- userIdDescriptor =
- new SystemInheritableTextPropertyDescriptor(ISystemPropertyConstants.P_USERID,
- SystemViewResources.RESID_PROPERTY_USERID_LABEL);
-
- userIdDescriptor.setToggleButtonToolTipText(SystemResources.RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP);
- userIdDescriptor.setEntryFieldToolTipText(SystemResources.RESID_SUBSYSTEM_USERID_TIP);
- propertyDescriptorArray[idx] = userIdDescriptor;
- propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_USERID_TOOLTIP);
-
- // port
- propertyPortDescriptor = new TextPropertyDescriptor(ISystemPropertyConstants.P_PORT,
- SystemViewResources.RESID_PROPERTY_PORT_LABEL);
- propertyPortDescriptor.setDescription(SystemViewResources.RESID_PROPERTY_PORT_TOOLTIP);
- propertyPortDescriptor.setValidator(new ValidatorPortInput());
- propertyDescriptorArray[++idx] = propertyPortDescriptor;
- //propertyDescriptorArray[++idx] = getPortDescriptor();
-
- // connected
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_CONNECTED, SystemViewResources.RESID_PROPERTY_CONNECTED_LABEL, SystemViewResources.RESID_PROPERTY_CONNECTED_TOOLTIP);
-
- // vrm
- propertyDescriptorArray[++idx] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_VRM, SystemViewResources.RESID_PROPERTY_VRM_LABEL, SystemViewResources.RESID_PROPERTY_VRM_TOOLTIP);
- }
- return propertyDescriptorArray;
- }
- /**
- * Return our unique property descriptors
- */
- protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- return null;
- }
-
- /**
- * Create (first time), configure and return the property descriptor for the port number
- *
- private SystemInheritableTextPropertyDescriptor getPortDescriptor()
- {
- if (portDescriptor == null)
- {
- SystemViewPlugin plugin = SystemViewPlugin.getDefault();
- RSEUIPlugin sp = RSEUIPlugin.getDefault();
- portDescriptor =
- new SystemInheritableTextPropertyDescriptor(ISystemPropertyConstants.P_PORT,
- SystemViewResources.RESID_PROPERTY_PORT_LABEL));
- portDescriptor.setToggleButtonToolTipText(SystemResources.RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP));
- portDescriptor.setEntryFieldToolTipText(SystemResources.RESID_SUBSYSTEM_PORT_TIP));
- portDescriptor.setDescription(SystemViewResources.RESID_PROPERTY_PORT_DESCRIPTION));
- }
- return portDescriptor;
- }*/
-
- /**
- * Set the values in the userIdPropertyData object that drives the userId property sheet widget
- */
- private SystemInheritablePropertyData setUserIdPropertyData(SystemInheritablePropertyData data, ISubSystem subsys)
- {
- String localUserId = subsys.getLocalUserId();
- data.setLocalValue(localUserId);
- String parentUserId = subsys.getHost().getDefaultUserId();
- data.setInheritedValue(parentUserId);
- data.setIsLocal((localUserId!=null)&&(localUserId.length()>0));
-
- // DY: Defect 42735, check if user has temporarilly overrode the userid
- // for this connection via the signon dialog
- if (subsys.isConnected())
- {
- String connectedId = subsys.getConnectorService().getUserId();
- //On Local subsystems, connectedId==null. Phil.
- if (data.getIsLocal() && connectedId!=null && !connectedId.equals(localUserId))
- {
- data.setLocalValue(connectedId);
- data.setIsLocal(true);
- }
- else if (connectedId!=null && !connectedId.equals(parentUserId))
- {
- data.setLocalValue(connectedId);
- data.setIsLocal(true);
- }
- }
-
- return data;
- }
-
- /**
- * Set the values in the portPropertyData object that drives the port property sheet widget
- *
- private SystemInheritablePropertyData setPortPropertyData(SystemInheritablePropertyData data, SubSystem subsys)
- {
- Integer localPort = subsys.getPort();
- int iPort = 0;
- if (localPort != null)
- iPort = localPort.intValue();
- if (iPort > 0)
- data.setLocalValue(localPort.toString());
- else
- data.setLocalValue(null); // clear history
- SubSystemConfiguration ssFactory = subsys.getParentSubSystemConfiguration();
- boolean notApplicable = (!ssFactory.isPortEditable() && (iPort <= 0));
- if (!notApplicable)
- {
- data.setInheritedValue("0");
- data.setInheritedDisplayString(NLS.bind(SystemPropertyResources.RESID_PORT_DYNAMICSELECT, "0")); //$NON-NLS-1$
- data.setIsLocal(iPort != 0);
- }
- data.setNotApplicable(notApplicable);
- getPortDescriptor().setEditable(!notApplicable);
- //data.printDetails();
- return data;
- }
- */
-
- private String getPortString(ISubSystem ss)
- {
- //return getPortPropertyData(portData, ss);
- int iPort = ss.getConnectorService().getPort();
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
- boolean notApplicable = (!ssFactory.isPortEditable() && (iPort <= 0));
- if (notApplicable)
- return getTranslatedNotApplicable();
- else
- {
- return Integer.toString(iPort);
- }
- }
-
- /**
- * Returns the current value for the named property.
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param property the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- public Object getPropertyValue(Object property)
- {
- String name = (String)property;
- ISubSystem ss = (ISubSystem)propertySourceInput;
- if (name.equals(ISystemPropertyConstants.P_USERID))
- return setUserIdPropertyData(userIdData, ss);
- else if (name.equals(ISystemPropertyConstants.P_PORT))
- return getPortString(ss);
- else if (name.equals(ISystemPropertyConstants.P_VRM))
- {
- IConnectorService system = ss.getConnectorService();
- if (system != null)
- {
- String vrm = system.getVersionReleaseModification();
- if (vrm != null)
- return vrm;
- else
- return getTranslatedNotAvailable();
- }
- else
- return getTranslatedNotAvailable();
- }
- else if (name.equals(ISystemPropertyConstants.P_IS_CONNECTED))
- {
- // yantzi: artemis 6.0, offline support
- if (ss.getHost().isOffline())
- {
- // connection is offline
- return SystemResources.RESID_OFFLINE_LABEL;
- }
-
- IConnectorService system = ss.getConnectorService();
- boolean connected = false;
- if (system == null)
- {
- System.out.println("SystemViewSubSystemAdapter: Error! system is null for subsystem "+ss.getClass().getName()); //$NON-NLS-1$
- SystemBasePlugin.logError("SystemViewSubSystemAdapter: Error! system is null for subsystem "+ss.getClass().getName(), null); //$NON-NLS-1$
- }
- else
- connected = system.isConnected();
- return connected ? getTranslatedYes() : getTranslatedNo();
- }
- else
- return super.getPropertyValue(name);
- }
-
- /**
- * Returns itself
- */
- public ISubSystem getSubSystem(Object element)
- {
- if (element instanceof ISubSystem)
- return (ISubSystem)element;
- else
- return null;
- }
-
- /**
- * Return our unique property values
- */
- public Object internalGetPropertyValue(Object key)
- {
- return null;
- }
-
- // because this node has some editable properties, these overrides of our
- // parent class are needed as callbacks from the PropertySheet window.
- /**
- * Set input object for property source queries. This is called by the
- * SystemViewAdaptorFactory before returning this adapter object.
- */
- public void setPropertySourceInput(Object propertySourceInput)
- {
- if (this.propertySourceInput == propertySourceInput)
- return;
- super.setPropertySourceInput(propertySourceInput);
- ISubSystem ss = (ISubSystem)propertySourceInput;
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
- original_userIdData = setUserIdPropertyData(original_userIdData,ss);
- //original_portData = setPortPropertyData(original_portData,ss);
- original_portData = getPortString(ss);
- changed_userId = changed_port = false;
-
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- // Lazy Loading: Since this is called from opening a context
- // menu, Dynamic Validator will only be available once the
- // ISubSystemConfigurationAdapter is loaded, i.e. after
- // connecting.
- // If a subsystem wants to provision for having the validator
- // available earlier, it needs to eagerly load the bundle that
- // declares its ISubSystemConfigurationAdapter.
- if (userIdDescriptor != null) {
- userIdDescriptor.setValidator(adapter.getUserIdValidator(ssFactory));
- }
- // getPortDescriptor().setValidator((ICellEditorValidator)ssFactory.getPortValidator());
- if (propertyPortDescriptor != null) {
- propertyPortDescriptor.setValidator(adapter.getPortValidator(ssFactory));
- }
- }
-
- ss.getConnectorService().getPort();
- port_editable = ssFactory.isPortEditable();
- }
-
- /**
- * Returns whether the property value has changed from the default.
- * Only applicable for editable properties.
- * Called by PropertySheet viewer when user presses reset.
- * @return <code>true</code> if the value of the specified property has changed
- * from its original default value; <code>false</code> otherwise.
- */
- public boolean isPropertySet(Object propertyObject)
- {
- String property = (String)propertyObject;
- boolean changed = false;
- if (property.equals(ISystemPropertyConstants.P_USERID))
- changed = changed_userId;
- else if (property.equals(ISystemPropertyConstants.P_PORT))
- changed = changed_port && port_editable;
- return changed;
- }
-
- /**
- * Change the subsystem user Id value
- */
- private void updateUserId(ISubSystem subsys, SystemInheritablePropertyData data)
- {
- //int whereToUpdate = USERID_LOCATION_SUBSYSTEM;
- String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
- ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
- // unlike with connection objects, we don't ever allow the user to change the parent's
- // userId value, even if it is empty, when working with subsystems. There is too much
- // ambiquity as the parent could be the connnection or the user preferences setting for this
- // system type. Because of this decision, we don't need to tell updateSubSystem(...) where
- // to update, as it always the local subsystem.
- ssFactory.updateSubSystem(subsys, true, userId, false, subsys.getConnectorService().getPort());
- }
- /**
- * Change the subsystem port value
- *
- private void updatePort(SubSystem subsys, SystemInheritablePropertyData data)
- {
- String port = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override
- Integer portInteger = null;
- if (data.getIsLocal() && (port.length()>0))
- portInteger = new Integer(port);
- else
- portInteger = new Integer(0);
- SubSystemConfiguration ssFactory = subsys.getParentSubSystemConfiguration();
- ssFactory.updateSubSystem((Shell)null, subsys, false, subsys.getLocalUserId(), true, portInteger);
- }
- */
- /**
- * Change the subsystem port value
- */
- private void updatePort(ISubSystem subsys, String data)
- {
- if (!port_editable)
- return;
- String port = data;
- Integer portInteger = null;
- if (port.length()>0)
- {
- try
- {
- portInteger = new Integer(port);
- }
- catch (Exception exc)
- {
- return;
- }
- }
- else
- {
- portInteger = new Integer(0);
- }
- int portInt = portInteger.intValue();
- ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
- ssFactory.updateSubSystem(subsys, false, subsys.getLocalUserId(), true, portInt);
- subsys.commit();
- }
-
-
- /**
- * Called when user selects the reset button in property sheet.
- */
- public void resetPropertyValue(Object propertyObject)
- {
- String property = (String)propertyObject;
- ISubSystem ss = (ISubSystem)propertySourceInput;
- ss.getSubSystemConfiguration();
- if (property.equals(ISystemPropertyConstants.P_USERID))
- {
- updateUserId(ss, original_userIdData);
- changed_userId = false;
- }
- else if (property.equals(ISystemPropertyConstants.P_PORT))
- {
- //updatePort(ss, original_portData);
- updatePort(ss, original_portData);
- changed_port = false;
- }
- }
- /**
- * Called when user changes property via property sheet.
- */
- public void setPropertyValue(Object property, Object value)
- {
- String name = (String)property;
- ISubSystem ss = (ISubSystem)propertySourceInput;
- ss.getSubSystemConfiguration();
- //System.out.println("inside setPropVal: " + property + ", value: " + value);
- if (name.equals(ISystemPropertyConstants.P_USERID))
- {
- updateUserId(ss, (SystemInheritablePropertyData)value);
- changed_userId = true;
- }
- else if (name.equals(ISystemPropertyConstants.P_PORT))
- {
- //System.out.println("inside setPropVal: " + property + ", value: " + value);
- //updatePort(ss, (SystemInheritablePropertyData)value);
- updatePort(ss, (String)value);
- changed_port = true;
- }
- }
-
- /**
- * Override of {@link AbstractSystemViewAdapter#testAttribute(Object, String, String)}. We add
- * one more attribute for subsystems:
- * <ol>
- * <li>name="serverLaunchPP". Returns "true" if the given subsystem supports the Server Launch Settings
- * property page, which is determined by calling it's factory's {@link ISubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.core.model.IHost)} method.
- * </ol>
- *
- * This property is used to filter the existence of the Server Launch Settings property page.
- *
- * @see org.eclipse.ui.IActionFilter#testAttribute(Object, String, String)
- */
- public boolean testAttribute(Object target, String name, String value)
- {
- if (target instanceof ISubSystem)
- {
- if (name.equalsIgnoreCase("serverLaunchPP")) //$NON-NLS-1$
- {
- ISubSystem ss = (ISubSystem)target;
- boolean supports = ss.getSubSystemConfiguration().supportsServerLaunchProperties(ss.getHost());
- return supports ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else if (name.equalsIgnoreCase("envVarPP")) //$NON-NLS-1$
- {
- /** FIXME can't access specific subsystems from core anymore
- boolean supports = false;
- if (ss instanceof IRemoteFileSubSystem)
- supports = ((IRemoteFileSubSystemConfiguration)ss.getParentSubSystemConfiguration()).supportsEnvironmentVariablesPropertyPage();
- else
- supports = ((IRemoteCmdSubSystemConfiguration)ss.getParentSubSystemConfiguration()).supportsEnvironmentVariablesPropertyPage();
- */
- boolean supports = false;
- return supports ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else if (name.equalsIgnoreCase("isConnectionError")) //$NON-NLS-1$
- {
- ISubSystem ss = (ISubSystem) target;
- boolean error = ss.isConnectionError();
- return error ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return super.testAttribute(target, name, value);
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * Return true if we should show the delete action in the popup for the given element.
- * If true, then canDelete will be called to decide whether to enable delete or not.
- */
- public boolean showDelete(Object element)
- {
- return canDelete(element);
- }
-
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element)
- {
- //System.out.println("INSIDE ISDELETABLE FOR SUBSYSTEM VIEW ADAPTER: "+element);
- ISubSystem ss = (ISubSystem)element;
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
- return ssFactory.isSubSystemsDeletable();
- }
-
- /**
- * Perform the delete action.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor)
- {
- //System.out.println("INSIDE DODELETE FOR SUBSYSTEM VIEW ADAPTER: "+element);
- ISubSystem ss = (ISubSystem)element;
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.deleteSubSystem(ss);
- return true;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * Return true if we should show the rename action in the popup for the given element.
- * If true, then canRename will be called to decide whether to enable delete or not.
- */
- public boolean showRename(Object element)
- {
- return canRename(element);
- }
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename menu item will be enabled.
- */
- public boolean canRename(Object element)
- {
- return canDelete(element); // same rules for both delete and rename
- }
-
- /**
- * Perform the rename action. Assumes uniqueness checking was done already.
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor)
- {
- ISubSystem ss = (ISubSystem)element;
- ISubSystemConfiguration parentSSFactory = ss.getSubSystemConfiguration();
- parentSSFactory.renameSubSystem(ss,name); // renames, and saves to disk
- return true;
- }
-
- /**
- * Return a validator for verifying the new name is correct on a rename action.
- * The default implementation is not to support rename hence this method returns
- * null. Override if appropriate.
- */
- public ISystemValidator getNameValidator(Object element)
- {
- return null;
- }
-
- // FOR COMMON DRAG AND DROP ACTIONS
- /**
- * Indicates whether the subsystem can be dragged.
- * Can't be used for physical copies but rather
- * for views (like the Scratchpad)
- */
- public boolean canDrag(Object element)
- {
- return true;
- }
-
- /**
- * Returns the subsystem (no phyiscal operation required to drag and subsystem (because it's local)
- */
- public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
- {
- return element;
- }
-
-
-
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
-
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * This just defaults to getName, but if that is not sufficient override it here.
- */
- public String getMementoHandle(Object element)
- {
- ISubSystem ss = (ISubSystem)element;
- ISubSystemConfiguration ssf = ss.getSubSystemConfiguration();
- return ssf.getId()+"="+ss.getName(); //$NON-NLS-1$
- }
- /**
- * Return what to save to disk to identify this element when it is the input object to a secondary
- * Remote System Explorer perspective.
- */
- public String getInputMementoHandle(Object element)
- {
- Object parent = getParent(element);
- return SystemAdapterHelpers.getViewAdapter(parent, getViewer()).getInputMementoHandle(parent) + MEMENTO_DELIM + getMementoHandle(element);
- }
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- return ISystemMementoConstants.MEMENTO_KEY_SUBSYSTEM;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/BrowseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/BrowseAction.java
deleted file mode 100644
index 250581ae1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/BrowseAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-class BrowseAction extends Action
-{
- protected final SystemMonitorViewPart part;
-
- public BrowseAction(SystemMonitorViewPart part)
- {
- super();
- this.part = part;
- }
-
- public BrowseAction(SystemMonitorViewPart part, String label, ImageDescriptor des)
- {
- super(label, des);
- this.part = part;
-
- setToolTipText(label);
- }
-
- public void checkEnabledState()
- {
- if (this.part._folder != null && this.part._folder.getInput() != null)
- {
- setEnabled(true);
- }
- else
- {
- setEnabled(false);
- }
- }
-
- public void run()
- {
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearAction.java
deleted file mode 100644
index 87b800b27..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-public class ClearAction extends BrowseAction
-{
-
- public ClearAction(SystemMonitorViewPart view)
- {
- super(view, SystemResources.ACTION_CLEAR_ALL_LABEL,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_ALL_ID));
-
- setToolTipText(SystemResources.ACTION_CLEAR_ALL_TOOLTIP);
- // TODO DKM - get help for this!
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CLEAR_CONSOLE_ACTION);
- }
-
- public void checkEnabledState()
- {
- setEnabled(part.getViewer() != null);
- }
-
- public void run()
- {
- clear();
- }
-
- // clear contents of the current command viewer
- private void clear()
- {
- part.removeAllItemsToMonitor();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearSelectedAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearSelectedAction.java
deleted file mode 100644
index a30f9f804..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/ClearSelectedAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-
-
-public class ClearSelectedAction extends BrowseAction
-{
- public ClearSelectedAction(SystemMonitorViewPart view)
- {
- super(view, SystemResources.ACTION_CLEAR_SELECTED_LABEL,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_SELECTED_ID));
-
- setToolTipText(SystemResources.ACTION_CLEAR_SELECTED_TOOLTIP);
- // TODO DKM - get help for this!
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CLEAR_CONSOLE_ACTION);
- }
-
- public void checkEnabledState()
- {
- if (part.getViewer() != null)
- {
- setEnabled(true);
- return;
- }
-
- setEnabled(false);
- }
-
- public void run()
- {
- clear();
- }
-
- private void clear()
- {
- part.removeItemToMonitor((IAdaptable)part.getViewer().getInput());
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewPage.java
deleted file mode 100644
index 775c5e63d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewPage.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [180562] dont implement ISystemThemeConstants
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [177587] changed wrapped selection provider in setFocus()
- * Kevin Doyle (IBM) - [212940] Duplicate Help Context Identifiers
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-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.SelectionChangedEvent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemTableView;
-import org.eclipse.rse.ui.view.SystemTableViewProvider;
-import org.eclipse.rse.ui.widgets.ISystemCollapsableSectionListener;
-import org.eclipse.rse.ui.widgets.SystemCollapsableSection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Scale;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-
-
-/**
- * Class for a remote shell session on a connection
- */
-public class MonitorViewPage implements SelectionListener, IPropertyChangeListener, ISelectionChangedListener, Listener,
-FocusListener
-{
- private static SystemMessage _queryMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_QUERY_PROGRESS);
-
- class PollingThread extends Thread
- {
- private boolean _querying = false;
- private ISystemViewElementAdapter _adapter;
- private Object _inputObject;
-
-
- public PollingThread()
- {
- _inputObject = _viewer.getInput();
- _adapter = (ISystemViewElementAdapter)((IAdaptable)_inputObject).getAdapter(ISystemViewElementAdapter.class);
- }
-
- public void run()
- {
- while (isPollingEnabled())
- {
- int interval = getPollingInterval() * 1000;
- try
- {
- Thread.sleep(interval);
- doQuery();
- // while (_querying)
- // {
- // Thread.sleep(100);
- // }
- doRedraw();
- }
- catch (InterruptedException e)
- {
-
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- }
-
- protected void doQuery()
- {
-
- Display display = Display.getDefault();
- if (display != null && !_querying)
- {
- _querying= true;
- if (_inputObject instanceof ISystemContainer)
- {
- ((ISystemContainer)_inputObject).markStale(true);
- }
- ISubSystem ss = _adapter.getSubSystem(_inputObject);
- if (!ss.isConnected())
- return;
-
- String name = _adapter.getName(_inputObject);
- _queryMessage.makeSubstitution(name);
- String txt = _queryMessage.getLevelOneText();
- Job job = new Job(txt)
- {
- public IStatus run(IProgressMonitor monitor)
- {
- Object[] children = _adapter.getChildren((IAdaptable)_inputObject, monitor);
- if (children != null)
- {
- SystemTableViewProvider provider = (SystemTableViewProvider)_viewer.getContentProvider();
- if (provider!=null) {
- //bug 150924: provider can be lost when disconnecting while this job runs
- provider.setCache(children);
- }
-
- }
-
- _querying = false;
- return Status.OK_STATUS;
- }
- };
-
- job.schedule();
-
- try
- {
- job.wait();
- }
- catch (Exception e)
- {
-
- }
- }
-
- }
-
- protected void doRedraw()
- {
- Display display = Display.getDefault();
- if (display != null)
- {
- display.asyncExec(
- new Runnable()
- {
- public void run()
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.fireEvent(new SystemResourceChangeEvent(_inputObject, ISystemResourceChangeEvents.EVENT_CHANGE_CHILDREN, _inputObject));
- //getViewer().refresh();
- }
- });
- }
- }
- }
-
- class SelectAllAction extends Action
- {
- public SelectAllAction()
- {
- super(SystemResources.ACTION_SELECT_ALL_LABEL, null);
- setToolTipText(SystemResources.ACTION_SELECT_ALL_TOOLTIP);
- }
-
- public void checkEnabledState()
- {
- setEnabled(true);
- }
-
- public void run()
- {
- SystemTableView view = _viewer;
- view.getTable().selectAll();
- view.setSelection(view.getSelection());
- }
- }
-
-
- private SystemTableView _viewer;
-
- private boolean _isPolling = false;
- private int _pollingInterval;
-
- private Group _tabFolderPage;
- private Button _pollCheckbox;
- private Scale _scale;
- private Text _scaleValue;
-
- private PollingThread _pollingThread;
-
- private SystemMonitorViewPart _viewPart;
-
- private String _title;
-
- private SystemCopyToClipboardAction _copyAction;
- private SystemPasteFromClipboardAction _pasteAction;
- private SelectAllAction _selectAllAction;
- private IActionBars _actionBars;
-
- public MonitorViewPage(SystemMonitorViewPart viewPart)
- {
- _viewPart = viewPart;
- _actionBars = _viewPart.getViewSite().getActionBars();
- }
-
-
-
- public Composite createTabFolderPage(CTabFolder tabFolder, CellEditorActionHandler editorActionHandler)
- {
- _tabFolderPage = new Group(tabFolder, SWT.NULL);
- GridLayout gridLayout = new GridLayout();
- _tabFolderPage.setLayout(gridLayout);
-
- createControl(_tabFolderPage);
-
- // global actions
- Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
- _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard);
- _copyAction.setEnabled(false);
-
- _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard);
- _pasteAction.setEnabled(false);
-
- editorActionHandler.setCopyAction(_copyAction);
- editorActionHandler.setPasteAction(_pasteAction);
-
- _selectAllAction = new SelectAllAction();
- _selectAllAction.setEnabled(false);
- editorActionHandler.setSelectAllAction(_selectAllAction);
-
-
- _viewer.addSelectionChangedListener(this);
- _viewer.getControl().addFocusListener(this);
-
- return _tabFolderPage;
- }
-
- public void setFocus()
- {
- if (_viewPart != null)
- _viewPart.setActiveViewerSelectionProvider(_viewer);
- }
-
- public IActionBars getActionBars()
- {
- return _actionBars;
- }
-
- public void selectionChanged(SelectionChangedEvent e)
- {
- IStructuredSelection sel = (IStructuredSelection) e.getSelection();
- _copyAction.setEnabled(_copyAction.updateSelection(sel));
- _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
- _selectAllAction.setEnabled(true);
-
- //setActionHandlers();
- }
-
- public int getPollingInterval()
- {
- return _pollingInterval;
- }
-
- public boolean isPollingEnabled()
- {
- if (_isPolling && !getViewer().getControl().isDisposed())
- {
- return true;
- }
- return false;
- }
-
- public void setPollingEnabled(boolean flag)
- {
- _isPolling = flag;
- }
-
- public void setEnabled(boolean flag)
- {
- if (!flag)
- {
- Table table = _viewer.getTable();
-
- Color bgcolour = _tabFolderPage.getBackground();
-
- table.setBackground(bgcolour);
- }
- }
-
- protected void createPollControls(Composite parent)
- {
-
- SystemCollapsableSection collapsable = new SystemCollapsableSection(parent);
- collapsable.setText(SystemResources.RESID_MONITOR_POLL_CONFIGURE_POLLING_LABEL);
- collapsable.setToolTips(SystemResources.RESID_MONITOR_POLL_CONFIGURE_POLLING_COLLAPSE_TOOLTIP,
- SystemResources.RESID_MONITOR_POLL_CONFIGURE_POLLING_EXPAND_TOOLTIP
- );
-
- Composite inputContainer = collapsable.getPageComposite();
-
-
- _pollCheckbox = SystemWidgetHelpers.createCheckBox(inputContainer, this, SystemResources.RESID_MONITOR_POLL_LABEL, SystemResources.RESID_MONITOR_POLL_TOOLTIP);
- GridData pg = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- _pollCheckbox.setLayoutData(pg);
-
- _pollingInterval = 100;
- SystemWidgetHelpers.createLabel(inputContainer, SystemResources.RESID_MONITOR_POLL_INTERVAL_LABEL);
-
- _scale = new Scale(inputContainer, SWT.NULL);
- _scale.setMaximum(200);
- _scale.setMinimum(5);
- _scale.setSelection(_pollingInterval);
-
- _scale.addSelectionListener(
- new SelectionListener()
- {
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- _pollingInterval = _scale.getSelection();
- _scaleValue.setText(_pollingInterval + "s"); //$NON-NLS-1$
-
- if (_pollingThread != null)
- _pollingThread.interrupt();
- }
-
- });
-
- _scale.setToolTipText(SystemResources.RESID_MONITOR_POLL_INTERVAL_TOOLTIP);
- GridData sd = new GridData(GridData.FILL_HORIZONTAL);
- _scale.setLayoutData(sd);
-
- _scaleValue = SystemWidgetHelpers.createReadonlyTextField(inputContainer);
- _scaleValue.setTextLimit(5);
- GridData scgd = new GridData(GridData.HORIZONTAL_ALIGN_END);
- _scaleValue.setLayoutData(scgd);
- _scaleValue.setText(_pollingInterval + "s"); //$NON-NLS-1$
-
-
-
- GridLayout ilayout = new GridLayout();
- ilayout.numColumns = 4;GridData gridData1 = new GridData(GridData.FILL_HORIZONTAL);
- inputContainer.setLayout(ilayout);
- inputContainer.setLayoutData(gridData1);
-
-
- // defaults
- _scale.setEnabled(_isPolling);
- _scaleValue.setEnabled(_isPolling);
-
- collapsable.addCollapseListener(new CollapsableListener(inputContainer));
- collapsable.setCollapsed(true);
- }
-
- class CollapsableListener implements ISystemCollapsableSectionListener
- {
- Composite _child;
- public CollapsableListener(Composite child)
- {
- _child = child;
- }
-
- public void sectionCollapsed(boolean collapsed)
- {
- //System.out.println("collapsed");
- }
- }
-
- public void createControl(Composite parent)
- {
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- parent.setLayout(gridLayout);
-
- // create table portion
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- _viewer = new SystemTableView(table, _viewPart);
-
- //Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- //_viewer = new SystemTableTreeView(tree, _viewPart);
-
- _viewer.addDoubleClickListener(new IDoubleClickListener()
- {
- public void doubleClick(DoubleClickEvent event)
- {
- handleDoubleClick(event);
- }
- });
-
- //TableLayout layout = new TableLayout();
- //tree.setLayout(layout);
- //tree.setLayout(new GridLayout())
- table.setHeaderVisible(false);
- table.setLinesVisible(false);
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- table.setLayoutData(gridData);
-
- createPollControls(_tabFolderPage);
- }
-
- public void propertyChange(PropertyChangeEvent e)
- {
- }
-
-
- private void handleDoubleClick(DoubleClickEvent event)
- {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (element == null)
- return;
-
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element).getAdapter(ISystemViewElementAdapter.class);
-
- if (adapter != null)
- {
- adapter.handleDoubleClick(element);
- }
- }
-
- public void dispose()
- {
- _viewer.dispose();
- _tabFolderPage.dispose();
- _isPolling = false;
- }
-
-
-
-
- public Object getInput()
- {
- return _viewer.getInput();
- }
-
- public void setInput(IAdaptable object)
- {
- setInput(object, true);
- updateTitle(object);
- }
-
- public void updateTitle(IAdaptable object)
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)object.getAdapter(ISystemViewElementAdapter.class);
-
- String title = adapter.getText(object);
- _tabFolderPage.setText(title);
- }
-
- public String getTitle()
- {
- return _title;
- }
-
- public void setInput(IAdaptable object, boolean updateHistory)
- {
- if (_viewer != null && object != null)
- {
- _viewer.setInput(object);
- }
- }
-
- public void clearInput()
- {
- if (_viewer != null)
- {
- _viewer.setInput(null);
- }
- }
-
- public SystemTableView getViewer()
- {
- return _viewer;
- }
-
-
-
- public void updateActionStates()
- {
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- }
-
-
-
-
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
- */
- public void focusGained(FocusEvent arg0)
- {
- IActionBars actionBars = getActionBars();
- if (actionBars != null)
- {
- if (arg0.widget == _viewer.getControl())
- {
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.COPY, _copyAction);
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.PASTE, _pasteAction);
- actionBars.setGlobalActionHandler(ITextEditorActionConstants.SELECT_ALL, _selectAllAction);
- actionBars.updateActionBars();
-
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
- */
- public void focusLost(FocusEvent arg0)
- {
-
- }
-
- public void handleEvent(Event event)
- {
- Widget w = event.widget;
- if (w == _pollCheckbox)
- {
- boolean wasPolling = _isPolling;
- _isPolling = _pollCheckbox.getSelection();
- _scale.setEnabled(_isPolling);
- _scaleValue.setEnabled(_isPolling);
- if (wasPolling != _isPolling && _isPolling)
- {
- _pollingThread = new PollingThread();
- _pollingThread.start();
- }
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewWorkbook.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewWorkbook.java
deleted file mode 100644
index 19b39969e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/MonitorViewWorkbook.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- * Kevin Doyle (IBM) - [177587] createTabItem sets the wrapped selection provider
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemTableView;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-
-
-
-/**
- * This is the desktop view wrapper of the System View viewer.
- */
-public class MonitorViewWorkbook extends Composite
-{
-
-
- private CTabFolder _folder;
- private SystemMonitorViewPart _viewPart;
-
- public MonitorViewWorkbook(Composite parent, SystemMonitorViewPart viewPart)
- {
- super(parent, SWT.NONE);
-
- _folder = new CTabFolder(this, SWT.NONE);
- _folder.setLayout(new TabFolderLayout());
- _folder.setLayoutData(new GridData(GridData.FILL_BOTH));
- setLayout(new FillLayout());
- _viewPart = viewPart;
- }
-
- public void dispose()
- {
-
- //if (!_folder.isDisposed())
- {
- for (int i = 0; i < _folder.getItemCount(); i++)
- {
- CTabItem item = _folder.getItem(i);
- if (!item.isDisposed())
- {
- MonitorViewPage page = (MonitorViewPage) item.getData();
- page.dispose();
- }
- }
- _folder.dispose();
- }
- super.dispose();
- }
-
- public CTabFolder getFolder()
- {
- return _folder;
- }
-
- public void remove(Object root)
- {
- for (int i = 0; i < _folder.getItemCount(); i++)
- {
- CTabItem item = _folder.getItem(i);
- if (!item.isDisposed())
- {
- MonitorViewPage page = (MonitorViewPage) item.getData();
-
- if (page != null && root == page.getInput())
- {
- item.dispose();
- page.dispose();
-
- page = null;
- item = null;
-
- _folder.redraw();
-
- return;
- }
- }
- }
- }
-
- public void removeDisconnected()
- {
- for (int i = 0; i < _folder.getItemCount(); i++)
- {
- CTabItem item = _folder.getItem(i);
- if (!item.isDisposed())
- {
- MonitorViewPage page = (MonitorViewPage) item.getData();
- if (page != null)
- {
- IAdaptable input = (IAdaptable)page.getInput();
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)input.getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null)
- {
- ISubSystem subSystem = adapter.getSubSystem(input);
- if (subSystem != null)
- {
- if (!subSystem.isConnected())
- {
- item.dispose();
- page.dispose();
-
- page = null;
- item = null;
-
- _folder.redraw();
- }
- }
- }
- }
- }
- }
- }
-
-
-
- public CTabItem getSelectedTab()
- {
- if (_folder.getItemCount() > 0)
- {
- int index = _folder.getSelectionIndex();
- CTabItem item = _folder.getItem(index);
- return item;
- }
-
- return null;
- }
-
- public MonitorViewPage getCurrentTabItem()
- {
- if (_folder.getItemCount() > 0)
- {
- int index = _folder.getSelectionIndex();
- CTabItem item = _folder.getItem(index);
- return (MonitorViewPage) item.getData();
- }
- return null;
- }
-
- public void showCurrentPage()
- {
- _folder.setFocus();
- }
-
- public Object getInput()
- {
- MonitorViewPage page = getCurrentTabItem();
- if (page != null)
- {
- page.setFocus();
- return page.getInput();
- }
-
- return null;
- }
-
- public SystemTableView getViewer()
- {
- if (getCurrentTabItem() != null)
- {
- return getCurrentTabItem().getViewer();
- }
- return null;
- }
-
- public void addItemToMonitor(IAdaptable root, boolean createTab)
- {
- if (!_folder.isDisposed())
- {
- for (int i = 0; i < _folder.getItemCount(); i++)
- {
- CTabItem item = _folder.getItem(i);
- MonitorViewPage page = (MonitorViewPage) item.getData();
- if (page != null && root == page.getInput())
- {
- page.getViewer().refresh();
-
- if (_folder.getSelectionIndex() != i)
- {
- _folder.setSelection(item);
- }
- updateActionStates();
- //page.setFocus();
- return;
- }
- }
-
- if (createTab)
- {
- // never shown this, so add it
- createTabItem(root);
- }
- }
- }
-
- private void createTabItem(IAdaptable root)
- {
- MonitorViewPage monitorViewPage = new MonitorViewPage(_viewPart);
-
- CTabItem titem = new CTabItem(_folder, SWT.NULL);
- setTabTitle(root, titem);
-
- titem.setData(monitorViewPage);
- titem.setControl(monitorViewPage.createTabFolderPage(_folder, _viewPart.getEditorActionHandler()));
- _folder.setSelection(titem );
-
- monitorViewPage.setInput(root);
-
- SystemTableView viewer = monitorViewPage.getViewer();
- if (_viewPart != null)
- {
- _viewPart.setActiveViewerSelectionProvider(viewer);
- _viewPart.getSite().registerContextMenu(viewer.getContextMenuManager(), viewer);
- }
- monitorViewPage.setFocus();
- }
-
- private void setTabTitle(IAdaptable root, CTabItem titem)
- {
- ISystemViewElementAdapter va = (ISystemViewElementAdapter) root.getAdapter(ISystemViewElementAdapter.class);
- if (va != null)
- {
- titem.setText(va.getName(root));
- titem.setImage(va.getImageDescriptor(root).createImage());
- }
- }
-
- public void setInput(IAdaptable root)
- {
- for (int i = 0; i < _folder.getItemCount(); i++)
- {
- CTabItem item = _folder.getItem(i);
- MonitorViewPage page = (MonitorViewPage) item.getData();
- if (root == page.getInput())
- {
- _folder.setSelection(i);
- page.getViewer().refresh();
- return;
- }
- }
- }
-
- public void updateActionStates()
- {
- for (int i = 0; i < _folder.getItemCount(); i++)
- {
- CTabItem item = _folder.getItem(i);
- if (!item.isDisposed())
- {
- MonitorViewPage page = (MonitorViewPage) item.getData();
- if (page != null)
- {
- page.updateActionStates();
- }
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorUI.java
deleted file mode 100644
index 1c349f000..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorUI.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-
-/**
- * A singleton class for dealing with remote commands
- */
-public class SystemMonitorUI
-{
-
-
- // singleton instance
- private static SystemMonitorUI instance;
- private static SystemMonitorViewPart _viewPart;
-
- public static final String MONITOR_VIEW_ID = "org.eclipse.rse.ui.view.monitorView"; //$NON-NLS-1$
-
- private SystemMonitorUI()
- {
- super();
- }
-
- /**
- * Get the singleton instance.
- * @return the singleton object of this type
- */
- public static SystemMonitorUI getInstance()
- {
- if (instance == null)
- {
- instance = new SystemMonitorUI();
- }
-
- return instance;
- }
-
-
- public SystemMonitorViewPart activateCommandsView()
- {
- try
- {
- IWorkbenchPage page = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage();
- _viewPart = (SystemMonitorViewPart) page.showView(SystemMonitorUI.MONITOR_VIEW_ID);
- page.bringToTop(_viewPart);
- }
- catch (PartInitException e)
- {
- SystemBasePlugin.logError("Can not open remote shell view", e); //$NON-NLS-1$
- }
-
- return _viewPart;
- }
-
-
- public static SystemMonitorViewPart getMonitorView()
- {
- return _viewPart;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorViewPart.java
deleted file mode 100644
index ff70aa090..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/SystemMonitorViewPart.java
+++ /dev/null
@@ -1,1133 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Michael Berger (IBM) - 146339 Added refresh action graphic.
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [177587] Made MonitorViewPart a SelectionProvider
- * Kevin Doyle (IBM) - [160378] Subset action should be disabled when there are no tabs in Monitor
- * Kevin Doyle (IBM) - [196582] ClassCastException when doing copy/paste
- * Kevin Doyle (IBM) - [212940] Duplicate Help Context Identifiers
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-
-import java.util.ArrayList;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemRemoteChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemTableTreeViewProvider;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.IRSEViewPart;
-import org.eclipse.rse.ui.view.ISystemTableViewColumnManager;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemTableView;
-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.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.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-/**
- * This is the desktop view wrapper of the System View viewer.
- */
-public class SystemMonitorViewPart
- extends ViewPart
- implements
- ISelectionListener,
- SelectionListener,
- ISelectionChangedListener,
- ISystemResourceChangeListener,
- ISystemShellProvider,
- ISystemRemoteChangeListener,
- ISystemMessageLine,
- IRSEViewPart,
- ISelectionProvider
-{
-
-
- class RestoreStateRunnable implements Runnable
- {
- public void run()
- {
- }
- }
- class PositionToAction extends BrowseAction
- {
- class PositionToDialog extends SystemPromptDialog
- {
- private String _name;
- private Combo _cbName;
-
-
- public PositionToDialog(Shell shell, String title)
- {
- super(shell, title);
- }
-
- public String getPositionName()
- {
- return _name;
- }
-
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
- _name = _cbName.getText();
- close();
- }
-
- protected Control getInitialFocusControl()
- {
- return _cbName;
- }
-
- public Control createInner(Composite parent)
- {
- Composite c = SystemWidgetHelpers.createComposite(parent, 2);
-
- Label aLabel = new Label(c, SWT.NONE);
- aLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
-
- _cbName = SystemWidgetHelpers.createCombo(c, null);
- GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- _cbName.setLayoutData(textData);
- _cbName.setText("*"); //$NON-NLS-1$
- _cbName.setToolTipText(SystemResources.RESID_TABLE_POSITIONTO_ENTRY_TOOLTIP);
-
- this.getShell().setText(SystemResources.RESID_TABLE_POSITIONTO_LABEL);
- setHelp();
- return c;
- }
-
- private void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX + "gnpt0000"); //$NON-NLS-1$
- }
- }
-
- public PositionToAction()
- {
- super(SystemMonitorViewPart.this, SystemResources.ACTION_POSITIONTO_LABEL, null);
- setToolTipText(SystemResources.ACTION_POSITIONTO_TOOLTIP);
- }
-
- public void run()
- {
-
- PositionToDialog posDialog = new PositionToDialog(getViewer().getShell(), getTitle());
- if (posDialog.open() == Window.OK)
- {
- String name = posDialog.getPositionName();
-
- getViewer().positionTo(name);
- }
- }
- }
-
-class SubSetAction extends BrowseAction
- {
- class SubSetDialog extends SystemPromptDialog
- {
- private String[] _filters;
- private Text[] _controls;
- private IPropertyDescriptor[] _uniqueDescriptors;
-
-
- public SubSetDialog(Shell shell, IPropertyDescriptor[] uniqueDescriptors)
- {
- super(shell, SystemResources.RESID_TABLE_SUBSET_LABEL);
- _uniqueDescriptors = uniqueDescriptors;
- }
-
- public String[] getFilters()
- {
- return _filters;
- }
-
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
-
- for (int i = 0; i < _controls.length; i++)
- {
- _filters[i] = _controls[i].getText();
- }
-
- close();
- }
-
- protected Control getInitialFocusControl()
- {
- return _controls[0];
- }
-
- public Control createInner(Composite parent)
- {
- Composite c = SystemWidgetHelpers.createComposite(parent, 2);
-
- int numberOfFields = _uniqueDescriptors.length;
- _controls = new Text[numberOfFields + 1];
- _filters = new String[numberOfFields + 1];
-
- Label nLabel = new Label(c, SWT.NONE);
- nLabel.setText(SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
-
-
- _controls[0] = SystemWidgetHelpers.createTextField(c, null);
- GridData textData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- _controls[0].setLayoutData(textData);
- _controls[0].setText("*"); //$NON-NLS-1$
- _controls[0].setToolTipText(SystemResources.RESID_TABLE_SUBSET_ENTRY_TOOLTIP);
-
-
-
- for (int i = 0; i < numberOfFields; i++)
- {
- IPropertyDescriptor des = _uniqueDescriptors[i];
-
- Label aLabel = new Label(c, SWT.NONE);
- aLabel.setText(des.getDisplayName());
-
- _controls[i + 1] = SystemWidgetHelpers.createTextField(c, null);
- GridData textData3 = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- _controls[i + 1].setLayoutData(textData3);
- _controls[i + 1].setText("*"); //$NON-NLS-1$
- }
-
- setHelp();
- return c;
- }
-
- private void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX + "gnss0000"); //$NON-NLS-1$
- }
- }
-
- public SubSetAction()
- {
- super(SystemMonitorViewPart.this, SystemResources.ACTION_SUBSET_LABEL, null);
- setToolTipText(SystemResources.ACTION_SUBSET_TOOLTIP);
- }
-
- public void run()
- {
- SubSetDialog subsetDialog = new SubSetDialog(getViewer().getShell(), getViewer().getVisibleDescriptors(getViewer().getInput()));
- if (subsetDialog.open() == Window.OK)
- {
- String[] filters = subsetDialog.getFilters();
- getViewer().setViewFilters(filters);
-
- }
- }
- }
-
-
-
- class RefreshAction extends BrowseAction
- {
- public RefreshAction()
- {
- super(SystemMonitorViewPart.this, SystemResources.ACTION_REFRESH_LABEL,
- //RSEUIPlugin.getDefault().getImageDescriptor(ICON_SYSTEM_REFRESH_ID));
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID));
- setTitleToolTip(SystemResources.ACTION_REFRESH_TOOLTIP);
- }
-
- public void run()
- {
- Object inputObject = getViewer().getInput();
- if (inputObject instanceof ISystemContainer)
- {
- ((ISystemContainer)inputObject).markStale(true);
- }
- ((SystemTableTreeViewProvider) getViewer().getContentProvider()).flushCache();
- getViewer().refresh();
-
- // refresh layout too
- //_viewer.computeLayout(true);
-
- }
- }
- private class SelectColumnsAction extends BrowseAction
- {
-
- class SelectColumnsDialog extends SystemPromptDialog
- {
- private ISystemViewElementAdapter _adapter;
- private ISystemTableViewColumnManager _columnManager;
- private IPropertyDescriptor[] _uniqueDescriptors;
- private ArrayList _currentDisplayedDescriptors;
- private ArrayList _availableDescriptors;
-
- private List _availableList;
- private List _displayedList;
-
- private Button _addButton;
- private Button _removeButton;
- private Button _upButton;
- private Button _downButton;
-
-
- public SelectColumnsDialog(Shell shell, ISystemViewElementAdapter viewAdapter, ISystemTableViewColumnManager columnManager)
- {
- super(shell, SystemResources.RESID_TABLE_SELECT_COLUMNS_LABEL);
- setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_TOOLTIP);
- _adapter = viewAdapter;
- _columnManager = columnManager;
- _uniqueDescriptors = viewAdapter.getUniquePropertyDescriptors();
- IPropertyDescriptor[] initialDisplayedDescriptors = _columnManager.getVisibleDescriptors(_adapter);
- _currentDisplayedDescriptors = new ArrayList(initialDisplayedDescriptors.length);
- for (int i = 0; i < initialDisplayedDescriptors.length;i++)
- {
- if (!_currentDisplayedDescriptors.contains(initialDisplayedDescriptors[i]))
- _currentDisplayedDescriptors.add(initialDisplayedDescriptors[i]);
- }
- _availableDescriptors = new ArrayList(_uniqueDescriptors.length);
- for (int i = 0; i < _uniqueDescriptors.length;i++)
- {
- if (!_currentDisplayedDescriptors.contains(_uniqueDescriptors[i]))
- {
- _availableDescriptors.add(_uniqueDescriptors[i]);
- }
- }
- }
-
-
- public void handleEvent(Event e)
- {
- Widget source = e.widget;
- if (source == _addButton)
- {
- int[] toAdd = _availableList.getSelectionIndices();
- addToDisplay(toAdd);
- }
- else if (source == _removeButton)
- {
- int[] toAdd = _displayedList.getSelectionIndices();
- removeFromDisplay(toAdd);
- }
- else if (source == _upButton)
- {
- int index = _displayedList.getSelectionIndex();
- moveUp(index);
- _displayedList.select(index - 1);
- }
- else if (source == _downButton)
- {
- int index = _displayedList.getSelectionIndex();
- moveDown(index);
- _displayedList.select(index + 1);
- }
-
- // update button enable states
- updateEnableStates();
- }
-
- public IPropertyDescriptor[] getDisplayedColumns()
- {
- IPropertyDescriptor[] displayedColumns = new IPropertyDescriptor[_currentDisplayedDescriptors.size()];
- for (int i = 0; i< _currentDisplayedDescriptors.size();i++)
- {
- displayedColumns[i]= (IPropertyDescriptor)_currentDisplayedDescriptors.get(i);
- }
- return displayedColumns;
- }
-
- private void updateEnableStates()
- {
- boolean enableAdd = false;
- boolean enableRemove = false;
- boolean enableUp = false;
- boolean enableDown = false;
-
- int[] availableSelected = _availableList.getSelectionIndices();
- for (int i = 0; i < availableSelected.length; i++)
- {
- int index = availableSelected[i];
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
- if (!_currentDisplayedDescriptors.contains(descriptor))
- {
- enableAdd = true;
- }
- }
-
- if (_displayedList.getSelectionCount()>0)
- {
- enableRemove = true;
-
- int index = _displayedList.getSelectionIndex();
- if (index > 0)
- {
- enableUp = true;
- }
- if (index < _displayedList.getItemCount()-1)
- {
- enableDown = true;
- }
- }
-
- _addButton.setEnabled(enableAdd);
- _removeButton.setEnabled(enableRemove);
- _upButton.setEnabled(enableUp);
- _downButton.setEnabled(enableDown);
-
- }
-
- private void moveUp(int index)
- {
- Object obj = _currentDisplayedDescriptors.remove(index);
- _currentDisplayedDescriptors.add(index - 1, obj);
- refreshDisplayedList();
- }
-
- private void moveDown(int index)
- {
- Object obj = _currentDisplayedDescriptors.remove(index);
- _currentDisplayedDescriptors.add(index + 1, obj);
-
- refreshDisplayedList();
- }
-
- private void addToDisplay(int[] toAdd)
- {
- ArrayList added = new ArrayList();
- for (int i = 0; i < toAdd.length; i++)
- {
- int index = toAdd[i];
-
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(index);
-
- if (!_currentDisplayedDescriptors.contains(descriptor))
- {
- _currentDisplayedDescriptors.add(descriptor);
- added.add(descriptor);
- }
- }
-
- for (int i = 0; i < added.size(); i++)
- {
- _availableDescriptors.remove(added.get(i));
- }
-
-
- refreshAvailableList();
- refreshDisplayedList();
-
- }
-
- private void removeFromDisplay(int[] toRemove)
- {
- for (int i = 0; i < toRemove.length; i++)
- {
- int index = toRemove[i];
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_currentDisplayedDescriptors.get(index);
- _currentDisplayedDescriptors.remove(index);
- _availableDescriptors.add(descriptor);
- }
- refreshDisplayedList();
- refreshAvailableList();
- }
-
- protected void buttonPressed(int buttonId)
- {
- setReturnCode(buttonId);
-
- close();
- }
-
- protected Control getInitialFocusControl()
- {
- return _availableList;
- }
-
- public Control createInner(Composite parent)
- {
- Composite main = SystemWidgetHelpers.createComposite(parent, 1);
-
- SystemWidgetHelpers.createLabel(main, SystemResources.RESID_TABLE_SELECT_COLUMNS_DESCRIPTION_LABEL);
-
- Composite c = SystemWidgetHelpers.createComposite(main, 4);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
- _availableList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_AVAILABLE_LABEL, this, true);
-
- Composite addRemoveComposite = SystemWidgetHelpers.createComposite(c, 1);
- addRemoveComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
- _addButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_LABEL,
- this);
- _addButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_ADD_TOOLTIP);
-
- _removeButton = SystemWidgetHelpers.createPushButton(addRemoveComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_LABEL,
- this);
- _removeButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_REMOVE_TOOLTIP);
-
- _displayedList = SystemWidgetHelpers.createListBox(c, SystemResources.RESID_TABLE_SELECT_COLUMNS_DISPLAYED_LABEL, this, false);
-
- Composite upDownComposite = SystemWidgetHelpers.createComposite(c, 1);
- upDownComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
- _upButton = SystemWidgetHelpers.createPushButton(upDownComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_LABEL,
- this);
- _upButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_UP_TOOLTIP);
-
- _downButton = SystemWidgetHelpers.createPushButton(upDownComposite,
- SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_LABEL,
- this);
- _downButton.setToolTipText(SystemResources.RESID_TABLE_SELECT_COLUMNS_DOWN_TOOLTIP);
-
- initLists();
-
- setHelp();
- return c;
- }
-
- private void initLists()
- {
- refreshAvailableList();
- refreshDisplayedList();
- updateEnableStates();
- }
-
- private void refreshAvailableList()
- {
- _availableList.removeAll();
- // initialize available list
- for (int i = 0; i < _availableDescriptors.size(); i++)
- {
- IPropertyDescriptor descriptor = (IPropertyDescriptor)_availableDescriptors.get(i);
- _availableList.add(descriptor.getDisplayName());
- }
- }
-
- private void refreshDisplayedList()
- {
- _displayedList.removeAll();
- // initialize display list
- for (int i = 0; i < _currentDisplayedDescriptors.size(); i++)
- {
-
- Object obj = _currentDisplayedDescriptors.get(i);
- if (obj != null && obj instanceof IPropertyDescriptor)
- {
- _displayedList.add(((IPropertyDescriptor)obj).getDisplayName());
- }
- }
- }
-
- private void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX + "gntc0000"); //$NON-NLS-1$
- }
- }
-
- public SelectColumnsAction()
- {
- super(SystemMonitorViewPart.this, SystemResources.ACTION_SELECTCOLUMNS_LABEL, null);
- setToolTipText(SystemResources.ACTION_SELECTCOLUMNS_TOOLTIP);
- setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID));
- }
-
- public void checkEnabledState()
- {
-
- if (getViewer() != null && getViewer().getInput() != null)
- {
- setEnabled(true);
- }
- else
- {
- setEnabled(false);
- }
- }
- public void run()
- {
- SystemTableView viewer = getViewer();
- ISystemTableViewColumnManager mgr = viewer.getColumnManager();
- ISystemViewElementAdapter adapter = viewer.getAdapterForContents();
- SelectColumnsDialog dlg = new SelectColumnsDialog(getShell(), adapter, mgr);
- if (dlg.open() == Window.OK)
- {
- mgr.setCustomDescriptors(adapter, dlg.getDisplayedColumns());
- viewer.computeLayout(true);
- viewer.refresh();
- }
- }
- }
-
- MonitorViewWorkbook _folder = null;
- private CellEditorActionHandler _editorActionHandler = null;
-
- // for ISystemMessageLine
- private String _message, _errorMessage;
- private SystemMessage sysErrorMessage;
- private IStatusLineManager _statusLine = null;
-
- private SelectColumnsAction _selectColumnsAction = null;
- private RefreshAction _refreshAction = null;
-
- private ClearAction _clearAllAction = null;
- private ClearSelectedAction _clearSelectedAction = null;
-
- private SubSetAction _subsetAction = null;
- private PositionToAction _positionToAction = null;
-
- private ISelectionProvider viewerProvider = null;
- private ArrayList selectionListeners = new ArrayList();
-
- private ISelectionChangedListener selectionListener = null;
-
- // constants
- public static final String ID = "org.eclipse.rse.ui.view.monitorView"; //$NON-NLS-1$
- // matches id in plugin.xml, view tag
-
- public void setFocus()
- {
- _folder.showCurrentPage();
- }
-
- public Shell getShell()
- {
- return _folder.getShell();
- }
-
- public SystemTableView getViewer()
- {
- return _folder.getViewer();
- }
-
- public Viewer getRSEViewer()
- {
- return _folder.getViewer();
- }
-
- public CellEditorActionHandler getEditorActionHandler()
- {
- if (_editorActionHandler == null)
- {
- _editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
- }
- return _editorActionHandler;
- }
-
- public void createPartControl(Composite parent)
- {
- _folder = new MonitorViewWorkbook(parent, this);
- _folder.getFolder().addSelectionListener(this);
-
- ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.addSelectionListener(this);
-
-
- SystemWidgetHelpers.setHelp(_folder, RSEUIPlugin.HELPPREFIX + "mntr0000"); //$NON-NLS-1$
-
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.addSystemResourceChangeListener(this);
- registry.addSystemRemoteChangeListener(this);
-
-
- RestoreStateRunnable restore = new RestoreStateRunnable();
- Display.getCurrent().asyncExec(restore);
-
- getSite().setSelectionProvider(this);
- selectionListener = new ISelectionChangedListener() {
- public void selectionChanged (SelectionChangedEvent event)
- {
- for (int i = 0; i < selectionListeners.size(); i++)
- {
- if (selectionListeners.get(i) instanceof ISelectionChangedListener)
- {
- ((ISelectionChangedListener) selectionListeners.get(i)).selectionChanged(event);
- }
- }
- }
- };
-
-
- fillLocalToolBar();
-
- }
-
- public void selectionChanged(IWorkbenchPart part, ISelection sel)
- {
- }
-
- public void dispose()
- {
- ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.removeSelectionListener(this);
- _folder.dispose();
-
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.removeSystemResourceChangeListener(this);
- registry.removeSystemRemoteChangeListener(this);
-
-
- super.dispose();
- }
-
- public void updateActionStates()
- {
-
- if (_folder != null && _folder.getInput() != null)
- {
- }
- if (_clearAllAction != null)
- {
- _clearAllAction.checkEnabledState();
- _clearSelectedAction.checkEnabledState();
- _selectColumnsAction.checkEnabledState();
- _refreshAction.checkEnabledState();
- _positionToAction.checkEnabledState();
- _subsetAction.checkEnabledState();
- }
- }
-
- public void fillLocalToolBar()
- {
- if (_folder != null )
- {
-
-
- //updateActionStates();
-
- IActionBars actionBars = getViewSite().getActionBars();
-
- _refreshAction= new RefreshAction();
-
- _clearSelectedAction = new ClearSelectedAction(this);
- _clearAllAction = new ClearAction(this);
-
- _selectColumnsAction = new SelectColumnsAction();
-
- _subsetAction = new SubSetAction();
- _positionToAction = new PositionToAction();
-
- IToolBarManager toolBarManager = actionBars.getToolBarManager();
- addToolBarItems(toolBarManager);
- addToolBarMenuItems(actionBars.getMenuManager());
- }
- updateActionStates();
- }
-
- private void addToolBarItems(IToolBarManager toolBarManager)
- {
- toolBarManager.removeAll();
-
- toolBarManager.add(_refreshAction);
-
- toolBarManager.add(new Separator());
- toolBarManager.add(_clearSelectedAction);
- toolBarManager.add(_clearAllAction);
-
- toolBarManager.add(new Separator());
- toolBarManager.add(_selectColumnsAction);
-
- toolBarManager.update(true);
- }
-
-
-
- public void selectionChanged(SelectionChangedEvent e)
- {
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (selectionListeners != null)
- selectionListeners.add(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (selectionListeners != null)
- selectionListeners.remove(listener);
- }
-
- public ISelection getSelection()
- {
- if (viewerProvider == null)
- return null;
- else
- return viewerProvider.getSelection();
- }
-
- /**
- * Sets the wrapped selection provider.
- * This method should only be called when the viewer changes.
- * @param newProvider The new wrapped selection provider.
- */
- public void setActiveViewerSelectionProvider(ISelectionProvider newProvider)
- {
- if (viewerProvider != null)
- viewerProvider.removeSelectionChangedListener(selectionListener);
-
- viewerProvider = newProvider;
-
- if (newProvider != null)
- {
- newProvider.addSelectionChangedListener(selectionListener);
-
- // Create a new event and tell all listeners about it, so that the properties
- // view is updated to show the new viewers selected object
- SelectionChangedEvent event = new SelectionChangedEvent(newProvider, newProvider.getSelection());
- for (int i = 0; i < selectionListeners.size(); i++)
- {
- if (selectionListeners.get(i) instanceof ISelectionChangedListener)
- {
- ((ISelectionChangedListener) selectionListeners.get(i)).selectionChanged(event);
- }
- }
- }
- }
-
- public void setSelection(ISelection selection)
- {
- if (viewerProvider != null)
- viewerProvider.setSelection(selection);
- }
-
- public void addItemToMonitor(IAdaptable root)
- {
- if (root != null)
- {
- _folder.addItemToMonitor(root, true);
- if (true)
- updateActionStates();
- }
- }
-
- public void removeItemToMonitor(IAdaptable root)
- {
- if (root != null)
- {
- _folder.remove(root);
- if (true)
- updateActionStates();
- }
- }
-
- public void removeAllItemsToMonitor()
- {
- while (_folder.getInput() != null)
- {
- removeItemToMonitor((IAdaptable)_folder.getInput());
- }
- }
-
- public void setInput(IAdaptable object)
- {
- _folder.setInput(object);
- }
-
-
- /**
- * Used to asynchronously update the view whenever properties change.
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
-
- Object child = event.getSource();
- SystemTableView viewer = getViewer();
- if (viewer != null)
- {
- Object input = viewer.getInput();
- switch (event.getType())
- {
- case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE:
- {
- _folder.removeDisconnected();
- updateActionStates();
- }
- break;
- case ISystemResourceChangeEvents.EVENT_RENAME:
- {
- if (child == input)
- {
- _folder.getCurrentTabItem().updateTitle((IAdaptable)child);
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE:
- case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
- {
- if (child == input)
- {
- removeItemToMonitor((IAdaptable)child);
- }
- }
- break;
- default:
- break;
- }
- }
- }
-
- /**
- * This is the method in your class that will be called when a remote resource
- * changes. You will be called after the resource is changed.
- * @see org.eclipse.rse.core.events.ISystemRemoteChangeEvent
- */
- public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
- {
- int eventType = event.getEventType();
- Object remoteResource = event.getResource();
-
- java.util.List remoteResourceNames = null;
- if (remoteResource instanceof java.util.List)
- {
- remoteResourceNames = (java.util.List) remoteResource;
- remoteResource = remoteResourceNames.get(0);
- }
-
- Object child = event.getResource();
-
- SystemTableView viewer = getViewer();
- if (viewer != null)
- {
- Object input = viewer.getInput();
- if (input == child || child instanceof Vector)
- {
- switch (eventType)
- {
- // --------------------------
- // REMOTE RESOURCE CHANGED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
- break;
-
- // --------------------------
- // REMOTE RESOURCE CREATED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
- break;
-
- // --------------------------
- // REMOTE RESOURCE DELETED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
- {
- if (child instanceof Vector)
- {
- /*Vector vec = (Vector)child;
- for (int v = 0; v < vec.size(); v++)
- {
- Object c = vec.get(v);
-
- }*/
- }
- else
- {
-
- return;
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
- {
- addItemToMonitor((IAdaptable)child);
- }
-
- break;
- }
- }
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e)
- {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- Widget source = e.widget;
- Widget item = e.item;
- Object data = item.getData();
- MonitorViewPage page = null;
-
- if (data instanceof MonitorViewPage)
- page = (MonitorViewPage) data;
-
- // Set the wrapped viewer to be the viewer of the new selected tab
- if (page != null)
- {
- SystemTableView viewer = page.getViewer();
- setActiveViewerSelectionProvider(viewer);
- }
-
- if (source == _folder.getFolder())
- {
- updateActionStates();
- }
- }
-
-
-// -------------------------------
- // ISystemMessageLine interface...
- // -------------------------------
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- _errorMessage = null;
- sysErrorMessage = null;
- if (_statusLine != null)
- _statusLine.setErrorMessage(_errorMessage);
- }
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- _message = null;
- if (_statusLine != null)
- _statusLine.setMessage(_message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage()
- {
- return _errorMessage;
- }
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage()
- {
- return _message;
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- this._errorMessage = message;
- if (_statusLine != null)
- _statusLine.setErrorMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- return sysErrorMessage;
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- sysErrorMessage = message;
- setErrorMessage(message.getLevelOneText());
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(Throwable exc)
- {
- setErrorMessage(exc.getMessage());
- }
-
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- this._message = message;
- if (_statusLine != null)
- _statusLine.setMessage(message);
- }
- /**
- *If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- setMessage(message.getLevelOneText());
- }
-
- private void addToolBarMenuItems(IMenuManager menuManager)
- {
- menuManager.removeAll();
- menuManager.add(_selectColumnsAction);
- menuManager.add(new Separator("Filter")); //$NON-NLS-1$
- menuManager.add(_positionToAction);
- menuManager.add(_subsetAction);
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/TabFolderLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/TabFolderLayout.java
deleted file mode 100644
index 3328c9879..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/monitor/TabFolderLayout.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.monitor;
-
-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 TabFolderLayout extends Layout {
-
-
-
- protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Control [] children = composite.getChildren ();
- int count = children.length;
- int maxWidth = 0, maxHeight = 0;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- maxWidth = Math.max (maxWidth, pt.x);
- maxHeight = Math.max (maxHeight, pt.y);
- }
-
- if (wHint != SWT.DEFAULT)
- maxWidth= wHint;
- if (hHint != SWT.DEFAULT)
- maxHeight= hHint;
-
- return new Point(maxWidth, maxHeight);
-
- }
-
- protected void layout (Composite composite, boolean flushCache) {
- Rectangle rect= composite.getClientArea();
-
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/BrowseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/BrowseAction.java
deleted file mode 100644
index 2b390b576..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/BrowseAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split SystemRegistryUI from SystemRegistry implementation
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.scratchpad;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
-import org.eclipse.rse.ui.internal.model.SystemScratchpad;
-
-
-
-class BrowseAction extends Action
-{
- protected SystemScratchpadView _view;
- protected SystemScratchpad _scratchPad;
- public BrowseAction(SystemScratchpadView view, String label, ImageDescriptor des)
- {
- super(label, des);
- _view = view;
- setImageDescriptor(des);
- setToolTipText(label);
- _scratchPad = SystemRegistryUI.getInstance().getSystemScratchPad();
- }
-
- public void checkEnabledState()
- {
- if (_view.getInput() != null)
- {
- setEnabled(true);
- }
- else
- {
- setEnabled(false);
- }
- }
-
- public void run()
- {
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearAction.java
deleted file mode 100644
index aefbac41f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [189150] setSelection(null) added to clear()
- * Kevin Doyle (IBM) - [194899] Remove All should do a full reset of the scratchpad
- *******************************************************************************/
-
-
-package org.eclipse.rse.internal.ui.view.scratchpad;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-public class ClearAction extends BrowseAction
-{
-
- public ClearAction(SystemScratchpadView view)
- {
- super(view, SystemResources.ACTION_CLEAR_ALL_LABEL,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_ALL_ID));
-
- setToolTipText(SystemResources.ACTION_CLEAR_ALL_TOOLTIP);
- // TODO DKM - get help for this!
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CLEAR_CONSOLE_ACTION);
- }
-
- public void checkEnabledState()
- {
- setEnabled(_scratchPad.hasChildren());
- }
-
- public void run()
- {
- clear();
- }
-
- // clear contents of the current command viewer
- private void clear()
- {
- // Reset the SystemScratchpad
- _scratchPad.clearChildren();
- // Set the input of the view to SystemScratchpad if it has changed
- if (_view.getInput() != _scratchPad) {
- _view.setInput(_scratchPad);
- }
- // Refresh the Scratchpad and update action states
- RSECorePlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(_scratchPad, ISystemResourceChangeEvents.EVENT_REFRESH, _scratchPad));
- _view.setSelection(null);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearSelectedAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearSelectedAction.java
deleted file mode 100644
index f4f717c8d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/ClearSelectedAction.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [189150] setSelection(null) added to clear()
- * Kevin Doyle (IBM) - [193148] Clear Selected Action enabled when not on a root element
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.scratchpad;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-public class ClearSelectedAction extends BrowseAction
-{
- public ClearSelectedAction(SystemScratchpadView view)
- {
- super(view, SystemResources.ACTION_CLEAR_SELECTED_LABEL,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CLEAR_SELECTED_ID));
-
- setToolTipText(SystemResources.ACTION_CLEAR_SELECTED_TOOLTIP);
- // TODO DKM - get help for this!
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.CLEAR_CONSOLE_ACTION);
- }
-
- public void checkEnabledState()
- {
- if (_scratchPad.hasChildren())
- {
- StructuredSelection selection = (StructuredSelection)_view.getSelection();
- if (selection != null)
- {
- Iterator iterator = selection.iterator();
- while (iterator.hasNext())
- {
- Object obj = iterator.next();
- if (!_scratchPad.contains(obj))
- {
- setEnabled(false);
- return;
- }
- else
- {
- if (selection instanceof TreeSelection)
- {
- TreeSelection treeSelection = (TreeSelection) selection;
- TreePath[] paths = treeSelection.getPathsFor(obj);
- // if paths[0].getSegmentCount is not 1 then it's not a root
- if (paths.length > 0 && paths[0].getSegmentCount() != 1)
- {
- setEnabled(false);
- return;
- }
- }
- }
- }
- setEnabled(true);
- return;
- }
- }
-
- setEnabled(false);
- }
-
- public void run()
- {
- clear();
- }
-
- private void clear()
- {
- StructuredSelection selection = (StructuredSelection)_view.getSelection();
- if (selection != null)
- {
- Iterator iterator = selection.iterator();
- while (iterator.hasNext())
- {
- _scratchPad.removeChild(iterator.next());
- }
- RSECorePlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(_scratchPad, ISystemResourceChangeEvents.EVENT_REFRESH, _scratchPad));
- _view.setSelection(null);
- //_view.updateActionStates();
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadView.java
deleted file mode 100644
index 7eaa5aeae..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadView.java
+++ /dev/null
@@ -1,1976 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [192278] Removed handleKeyPressed
- * Kevin Doyle (IBM) - [189150] _selectionFlagsUpdated reset after clear action performed
- * Kevin Doyle (IBM) - [195537] Use Hashlookup and ElementComparer
- * Kevin Doyle (IBM) - [189423] Scratchpad not completely updated after Delete.
- * Kevin Doyle (IBM) - [193151] Scratchpad not updated on Move
- * Kevin Doyle (IBM) - [189421] Scratchpad not updated after Rename
- * David McKnight (IBM) - [197860] drag and drop consistency - no text transfer
- * Kevin Doyle (IBM) - [197841] "Terminate and Remove" should remove the shell from Scratchpad
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.scratchpad;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.window.SameShellProvider;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemRemoteChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
-import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonSelectAllAction;
-import org.eclipse.rse.internal.ui.actions.SystemOpenExplorerPerspectiveAction;
-import org.eclipse.rse.internal.ui.actions.SystemShowInTableAction;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.internal.ui.view.ElementComparer;
-import org.eclipse.rse.internal.ui.view.SafeTreeViewer;
-import org.eclipse.rse.internal.ui.view.SystemView;
-import org.eclipse.rse.internal.ui.view.SystemViewDataDragAdapter;
-import org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter;
-import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemDeleteTarget;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemRenameTarget;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAction;
-import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
-import org.eclipse.rse.ui.internal.model.SystemScratchpad;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ContextObject;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.part.EditorInputTransfer;
-import org.eclipse.ui.part.PluginTransfer;
-
-
-/**
- * This subclass of the standard JFace tabletree viewer is used to
- * show a generic tabletree view of the selected object
- * <p>
- */
-public class SystemScratchpadView
- // TODO change TreeViewer to ScratchpadViewer when Eclipse fixes SWT viewer
-// extends ScratchpadViewer
- extends SafeTreeViewer
- implements IMenuListener, ISystemDeleteTarget,
- ISystemRenameTarget, ISystemSelectAllTarget, ISystemShellProvider,
- ISystemResourceChangeListener, ISystemRemoteChangeListener,
- ISelectionChangedListener, ISelectionProvider
-{
- private Object _objectInput;
- //private ArrayList _attributeColumns;
- private TableLayout _layout;
- private SystemScratchpadViewProvider _provider;
- private MenuManager _menuManager;
-
- // these variables were copied from SystemView to allow for limited support
- // of actions. I say limited because somethings don't yet work properly.
- protected SystemRefreshAction _refreshAction;
- protected PropertyDialogAction _propertyDialogAction;
- protected SystemOpenExplorerPerspectiveAction _openToPerspectiveAction;
- protected SystemShowInTableAction _showInTableAction;
-
- // global actions
- // Note the Edit menu actions are set in SystemViewPart. Here we use these
- // actions from our own popup menu actions.
- protected SystemCommonDeleteAction _deleteAction;
- // for global delete menu item
- protected SystemCommonRenameAction _renameAction;
- // for common rename menu item
- protected SystemCommonSelectAllAction _selectAllAction;
- // for common Ctrl+A select-all
- protected ClearSelectedAction _clearSelectedAction;
- protected ClearAction _clearAllAction;
-
- protected boolean _selectionShowRefreshAction;
- protected boolean _selectionShowOpenViewActions;
- protected boolean _selectionShowDeleteAction;
- protected boolean _selectionShowRenameAction;
- protected boolean _selectionEnableDeleteAction;
- protected boolean _selectionEnableRenameAction;
-
- protected boolean _selectionIsRemoteObject = true;
- protected boolean _selectionFlagsUpdated = false;
-
-
- private ISystemMessageLine _messageLine;
- protected boolean menuListenerAdded = false;
-
- private static final int LEFT_BUTTON = 1;
- private int mouseButtonPressed = LEFT_BUTTON;
-
- public boolean debugRemote = false;
-
- /**
- * Constructor for the table view
- *
- */
- public SystemScratchpadView(Tree tableTree, ISystemMessageLine msgLine)
- {
- super(tableTree);
- _messageLine = msgLine;
- //_attributeColumns = new ArrayList();
- _layout = new TableLayout();
-
- _provider = new SystemScratchpadViewProvider(this);
-
- setUseHashlookup(true);
- setComparer(new ElementComparer());
-
- setContentProvider(_provider);
-
- IWorkbench wb = PlatformUI.getWorkbench();
- setLabelProvider(new DecoratingLabelProvider(_provider, wb.getDecoratorManager().getLabelDecorator()));
-
- //setLabelProvider(_provider);
-
- _menuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- _menuManager.setRemoveAllWhenShown(true);
- _menuManager.addMenuListener(this);
- Menu menu = _menuManager.createContextMenu(tableTree);
- tableTree.setMenu(menu);
-
- addSelectionChangedListener(this);
-
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.addSystemResourceChangeListener(this);
- sr.addSystemRemoteChangeListener(this);
-
- initDragAndDrop();
-
- tableTree.setVisible(false);
- getControl().addMouseListener(new MouseAdapter()
- {
- public void mouseDown(MouseEvent e)
- {
- mouseButtonPressed = e.button; //d40615
- }
- });
- }
-
- public Layout getLayout()
- {
- return _layout;
- }
-
-
- /**
- * Return the popup menu for the table
- */
- public Menu getContextMenu()
- {
- return getTree().getMenu();
- }
- /**
- * Return the popup menu for the table
- */
- public MenuManager getContextMenuManager()
- {
- return _menuManager;
- }
-
- /**
- * Called whenever the input for the view changes
- */
- public void inputChanged(Object newObject, Object oldObject)
- {
- if (newObject instanceof IAdaptable)
- {
- getTree().setVisible(true);
- _objectInput = newObject;
-
-
- super.inputChanged(newObject, oldObject);
- }
- else if (newObject == null)
- {
- getTree().setVisible(false);
- _objectInput = null;
- }
- }
-
- public Object getInput()
- {
- return _objectInput;
- }
-
- /**
- * Convenience method for retrieving the view adapter for an object
- */
- protected ISystemViewElementAdapter getViewAdapter(Object obj)
- {
- return SystemAdapterHelpers.getViewAdapter(obj);
- }
-
-
-
- /**
- * Initialize drag and drop support for this view.
- *
- */
- protected void initDragAndDrop()
- {
- int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] dragtransfers = new Transfer[]
- { PluginTransfer.getInstance(),
- EditorInputTransfer.getInstance()
- };
-
- Transfer[] droptransfers = new Transfer[]
- { PluginTransfer.getInstance(),
- FileTransfer.getInstance(),
- EditorInputTransfer.getInstance()
- };
-
- addDragSupport(ops | DND.DROP_DEFAULT, dragtransfers, new SystemViewDataDragAdapter(this));
- addDropSupport(ops | DND.DROP_DEFAULT, droptransfers, new SystemViewDataDropAdapter(this));
- }
-
-
- /**
- * Used to asynchronously update the view whenever properties change.
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
- Object parent = event.getParent();
- Object child = event.getSource();
- int eventType = event.getType();
- switch (eventType)
- {
- case ISystemResourceChangeEvents.EVENT_RENAME_FILTER_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_CHANGE_FILTER_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_CHANGE_FILTERSTRING_REFERENCE:
- {
- if (child instanceof ISystemFilter)
- {
- IRSEBaseReferencingObject[] references = ((ISystemFilter)child).getReferencingObjects();
- for (int i = 0; i < references.length; i++)
- {
- IRSEBaseReferencingObject ref = references[i];
- Widget w = findItem(ref);
- if (w != null)
- {
- internalRefresh(ref);
- }
- }
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE :
- case ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE :
- case ISystemResourceChangeEvents.EVENT_ICON_CHANGE:
- {
- Widget w = findItem(child);
-
- if (w != null)
- {
- updateItem(w, child);
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_ADD :
- case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE :
- {
- boolean addingConnection = (child instanceof IHost);
- if (_objectInput instanceof ISystemRegistry && addingConnection)
- {
- SystemScratchpadViewProvider provider = (SystemScratchpadViewProvider) getContentProvider();
-
- if (provider != null)
- {
-
- internalRefresh(_objectInput);
- }
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_REFRESH:
- case ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE:
- {
- internalRefresh(child);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED:
- {
- IStructuredSelection sel = (IStructuredSelection)getSelection();
- Iterator iter = sel.iterator();
- while (iter.hasNext())
- {
- Object obj = iter.next();
- internalRefresh(obj);
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_RENAME:
- {
- Widget w = findItem(child);
- if (w != null)
- {
- updateItem(w, child);
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE:
- case ISystemResourceChangeEvents.EVENT_COMMAND_SHELL_REMOVED:
- {
- deleteObject(child);
- }
- break;
- case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
- {
- Object[] multiSrc = event.getMultiSource();
- if (multiSrc != null) {
- for (int i = 0; i < multiSrc.length; i++) {
- deleteObject(multiSrc[i]);
- }
- }
- }
- break;
- default :
- break;
-
- }
-
- if (child == _objectInput || parent == _objectInput)
- {
- SystemScratchpadViewProvider provider = (SystemScratchpadViewProvider) getContentProvider();
-
- if (provider != null)
- {
-
-
- try
- {
- internalRefresh(_objectInput);
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError(e.getMessage());
- }
- }
- }
- }
-
- /**
- * This is the method in your class that will be called when a remote resource
- * changes. You will be called after the resource is changed.
- * @see org.eclipse.rse.core.events.ISystemRemoteChangeEvent
- */
- public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
- {
- int eventType = event.getEventType();
- Object remoteResourceParent = event.getResourceParent();
- Object remoteResource = event.getResource();
- //boolean originatedHere = (event.getOriginatingViewer() == this);
- List remoteResourceNames = null;
- if (remoteResource instanceof List)
- {
- remoteResourceNames = (List) remoteResource;
- remoteResource = remoteResourceNames.get(0);
- }
- String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource);
- if (remoteResourceName == null)
- return;
-
- switch (eventType)
- {
- // --------------------------
- // REMOTE RESOURCE CHANGED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
- {
- if (remoteResourceParent == getInput())
- {
- Widget w = findItem(remoteResource);
- if (w != null)
- {
- updateItem(w, remoteResource);
- }
-
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE CREATED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
- {
- // Since all creation operations can only be done on the same parent
- // we only need to handle refreshing of the parent
- // Must handle String's as Move operation create event passes us Strings
- if (remoteResourceParent instanceof String)
- {
- Item item = findFirstRemoteItemReference((String) remoteResourceParent, null, null);
- if (item != null)
- internalRefresh(item.getData());
- }
- else
- {
- internalRefresh(remoteResourceParent);
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE DELETED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
- {
- if (remoteResourceNames != null)
- {
- for (int i = 0; i < remoteResourceNames.size(); i++)
- {
- deleteObject(remoteResourceNames.get(i));
- }
- }
- else
- {
- deleteObject(remoteResource);
- }
-
- /*
- {
- Object dchild = remoteResource;
-
-
- ISystemViewElementAdapter dadapt = getAdapter(dchild);
- if (dadapt != null)
- {
- SubSystem dSubSystem = dadapt.getSubSystem(dchild);
- String dkey = dadapt.getAbsoluteName(dchild);
-
- if (provider != null)
- {
- Object[] children = provider.getChildren(_objectInput);
- for (int i = 0; i < children.length; i++)
- {
- Object existingChild = children[i];
- if (existingChild != null)
- {
- ISystemViewElementAdapter eadapt = getAdapter(existingChild);
- SubSystem eSubSystem = eadapt.getSubSystem(existingChild);
-
- if (dSubSystem == eSubSystem)
- {
- String ekey = eadapt.getAbsoluteName(existingChild);
- if (ekey.equals(dkey))
- {
- // do a full refresh
- refresh();
- }
- }
-
- }
- }
- }
- }
- }
- */
-
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
- {
- renameRemoteObject(remoteResource, event.getOldNames()[0]);
- }
-
- break;
- }
- }
-
- /**
- * Turn a given remote object reference into a fully qualified absolute name
- */
- private String getRemoteResourceAbsoluteName(Object remoteResource)
- {
- if (remoteResource == null)
- return null;
- String remoteResourceName = null;
- if (remoteResource instanceof String)
- remoteResourceName = (String) remoteResource;
- else
- {
- ISystemViewElementAdapter ra = getViewAdapter(remoteResource);
- if (ra == null)
- return null;
- remoteResourceName = ra.getAbsoluteName(remoteResource);
- }
- return remoteResourceName;
- }
-
- /**
- * Display a message/status on the message/status line
- */
- public void displayMessage(String msg)
- {
- if (_messageLine != null)
- _messageLine.setMessage(msg);
- }
- /**
- * Clear message/status shown on the message/status line
- */
- public void clearMessage()
- {
- if (_messageLine != null)
- _messageLine.clearMessage();
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
-
- // Set _selectionFlagsUpdate to false, so the next time the context menu
- // is requested we rescan the selections to determine which actions
- // to show and enable/disable.
- // Setting this to false will force a rescan because in fillContextMenu()
- // if this is false it will call scanSelections();
- _selectionFlagsUpdated = false;
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- Object firstSelection = sel.getFirstElement();
- if (firstSelection == null)
- return;
-
- ISystemViewElementAdapter adapter = getViewAdapter(firstSelection);
- if (adapter != null)
- {
- displayMessage(adapter.getStatusLineText(firstSelection));
- if ((mouseButtonPressed == LEFT_BUTTON))
- adapter.selectionChanged(firstSelection);
- }
- else
- clearMessage();
- }
-
- public void dispose()
- {
- removeAsListener();
-
- Composite tree = getTree();
-
- boolean isDisposed = tree.isDisposed();
-
- // dispose control if not disposed
- if (!isDisposed) {
- tree.dispose();
- }
- }
-
- /**
- * Remove as listener.
- */
- public void removeAsListener() {
-
- // remove listeners
- removeSelectionChangedListener(this);
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.removeSystemResourceChangeListener(this);
- sr.removeSystemRemoteChangeListener(this);
-
- //Composite tree = getTree();
- //boolean isDisposed = tree.isDisposed();
- }
-
- /*
- * Everything below is basically stuff copied and pasted from SystemsView
- * -There needs to be cleaning up of the below code as some of this stuff
- * is broken for the table view
- *
- *
- public void createStandardGroups(IMenuManager menu)
- {
- if (!menu.isEmpty())
- return;
- // simply sets partitions in the menu, into which actions can be directed.
- // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
- // Deleted groups are not used yet.
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW));
- // new->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO));
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO));
- // expand to->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND));
- // expand, collapse
- // goto into, go->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH));
- // open with->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH));
- // browse with ->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN));
- // open xxx
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH));
- // work with->
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_SHOW)); // show->type hierarchy, in-navigator
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD));
- // build, rebuild, refresh
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE));
- // update, change
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE));
- // rename,move,copy,delete,bookmark,refactoring
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER));
- // move up, move down
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE));
- // getters/setters, etc. Typically in editor
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH));
- // search
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION));
- // connection-related actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT));
- // get or put actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS));
- // actions queried from adapters
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS));
- // user or BP/ISV additions
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_VIEWER_SETUP)); // ? Probably View->by xxx, yyy
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM));
- // Team
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_COMPAREWITH));
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_REPLACEWITH));
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES));
- // Properties
- }*/
-
- /**
- * Rather than pre-defining this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected PropertyDialogAction getPropertyDialogAction()
- {
- if (_propertyDialogAction == null)
- {
- _propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this);
- //propertyDialogAction.setToolTipText(" ");
- }
- _propertyDialogAction.selectionChanged(getSelection());
- return _propertyDialogAction;
- }
-
-
- /**
- * Return the select All action
- */
- protected IAction getSelectAllAction()
- {
- if (_selectAllAction == null)
- _selectAllAction = new SystemCommonSelectAllAction(getShell(), this, this);
- return _selectAllAction;
- }
-
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected IAction getRenameAction()
- {
- if (_renameAction == null)
- _renameAction = new SystemCommonRenameAction(getShell(), this);
- return _renameAction;
- }
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected IAction getDeleteAction()
- {
- if (_deleteAction == null)
- _deleteAction = new SystemCommonDeleteAction(getShell(), this);
- return _deleteAction;
- }
-
- protected IAction getClearSelectedAction()
- {
- if (_clearSelectedAction == null)
- _clearSelectedAction = new ClearSelectedAction(this);
- _clearSelectedAction.checkEnabledState();
- return _clearSelectedAction;
- }
-
- protected IAction getClearAllAction()
- {
- if (_clearAllAction == null)
- _clearAllAction = new ClearAction(this);
- _clearAllAction.checkEnabledState();
- return _clearAllAction;
- }
-
- /**
- * Return the refresh action
- */
- protected IAction getRefreshAction()
- {
- if (_refreshAction == null)
- _refreshAction = new SystemRefreshAction(getShell());
- return _refreshAction;
- }
- /*
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- *
- protected SystemCascadingOpenToAction getOpenToAction()
- {
- if (openToAction == null)
- openToAction = new SystemCascadingOpenToAction(getShell(),getWorkbenchWindow());
- return openToAction;
- } NOT USED YET */
- /**
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- */
- protected SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
- {
- if (_openToPerspectiveAction == null)
- {
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchWindow win = desktop.getActiveWorkbenchWindow();
-
- _openToPerspectiveAction = new SystemOpenExplorerPerspectiveAction(getShell(), win);
- }
- //getWorkbenchWindow());
- return _openToPerspectiveAction;
- }
-
- protected SystemShowInTableAction getShowInTableAction()
- {
- if (_showInTableAction == null)
- {
- _showInTableAction = new SystemShowInTableAction(getShell());
- }
- //getWorkbenchWindow());
- return _showInTableAction;
- }
-
- public Shell getShell()
- {
- return getTree().getShell();
- }
-
- /**
- * Required method from ISystemDeleteTarget.
- * Decides whether to even show the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showDelete()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionShowDeleteAction;
- }
- /**
- * Required method from ISystemDeleteTarget
- * Decides whether to enable the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canDelete()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionEnableDeleteAction;
- }
-
- /*
- * Required method from ISystemDeleteTarget
- */
- public boolean doDelete(IProgressMonitor monitor)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- //int selectedCount = selection.size();
- //Object multiSource[] = new Object[selectedCount];
- //int idx = 0;
- Object element = null;
- //Object parentElement = getSelectedParent();
- ISystemViewElementAdapter adapter = null;
- boolean ok = true;
- boolean anyOk = false;
- Vector deletedVector = new Vector();
- try
- {
- while (ok && elements.hasNext())
- {
- element = elements.next();
- //multiSource[idx++] = element;
- adapter = getViewAdapter(element);
- ok = adapter.doDelete(getShell(), element, monitor);
- if (ok)
- {
- anyOk = true;
- deletedVector.addElement(element);
- }
- }
- }
- catch (SystemMessageException exc)
- {
- SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
- ok = false;
- }
- catch (Exception exc)
- {
- String msg = exc.getMessage();
- if ((msg == null) || (exc instanceof ClassCastException))
- msg = exc.getClass().getName();
- SystemMessageDialog.displayErrorMessage(getShell(), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element, msg));
- ok = false;
- }
- if (anyOk)
- {
- Object[] deleted = new Object[deletedVector.size()];
- for (int idx = 0; idx < deleted.length; idx++)
- deleted[idx] = deletedVector.elementAt(idx);
- if (_selectionIsRemoteObject)
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this);
- else
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvents.EVENT_DELETE_MANY, getInput()));
- }
- return ok;
- }
-
- // ---------------------------
- // ISYSTEMRENAMETARGET METHODS
- // ---------------------------
-
- /**
- * Required method from ISystemRenameTarget.
- * Decides whether to even show the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showRename()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionShowRenameAction;
- }
- /**
- * Required method from ISystemRenameTarget
- * Decides whether to enable the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canRename()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionEnableRenameAction;
- }
-
- // default implementation
- // in default table, parent is input
- protected Object getParentForContent(Object element)
- {
- return _objectInput;
- }
-
- /**
- * Required method from ISystemRenameTarget
- */
- public boolean doRename(String[] newNames)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- //int selectedCount = selection.size();
- Object element = null;
-
- ISystemViewElementAdapter adapter = null;
- ISystemRemoteElementAdapter remoteAdapter = null;
- String oldFullName = null;
- boolean ok = true;
- try
- {
- int nameIdx = 0;
- while (ok && elements.hasNext())
- {
- element = elements.next();
- adapter = getViewAdapter(element);
- Object parentElement = getParentForContent(element);
-
- remoteAdapter = getRemoteAdapter(element);
- if (remoteAdapter != null)
- oldFullName = remoteAdapter.getAbsoluteName(element);
- // pre-rename
- ok = adapter.doRename(getShell(), element, newNames[nameIdx++], null);
- if (ok)
- {
- if (remoteAdapter != null) {
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, remoteAdapter.getSubSystem(element), new String[]{oldFullName}, this);
- }
- else {
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(element, ISystemResourceChangeEvents.EVENT_RENAME, parentElement));
- }
- }
- }
- }
- catch (SystemMessageException exc)
- {
- SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
- ok = false;
- }
- catch (Exception exc)
- {
- //String msg = exc.getMessage();
- //if ((msg == null) || (exc instanceof ClassCastException))
- // msg = exc.getClass().getName();
- SystemMessageDialog.displayErrorMessage(getShell(), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_RENAMING).makeSubstitution(element, exc),
- //msg),
- exc);
- ok = false;
- }
- return ok;
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- ISystemRemoteElementAdapter adapter = null;
- if (!(o instanceof IAdaptable))
- adapter = (ISystemRemoteElementAdapter) Platform.getAdapterManager().getAdapter(o, ISystemRemoteElementAdapter.class);
- else
- adapter = (ISystemRemoteElementAdapter) ((IAdaptable) o).getAdapter(ISystemRemoteElementAdapter.class);
- if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
- ((ISystemViewElementAdapter) adapter).setViewer(this);
- return adapter;
- }
-
- /**
- * Return true if select all should be enabled for the given object.
- * For a tree view, you should return true if and only if the selected object has children.
- * You can use the passed in selection or ignore it and query your own selection.
- */
- public boolean enableSelectAll(IStructuredSelection selection)
- {
- return true;
- }
- /**
- * When this action is run via Edit->Select All or via Ctrl+A, perform the
- * select all action. For a tree view, this should select all the children
- * of the given selected object. You can use the passed in selected object
- * or ignore it and query the selected object yourself.
- */
- public void doSelectAll(IStructuredSelection selection)
- {
-
- Tree tree = getTree();
-
- Tree theTree = tree;
- theTree.setSelection(theTree.getItems());
- TreeItem[] items = theTree.getItems();
- Object[] objects = new Object[items.length];
- for (int idx = 0; idx < items.length; idx++)
- objects[idx] = items[idx].getData();
- fireSelectionChanged(new SelectionChangedEvent(this, new StructuredSelection(objects)));
-
-
- }
-
- public void menuAboutToShow(IMenuManager manager)
- {
- SystemView.createStandardGroups(manager);
- if (!menuListenerAdded)
- {
- if (manager instanceof MenuManager)
- {
- Menu m = ((MenuManager)manager).getMenu();
- if (m != null)
- {
- menuListenerAdded = true;
- SystemViewMenuListener ml = new SystemViewMenuListener();
- if (_messageLine != null)
- ml.setShowToolTipText(true, _messageLine);
- m.addMenuListener(ml);
- }
- }
- }
- fillContextMenu(manager);
- }
-
- public ISelection getSelection()
- {
- ISelection selection = super.getSelection();
- if (selection == null || selection.isEmpty())
- {
- // make the selection the parent
- ArrayList list = new ArrayList();
- if (_objectInput != null)
- {
- list.add(_objectInput);
- selection = new StructuredSelection(list);
- }
- }
-
- return selection;
- }
-
- public void fillContextMenu(IMenuManager menu) {
-
- IStructuredSelection selection = (IStructuredSelection) getSelection();
-
- boolean allSelectionsFromSameParent = true;
- int selectionCount = selection.size();
-
-
-
- if (selectionCount == 0) // nothing selected
- {
- return;
- }
- else
- {
-
- if (selectionCount == 1) {
-
- if (selection.getFirstElement() == getInput()) {
- //return;
- }
- }
-
- if (selectionCount > 1)
- {
- allSelectionsFromSameParent = sameParent();
-
- if (!allSelectionsFromSameParent)
- {
- if (selectionHasAncestryRelationship())
- {
- // don't show the menu because actions with
- // multiple select on objects that are ancestors
- // of each other is problematic
- // still create the standard groups
- SystemView.createStandardGroups(menu);
- return;
- }
- }
- }
-
- // Partition into groups...
- SystemView.createStandardGroups(menu);
-
- // ADD COMMON ACTIONS...
- // COMMON REFRESH ACTION...
- if (showRefresh())
- {
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction());
- }
-
- // COMMON RENAME ACTION...
- if (canRename())
- {
- if (showRename())
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction());
- }
-
- // ADAPTER SPECIFIC ACTIONS
- SystemMenuManager ourMenu = new SystemMenuManager(menu);
-
- Iterator elements = selection.iterator();
- Hashtable adapters = new Hashtable();
- while (elements.hasNext())
- {
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter != null)
- {
- adapters.put(adapter, element); // want only unique adapters
- }
- }
- Enumeration uniqueAdapters = adapters.keys();
- Shell shell = getShell();
- while (uniqueAdapters.hasMoreElements())
- {
- ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter) uniqueAdapters.nextElement();
- nextAdapter.addActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
-
- if (nextAdapter instanceof AbstractSystemViewAdapter)
- {
- AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)nextAdapter;
- // add remote actions
- aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
-
- // add dynamic menu popups
- aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS);
- }
- }
-
-
-
-
- // wail through all actions, updating shell and selection
- IContributionItem[] items = menu.getItems();
- for (int idx = 0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction());
- item.setInputs(getShell(), this, selection);
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager) items[idx];
- item.setInputs(getShell(), this, selection);
- }
- }
-
- // COMMON DELETE ACTION...
- if (canDelete() && showDelete())
- {
- //menu.add(getDeleteAction());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getDeleteAction());
- ((ISystemAction) getDeleteAction()).setInputs(getShell(), this, selection);
- menu.add(new Separator());
- }
-
- // REMOVE FROM VIEW ACTION...
-
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_ADDITIONS, getClearSelectedAction());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_ADDITIONS, getClearAllAction());
-
- // PROPERTIES ACTION...
- // This is supplied by the system, so we pretty much get it for free. It finds the
- // registered propertyPages extension points registered for the selected object's class type.
- //propertyDialogAction.selectionChanged(selection);
-
-
- PropertyDialogAction pdAction = getPropertyDialogAction();
- if (pdAction.isApplicableForSelection())
- {
-
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
- }
- // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions())
- if (!_selectionIsRemoteObject)
- {
- //SystemCascadingOpenToAction openToAction = getOpenToAction();
- SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction();
- SystemShowInTableAction showInTableAction = getShowInTableAction();
- openToPerspectiveAction.setSelection(selection);
- showInTableAction.setSelection(selection);
- //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction);
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction);
-
- }
-
-
-
- }
- }
-
-
- /**
- * Decides whether to even show the refresh menu item.
- * Assumes scanSelections() has already been called
- */
- protected boolean showRefresh()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionShowRefreshAction;
- }
-
- /**
- * This is called to ensure all elements in a multiple-selection have the same parent in the
- * tree viewer. If they don't we automatically disable all actions.
- * <p>
- * Designed to be as fast as possible by going directly to the SWT widgets
- */
- public boolean sameParent()
- {
- boolean same = true;
-
- Tree tree = getTree();
-
- TreeItem[] items = tree.getSelection();
-
- if ((items == null) || (items.length ==0)) {
- return true;
- }
-
- TreeItem prevParent = null;
- TreeItem currParent = null;
-
- for (int idx = 0; idx < items.length; idx++)
- {
- currParent = items[idx].getParentItem();
-
- if ((idx>0) && (currParent != prevParent)) {
- same = false;
- break;
- }
- else
- {
- prevParent = currParent;
- }
- }
- return same;
- }
-
- private boolean selectionHasAncestryRelationship() {
- Tree tree = getTree();
-
- TreeItem[] items = tree.getSelection();
-
- for (int idx=0; idx<items.length; idx++)
- {
- TreeItem item = items[idx];
-
- for (int c=0; c < items.length; c++)
- {
- if (item != items[c])
- {
- if (isAncestorOf(item, items[c], false))
- {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Returns whether an item is an ancestor of another item. The ancestor can be direct or indirect.
- * @param container the item which might be an ancestor.
- * @param item the child.
- * @param direct <code>true</code> if the container must be a direct ancestor of the child item,
- * <code>false</code> otherwise.
- * @return <code>true</code> if there is an ancestry relationship, <code>false</code> otherwise.
- */
- private boolean isAncestorOf(TreeItem container, TreeItem item, boolean direct)
- {
- TreeItem[] children = null;
-
- // does not have to be a direct ancestor
- if (!direct) {
- // get the children of the container's parent, i.e. the container's siblings
- // as well as itself
- TreeItem parent = container.getParentItem();
-
- // check if parent is null
- // parent is null if the container is a root item
- if (parent != null) {
- children = parent.getItems();
- }
- else {
- children = getTree().getItems();
- }
- }
- // must be a direct ancestor
- else {
- // get the children of the container
- children = container.getItems();
- }
-
- // go through all the children
- for (int i = 0; i < children.length; i++) {
-
- TreeItem child = children[i];
-
- // if one of the children matches the child item, return true
- if (child == item && direct) {
- return true;
- }
- // otherwise, go through children, and see if any of those are ancestors of
- // the child item
- else if (child.getItemCount() > 0) {
-
- // we check for direct ancestry
- if (isAncestorOf(child, item, true)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * --------------------------------------------------------------------------------
- * For many actions we have to walk the selection list and examine each selected
- * object to decide if a given common action is supported or not.
- * <p>
- * Walking this list multiple times while building the popup menu is a performance
- * hit, so we have this common method that does it only once, setting instance
- * variables for all of the decisions we are in interested in.
- * --------------------------------------------------------------------------------
- */
- protected void scanSelections()
- {
- // initial these variables to true. Then if set to false even once, leave as false always...
- _selectionShowRefreshAction = true;
- _selectionShowOpenViewActions = true;
- _selectionShowDeleteAction = true;
- _selectionShowRenameAction = true;
- _selectionEnableDeleteAction = true;
- _selectionEnableRenameAction = true;
- _selectionIsRemoteObject = true;
- _selectionFlagsUpdated = true;
-
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- while (elements.hasNext())
- {
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- if (adapter != null)
- {
- if (_selectionShowRefreshAction)
- _selectionShowRefreshAction = adapter.showRefresh(element);
-
- if (_selectionShowOpenViewActions)
- _selectionShowOpenViewActions = adapter.showOpenViewActions(element);
-
- if (_selectionShowDeleteAction)
- _selectionShowDeleteAction = adapter.showDelete(element);
-
- if (_selectionShowRenameAction)
- _selectionShowRenameAction = adapter.showRename(element);
-
- if (_selectionEnableDeleteAction)
- _selectionEnableDeleteAction = _selectionShowDeleteAction && adapter.canDelete(element);
- //System.out.println("ENABLE DELETE SET TO " + selectionEnableDeleteAction);
-
- if (_selectionEnableRenameAction)
- _selectionEnableRenameAction = _selectionShowRenameAction && adapter.canRename(element);
-
- if (_selectionIsRemoteObject)
- _selectionIsRemoteObject = (getRemoteAdapter(element) != null);
- }
- }
-
- }
-
- /**
- * Overridden so that we can pass a wrapper IContextObject into the provider to get children instead
- * of the model object, itself
- */
- protected void createChildren(final Widget widget)
- {
- if (widget instanceof TreeItem)
- {
- final Item[] tis = getChildren(widget);
- if (tis != null && tis.length > 0) {
- Object data = tis[0].getData();
- if (data != null) {
- return; // children already there!
- }
- }
-
- BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
- public void run() {
- // fix for PR 1FW89L7:
- // don't complain and remove all "dummies" ...
- if (tis != null) {
- for (int i = 0; i < tis.length; i++) {
- if (tis[i].getData() != null) {
- disassociate(tis[i]);
- Assert.isTrue(tis[i].getData() == null,
- "Second or later child is non -null");//$NON-NLS-1$
-
- }
- tis[i].dispose();
- }
- }
- Object d = widget.getData();
- if (d != null)
- {
- Object parentElement = getContextObject((TreeItem)widget);
- Object[] children = getSortedChildren(parentElement);
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- createTreeItem(widget, children[i], -1);
- }
- }
- }
- }
-
- });
- }
- else
- {
- super.createChildren(widget);
- }
- }
-
-
- /**
- * Get the containing filter reference for an item
- * @param item the item to get the filter reference for
- * @return the filter reference
- */
- public ISystemFilterReference getContainingFilterReference(TreeItem item)
- {
- Object data = item.getData();
- if (data instanceof ISystemFilterReference)
- {
- return (ISystemFilterReference)data;
- }
- else
- {
- TreeItem parent = item.getParentItem();
- if (parent != null)
- {
- return getContainingFilterReference(parent);
- }
- else
- {
- Object input = getInput();
- if (input instanceof ISystemFilterReference)
- {
- return (ISystemFilterReference)input;
- }
- else
- {
- return null;
- }
- }
- }
- }
-
- /**
- * Get the containing subsystem from an item
- * @param item the item to get the subsystem for
- * @return the subsystem
- */
- public ISubSystem getContainingSubSystem(TreeItem item)
- {
- Object data = item.getData();
- if (data instanceof ISubSystem)
- {
- return (ISubSystem)data;
- }
- else
- {
- TreeItem parent = item.getParentItem();
- if (parent != null)
- {
- return getContainingSubSystem(parent);
- }
- else
- {
- Object input = getInput();
- if (input instanceof ISubSystem)
- {
- return (ISubSystem)input;
- }
- else
- {
- return null;
- }
- }
- }
- }
-
- /**
- * Get the context object from a tree item
- * @param item the item to get the context for
- * @return the context object
- */
- public IContextObject getContextObject(TreeItem item)
- {
- Object data = item.getData();
- ISystemFilterReference filterReference = getContainingFilterReference(item);
- if (filterReference != null)
- {
- return new ContextObject(data, filterReference.getSubSystem(), filterReference);
- }
- else
- {
- ISubSystem subSystem = getContainingSubSystem(item);
- if (subSystem != null)
- {
- return new ContextObject(data, subSystem);
- }
- else
- {
- return new ContextObject(data);
- }
- }
- }
-
- /**
- * Overrides the standard viewer method to get the model object from the context object
- */
- public void add(Object parentElementOrTreePath, Object[] childElements) {
- Assert.isNotNull(parentElementOrTreePath);
- assertElementsNotNull(childElements);
-
- if (parentElementOrTreePath instanceof IContextObject)
- {
- parentElementOrTreePath = ((IContextObject)parentElementOrTreePath).getModelObject();
- }
- super.add(parentElementOrTreePath, childElements);
- }
-
- /**
- * Delete all occurrences of a given remote object
- */
- protected void deleteObject(Object deleteObject)
- {
- // If deleteObject is a string find it's tree item and get it's data as thats what's
- // stored inside the SystemScratchpad
- if (deleteObject instanceof String)
- {
- Item item = findFirstRemoteItemReference((String) deleteObject,null,null);
- if (item == null)
- return;
- else
- deleteObject = item.getData();
- }
-
- // check if remoteResource is a root in Scratchpad and if so remove it
- SystemScratchpad scratchpad = SystemRegistryUI.getInstance().getSystemScratchPad();
- if (scratchpad.contains(deleteObject))
- scratchpad.removeChild(deleteObject);
-
- // find all references to the remote resource and remove them
- Widget[] widgets = findItems(deleteObject);
- for (int i = 0; i < widgets.length; i++)
- {
- if (widgets[i] instanceof TreeItem)
- {
- remove(getTreePathFromItem((TreeItem) widgets[i]));
- }
- }
-
- }
-
- /**
- * Rename a remote object.
- */
- protected void renameRemoteObject(Object renameObject, String oldElementName) {
- String[] properties = new String[1];
- properties[0] = IBasicPropertyConstants.P_TEXT;
- List matches = new Vector();
- ISubSystem subsystem = null;
- String newElementName = ""; //$NON-NLS-1$
- Object refreshObject = null;
-
- // Try to determine the new element name/subsystem to help improve performance when searching for objects
- if (renameObject instanceof String) {
- newElementName = (String) renameObject;
- } else {
- ISystemViewElementAdapter rmtAdapter = getViewAdapter(renameObject);
- if (rmtAdapter != null) {
- subsystem = rmtAdapter.getSubSystem(renameObject);
- newElementName = rmtAdapter.getName(renameObject);
- }
- }
-
- findAllRemoteItemReferences(oldElementName, renameObject, subsystem, matches);
-
- // Go through all the matches and update the properties
- for (int i = 0; i < matches.size(); i++) {
- Item item = (Item) matches.get(i);
- if (item != null && !item.isDisposed()) {
- Object data = item.getData();
-
- if (data != null) {
- ISystemRemoteElementAdapter remoteAdapter = (ISystemRemoteElementAdapter)((IAdaptable)data).getAdapter(ISystemRemoteElementAdapter.class);
-
- if (remoteAdapter != null && data != renameObject)
- {
- remoteAdapter.refreshRemoteObject(data, renameObject);
- }
- item.setText(newElementName);
- internalUpdate(item, data, properties);
-
- if (refreshObject == null) {
- refreshObject = data;
- }
-
- }
- }
- }
-
- if (refreshObject != null) {
- // Update the Scratchpad Model
- SystemRegistryUI.getInstance().getSystemScratchPad().replace(oldElementName, refreshObject);
-
- // FTP/SSH require a new listing of files otherwise they will
- // display the old file names.
- // We can't depend on SystemView to do the refresh as it does it in a
- // deferred job and we don't know when that is done or what
- // order the listeners are in.
- if (refreshObject instanceof ISystemContainer) {
- ((ISystemContainer) refreshObject).markStale(true);
- }
- internalRefresh(refreshObject);
- }
- }
-
- //TODO:
- // ----------------------------------------------------------------
- // Functions Below are pure copies of the ones from SystemView
- // and as such should be moved to a common location
- // or with 3.0 remove all need for Recursive methods - Preferred
- // ----------------------------------------------------------------
-
- /**
- * Find the first binary-match or name-match of remote object, given its absolute name.
- * @param remoteObjectName The absolute name of the remote object to find.
- * @param subsystem The subsystem of the remote object to find. Optional.
- * @param parentItem The parent item at which to start the search. Optional.
- * @return TreeItem hit if found
- */
- public Item findFirstRemoteItemReference(String remoteObjectName, ISubSystem subsystem, Item parentItem) {
- //List matches = new Vector();
- Item match = null;
- if (parentItem == null)
- //findAllRemoteItemReferences(remoteObjectName, null, subsystem, matches);
- match = internalFindFirstRemoteItemReference(remoteObjectName, null, subsystem);
- else {
-
- //recursiveFindAllRemoteItemReferences(parentItem, remoteObjectName, null, subsystem, matches);
- match = recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, null, subsystem);
- }
- //if (matches.size() > 0)
- // return (Item)matches.elementAt(0);
- //else
- // return null;
- return match;
- }
-
- /**
- * Recursively tries to find the first occurrence of a given remote object, starting at the tree root.
- * Optionally scoped to a specific subsystem.
- * Since the object memory object for a remote object is not dependable we call getAbsoluteName()
- * on the adapter to do the comparisons.
- * <p>
- * This overload takes a string and a subsystem.
- *
- * @param searchString the absolute name of the remote object to which we want to find a tree item which references it.
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @return TreeItem hit if found
- */
- protected Item internalFindFirstRemoteItemReference(String searchString, Object elementObject, ISubSystem subsystem) {
- Item[] roots = getTree().getItems();
- if ((roots == null) || (roots.length == 0)) return null;
-
- // use map first
- Item match = mappedFindFirstRemoteItemReference(elementObject);
-
- for (int idx = 0; (match == null) && (idx < roots.length); idx++) {
- //System.out.println("recursiveFindFirstRemoteItemReference(parentItem, remoteObjectName, remoteObject, subsystem)");
- match = recursiveFindFirstRemoteItemReference(roots[idx], searchString, elementObject, subsystem);
- }
-
- return match;
- }
-
- protected Item mappedFindFirstRemoteItemReference(Object elementObject)
- {
- return (Item)findItem(elementObject);
- }
-
- /**
- * Recursively tries to find the first references to a remote object.
- * This search is restricted to the given subsystem, if given.
- * @param parent the parent item at which to start the search.
- * @param elementName the absolute name of the remote element to find
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @return TreeItem match if found, null if not found.
- */
- protected Item recursiveFindFirstRemoteItemReference(Item parent, String elementName, Object elementObject, ISubSystem subsystem) {
- Object rawData = parent.getData();
- ISystemViewElementAdapter remoteAdapter = null;
- // ----------------------------
- // what are we looking at here?
- // ----------------------------
- if (rawData != null) remoteAdapter = getViewAdapter(rawData);
- // -----------------------------------------------------------------------
- // if this is a remote object, test if it is the one we are looking for...
- // -----------------------------------------------------------------------
- if (remoteAdapter != null) {
- // first test for binary match
- if (elementObject == rawData) {
- if (debugRemote) System.out.println("Remote item binary match found"); //$NON-NLS-1$
- return parent; // return the match
- }
- // now test for absolute name match
- String fqn = remoteAdapter.getAbsoluteName(rawData);
- if (debugRemote) System.out.println("TESTING FINDFIRST: '" + fqn + "' vs '" + elementName + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if ((fqn != null) && fqn.equals(elementName)) {
- if ((subsystem != null) && (subsystem == remoteAdapter.getSubSystem(rawData))) {
- if (debugRemote) System.out.println("Remote item name match found and subsystems matched"); //$NON-NLS-1$
- return parent; // return the match
- } else if (subsystem == null) {
- if (debugRemote) System.out.println("Remote item name match found and subsystem null"); //$NON-NLS-1$
- return parent;
- } else if (debugRemote) System.out.println("Remote item name match found but subsystem mismatch"); //$NON-NLS-1$
- }
- }
- // -------------------------------------------------------------------------
- // if we have been given a subsystem to restrict to, that is a hint to us...
- // -------------------------------------------------------------------------
- else if ((rawData != null) && (subsystem != null)) // test for hints we are in the wrong place
- {
- // if we are currently visiting a subsystem, and that subsystem is not from the same
- // factory, then we can assume the remote object occurrences we are looking for are
- // not to be found within this branch...
- if ((rawData instanceof ISubSystem) && (rawData != subsystem)) {
- return null; // they don't match, so don't bother checking the kids
- }
- // if we are currently visiting a connection, and that connection's hostname is not the same
- // as that of our given subsystem, then we can assume the remote object occurrences we are
- // looking for are not to be found within this branch...
- else if ((rawData instanceof IHost) && !((IHost) rawData).getHostName().equals(subsystem.getHost().getHostName())) {
- return null; // they don't match, so don't bother checking the kids
- }
- }
- // recurse over children
- Item[] items = getChildren(parent);
- Item match = null;
- for (int i = 0; (match == null) && (i < items.length); i++) {
- if (!items[i].isDisposed()) match = recursiveFindFirstRemoteItemReference(items[i], elementName, elementObject, subsystem);
- }
- return match;
- }
-
- /**
- * Recursively tries to find all occurrences of a given remote object, starting at the tree root.
- * Since the object memory object for a remote object is not dependable we call getAbsoluteName()
- * on the adapter to do the comparisons.
- * <p>
- * TODO: This method should not return any invalid matches, i.e. remote objects
- * that do match the String identifier but have been deleted already. Because the
- * same remote object can appear in multiple contexts in the RSE Tree, a single
- * remote object identifier String may evaluate to multiple different matches
- * to fill into the matches argument. All those context object matches, however,
- * reference the same real-world model objects due to the constraint that
- * {@link IRemoteObjectIdentifier} uniquely identifies a remote object.
- * <p>
- * This overload takes a string and a subsystem.
- *
- * @param searchString the absolute name of the remote object to which
- * we want to find a tree item which references it.
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @param matches the List to populate with hits (TreeItem objects),
- * or <code>null</code> to get a new List created and returned
- * @return the List populated with hits, or <code>null</code> if
- * <code>null</code> was passed as matches to populate and no matches
- * were found.
- */
- protected List findAllRemoteItemReferences(String searchString, Object elementObject, ISubSystem subsystem, List matches) {
- Tree tree = getTree();
- Item[] roots = tree.getItems();
- if (roots == null) return matches;
- if (matches == null)
- matches = new Vector();
-
- boolean foundExact = false;
- for (int idx = 0; idx < roots.length; idx++){
- if (recursiveFindExactMatches((TreeItem)roots[idx], elementObject, subsystem, matches)){
- foundExact = true;
- }
- }
-
- if (!foundExact)
- {
- for (int idx = 0; idx < roots.length; idx++){
- matches = recursiveFindAllRemoteItemReferences(roots[idx], searchString, elementObject, subsystem, matches);
- }
- }
-
- return matches;
- }
-
- private boolean recursiveFindExactMatches(TreeItem root, Object elementObject, ISubSystem subsystem, List matches)
- {
- boolean foundSomething = false;
- Object data = root.getData();
- if (data == elementObject)
- {
- matches.add(root);
- foundSomething = true;
- }
- if (subsystem != null){
- if (data instanceof ISubSystem){
- if (data != subsystem)
- return false;
- }
- else if (data instanceof IHost){
- if (subsystem.getHost() != data)
- return false;
- }
- }
-
- TreeItem[] children = root.getItems();
- for (int i = 0; i < children.length; i++)
- {
- if (recursiveFindExactMatches(children[i], elementObject, subsystem, matches))
- {
- foundSomething = true;
- }
- }
- return foundSomething;
- }
-
- protected boolean mappedFindAllRemoteItemReferences(Object elementObject, List occurrences)
- {
- Widget[] items = findItems(elementObject);
- if (items.length > 0)
- {
- for (int i = 0; i < items.length; i++)
- {
- occurrences.add(items[i]);
- }
- return true;
- }
-
- return false;
- }
-
- /**
- * Recursively tries to find all references to a remote object.
- * @param parent the parent item at which to start the search.
- * @param elementName the absolute name of the remote element to find
- * @param elementObject the actual remote element to find, for binary matching
- * @param subsystem optional subsystem to search within
- * @param occurrences the List to populate with hits. Must not be <code>null</code>
- * @return the given List populated with hits
- */
- protected List recursiveFindAllRemoteItemReferences(Item parent, String elementName, Object elementObject, ISubSystem subsystem, List occurrences) {
- Object rawData = parent.getData();
- ISystemViewElementAdapter remoteAdapter = null;
- // ----------------------------
- // what are we looking at here?
- // ----------------------------
- if (rawData != null) remoteAdapter = getViewAdapter(rawData);
- // -----------------------------------------------------------------------
- // if this is a remote object, test if it is the one we are looking for...
- // -----------------------------------------------------------------------
- if (remoteAdapter != null) {
- // first test for binary match
- if (elementObject == rawData) {
- occurrences.add(parent); // found a match!
- if (debugRemote) System.out.println("Find All: Remote item binary match found"); //$NON-NLS-1$
- return occurrences; // no point in checking the kids
- }
- // now test for absolute name match
- String fqn = remoteAdapter.getAbsoluteName(rawData);
- if (debugRemote) System.out.println("TESTING FINDALL: '" + fqn + "' vs '" + elementName + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if ((fqn != null) && fqn.equals(elementName)) {
- occurrences.add(parent); // found a match!
- if (debugRemote) System.out.println("...and remote item name match found"); //$NON-NLS-1$
- return occurrences; // no point in checking the kids
- }
- }
- // -------------------------------------------------------------------------
- // if we have been given a subsystem to restrict to, that is a hint to us...
- // -------------------------------------------------------------------------
- else if ((rawData != null) && (subsystem != null)) // test for hints we are in the wrong place
- {
- // if we are currently visiting a subsystem, and that subsystem is not from the same
- // factory, then we can assume the remote object occurrences we are looking for are
- // not to be found within this branch...
- if ((rawData instanceof ISubSystem) && (((ISubSystem) rawData).getSubSystemConfiguration() != subsystem.getSubSystemConfiguration())) {
- return occurrences; // they don't match, so don't bother checking the kids
- }
- // if we are currently visiting a connection, and that connection's hostname is not the same
- // as that of our given subsystem, then we can assume the remote object occurrences we are
- // looking for are not to be found within this branch...
- else if ((rawData instanceof IHost) && (!((IHost) rawData).getHostName().equals(subsystem.getHost().getHostName()))) {
- return occurrences; // they don't match, so don't bother checking the kids
- }
- }
- // recurse over children
- Item[] items = getChildren(parent);
- for (int i = 0; (i < items.length); i++) {
-
- if (!items[i].isDisposed()) occurrences = recursiveFindAllRemoteItemReferences(items[i], elementName, elementObject, subsystem, occurrences);
- }
- return occurrences;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewPart.java
deleted file mode 100644
index 452050836..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewPart.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kevin Doyle (IBM) - [182403] Double Click on an object that can be expanded
- * Kevin Doyle (IBM) - [195543] Double Clicking expands wrong folder when duplicate elements shown
- * Kevin Doyle (IBM) - [193155] Double Clicking on a String in Scratchpad Errors
- * Kevin Doyle (IBM) - [194867] Remote Scratchpad should have Refresh Action on toolbar
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.scratchpad;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAction;
-import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.IRSEViewPart;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.ViewPart;
-
-
-/**
- * This class is the Remote Scratchpad view.
- */
-public class SystemScratchpadViewPart extends ViewPart
- implements ISelectionListener, ISelectionChangedListener,
- ISystemResourceChangeListener, ISystemShellProvider,
- ISystemMessageLine, IRSEViewPart
-{
-
-
- private SystemScratchpadView _viewer;
-
- // common actions
- private SystemCopyToClipboardAction _copyAction;
- private SystemPasteFromClipboardAction _pasteAction;
- private SystemCommonDeleteAction _deleteAction;
- private SystemCommonRenameAction _renameAction;
- private ClearAction _clearAction;
- private ClearSelectedAction _clearSelectionAction;
- private SystemRefreshAction _refreshAction;
-
- // for ISystemMessageLine
- private String _message, _errorMessage;
- private SystemMessage sysErrorMessage;
- private IStatusLineManager _statusLine = null;
-
- // constants
- public static final String ID = "org.eclipse.rse.ui.view.scratchpad.SystemScratchpadViewPart"; // matches id in plugin.xml, view tag //$NON-NLS-1$
-
- public void setFocus()
- {
- _viewer.getControl().setFocus();
- }
-
- public SystemScratchpadView getViewer()
- {
- return _viewer;
- }
-
- public Viewer getRSEViewer()
- {
- return _viewer;
- }
-
- public void createPartControl(Composite parent)
- {
- Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
-
- _viewer = new SystemScratchpadView(tree, this);
-
- ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.addSelectionListener(this);
- _viewer.addSelectionChangedListener(this);
- getSite().setSelectionProvider(_viewer);
-
- _viewer.addDoubleClickListener(new IDoubleClickListener()
- {
- public void doubleClick(DoubleClickEvent event)
- {
- handleDoubleClick(event);
- }
- });
-
- fillLocalToolBar();
-
- // register global edit actions
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
-
- CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
-
- _copyAction = new SystemCopyToClipboardAction(_viewer.getShell(), clipboard);
- _pasteAction = new SystemPasteFromClipboardAction(_viewer.getShell(), clipboard);
- _deleteAction = new SystemCommonDeleteAction(_viewer.getShell(), _viewer);
- _renameAction = new SystemCommonRenameAction(_viewer.getShell(), _viewer);
-
- // register rename action as a global handler
- getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.RENAME.getId(), _renameAction);
-
- editorActionHandler.setCopyAction(_copyAction);
- editorActionHandler.setPasteAction(_pasteAction);
- editorActionHandler.setDeleteAction(_deleteAction);
- //editorActionHandler.setSelectAllAction(new SelectAllAction());
-
- registry.addSystemResourceChangeListener(this);
-
- SystemWidgetHelpers.setHelp(_viewer.getControl(), RSEUIPlugin.HELPPREFIX + "scrp0000"); //$NON-NLS-1$
-
- setInput(SystemRegistryUI.getInstance().getSystemScratchPad());
-
- getSite().registerContextMenu(_viewer.getContextMenuManager(), _viewer);
- }
-
- public void selectionChanged(IWorkbenchPart part, ISelection sel)
- {
- }
-
- public void dispose()
- {
- ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.removeSelectionListener(this);
- _viewer.removeSelectionChangedListener(this);
-
- RSECorePlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
-
- if (_viewer != null)
- {
- _viewer.dispose();
- }
-
- super.dispose();
- }
-
- private void handleDoubleClick(DoubleClickEvent event)
- {
- ITreeSelection s = (ITreeSelection) event.getSelection();
- Object element = s.getFirstElement();
-
- if (element == null || !(element instanceof IAdaptable))
- return;
-
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element).getAdapter(ISystemViewElementAdapter.class);
-
- if (adapter != null)
- {
- if (adapter.hasChildren((IAdaptable)element))
- {
- // Get the path for the element and use it for setting expanded state,
- // so the proper TreeItem is expanded/collapsed
- TreePath[] paths = s.getPathsFor(element);
- if (paths == null || paths.length == 0 || paths[0] == null) return;
- TreePath elementPath = paths[0];
- if (_viewer.getExpandedState(elementPath))
- {
- _viewer.collapseToLevel(elementPath, 1);
- }
- else
- {
- _viewer.expandToLevel(elementPath, 1);
- }
- }
- else
- {
- adapter.handleDoubleClick(element);
- }
- }
- }
-
- public void updateActionStates()
- {
- if (_clearAction == null)
- fillLocalToolBar();
-
- _clearAction.checkEnabledState();
- _clearSelectionAction.checkEnabledState();
- }
-
- public void fillLocalToolBar()
- {
- IActionBars actionBars = getViewSite().getActionBars();
- IToolBarManager toolBarManager = actionBars.getToolBarManager();
- IMenuManager menuMgr = actionBars.getMenuManager();
-
- if (_clearAction == null) {
- _clearAction = new ClearAction(_viewer);
- _clearSelectionAction = new ClearSelectedAction(_viewer);
- }
-
- if (_refreshAction == null) {
- _refreshAction = new SystemRefreshAction(getShell());
- _refreshAction.setId(ActionFactory.REFRESH.getId());
- _refreshAction.setActionDefinitionId("org.eclipse.ui.file.refresh"); //$NON-NLS-1$
- _refreshAction.setSelectionProvider(_viewer);
- }
- actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), _refreshAction);
-
- updateActionStates();
-
- _statusLine = actionBars.getStatusLineManager();
-
- addToolBarItems(toolBarManager);
- addToolBarMenuItems(menuMgr);
- }
-
- private void addToolBarMenuItems(IMenuManager menuManager)
- {
- menuManager.removeAll();
- menuManager.add(_refreshAction);
- menuManager.add(new Separator());
- menuManager.add(_clearSelectionAction);
- menuManager.add(_clearAction);
- }
-
- private void addToolBarItems(IToolBarManager toolBarManager)
- {
- toolBarManager.removeAll();
- toolBarManager.add(_refreshAction);
- toolBarManager.add(new Separator());
- toolBarManager.add(_clearSelectionAction);
- toolBarManager.add(_clearAction);
- }
-
- public void selectionChanged(SelectionChangedEvent e)
- {
- // listener for this view
- updateActionStates();
-
- IStructuredSelection sel = (IStructuredSelection) e.getSelection();
- _copyAction.setEnabled(_copyAction.updateSelection(sel));
- _pasteAction.setEnabled(_pasteAction.updateSelection(sel));
- _deleteAction.setEnabled(_deleteAction.updateSelection(sel));
- }
-
- public void setInput(IAdaptable object)
- {
- setInput(object, null);
-
- }
-
- public void setInput(IAdaptable object, String[] filters)
- {
- if (_viewer != null && object != null)
- {
- _viewer.setInput(object);
-
- updateActionStates();
-
- }
- }
-
- /**
- * Used to asynchronously update the view whenever properties change.
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
- Object parent = event.getParent();
-
- if (event.getType() == ISystemResourceChangeEvents.EVENT_RENAME)
- {
- }
-
- if (parent == _viewer.getInput())
- {
- updateActionStates();
- }
- }
-
- public Shell getShell()
- {
- return _viewer.getShell();
- }
-
-
-// -------------------------------
- // ISystemMessageLine interface...
- // -------------------------------
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- _errorMessage = null;
- sysErrorMessage = null;
- if (_statusLine != null)
- _statusLine.setErrorMessage(_errorMessage);
- }
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- _message = null;
- if (_statusLine != null)
- _statusLine.setMessage(_message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage()
- {
- return _errorMessage;
- }
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage()
- {
- return _message;
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- this._errorMessage = message;
- if (_statusLine != null)
- _statusLine.setErrorMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- return sysErrorMessage;
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- sysErrorMessage = message;
- setErrorMessage(message.getLevelOneText());
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(Throwable exc)
- {
- setErrorMessage(exc.getMessage());
- }
-
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- this._message = message;
- if (_statusLine != null)
- _statusLine.setMessage(message);
- }
- /**
- *If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- setMessage(message.getLevelOneText());
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewProvider.java
deleted file mode 100644
index c1fc1bcf1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/scratchpad/SystemScratchpadViewProvider.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.scratchpad;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-
-/**
- * This is the content and label provider for the SystemScratchpadView.
- * This class is used both to populate the SystemScratchpadView but also
- * to resolve the icon and labels for the cells in the table/tree.
- *
- */
-public class SystemScratchpadViewProvider implements ILabelProvider, ITreeContentProvider
-{
-
-
- private ListenerList listeners = new ListenerList(1);
-
-
- /**
- * The cache of images that have been dispensed by this provider.
- * Maps ImageDescriptor->Image.
- */
- private Map imageTable = new Hashtable(40);
- private SystemScratchpadView _view;
-
- public SystemScratchpadViewProvider(SystemScratchpadView view)
- {
- super();
- _view = view;
- }
-
- public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
- {
- }
-
-
-
- public boolean isDeleted(Object element)
- {
- return false;
- }
-
- public Object[] getChildren(Object object)
- {
- return getElements(object);
- }
-
- public Object getParent(Object object)
- {
- return getAdapterFor(object).getParent(object);
- }
-
- public boolean hasChildren(Object object)
- {
-
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- if (object instanceof IContextObject)
- {
- return adapter.hasChildren((IContextObject)object);
- }
- else
- {
- return adapter.hasChildren((IAdaptable)object);
- }
- }
- else if (object instanceof IAdaptable)
- {
- IWorkbenchAdapter wa = (IWorkbenchAdapter)((IAdaptable)object).getAdapter(IWorkbenchAdapter.class);
- if (wa != null)
- return wa.getChildren(object).length > 0;
- }
- return false;
- }
-
- public Object getElementAt(Object object, int i)
- {
-
- return null;
- }
-
- protected ISystemViewElementAdapter getAdapterFor(Object object)
- {
- if (object instanceof IContextObject)
- {
- object = ((IContextObject)object).getModelObject();
- }
- if (object instanceof IAdaptable)
- {
- IAdaptable adapt = (IAdaptable) object;
- ISystemViewElementAdapter result = (ISystemViewElementAdapter) adapt.getAdapter(ISystemViewElementAdapter.class);
- if (result != null)
- {
- result.setPropertySourceInput(object);
- result.setViewer(_view);
- return result;
- }
- }
- return null;
- }
-
- public Object[] getElements(Object object)
- {
- Object[] results = null;
-
- Object element = object;
- if (object instanceof IContextObject)
- {
- element = ((IContextObject)object).getModelObject();
- }
- if (element instanceof IAdaptable)
- {
- ISystemViewElementAdapter adapter = getAdapterFor(element);
- if (adapter != null && adapter.hasChildren((IAdaptable)element))
- {
- if (object instanceof IContextObject)
- {
- results = adapter.getChildren((IContextObject)object, new NullProgressMonitor());
- }
- else
- {
- results = adapter.getChildren((IAdaptable)object, new NullProgressMonitor());
- }
- }
- else
- {
- IWorkbenchAdapter wa = (IWorkbenchAdapter)((IAdaptable)object).getAdapter(IWorkbenchAdapter.class);
- if (wa != null)
- return wa.getChildren(object);
- }
- }
- if (results == null)
- {
- return new Object[0];
- }
-
- return results;
- }
-
- public String getText(Object object)
- {
- if (object instanceof String)
- {
- return (String)object;
- }
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- return adapter.getText(object);
- }
- else if (object instanceof IAdaptable)
- {
- IWorkbenchAdapter wa = (IWorkbenchAdapter)((IAdaptable)object).getAdapter(IWorkbenchAdapter.class);
- if (wa != null)
- {
- return wa.getLabel(object);
- }
- }
- return object.toString();
- }
-
- public Image getImage(Object object)
- {
- Image image = null;
- if (object instanceof String)
- {
- return null;
- }
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- ImageDescriptor descriptor = adapter.getImageDescriptor(object);
-
-
- if (descriptor != null)
- {
- Object iobj = imageTable.get(descriptor);
- if (iobj == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- else
- {
- image = (Image) iobj;
- }
- }
- return image;
- }
- else if (object instanceof IAdaptable)
- {
- IWorkbenchAdapter wa = (IWorkbenchAdapter)((IAdaptable)object).getAdapter(IWorkbenchAdapter.class);
- if (wa != null)
- {
- ImageDescriptor descriptor = wa.getImageDescriptor(object);
- if (descriptor != null)
- {
- Object iobj = imageTable.get(descriptor);
- if (iobj == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- else
- {
- image = (Image) iobj;
- }
- }
- return image;
- }
- }
- return null;
- }
-
-
- public void addListener(ILabelProviderListener listener)
- {
- listeners.add(listener);
- }
-
- public boolean isLabelProperty(Object element, String property)
- {
- return true;
- }
-
- public void removeListener(ILabelProviderListener listener)
- {
- listeners.remove(listener);
- }
-
- public void dispose()
- {
- // TODO Auto-generated method stub
-
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchClearHistoryAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchClearHistoryAction.java
deleted file mode 100644
index 2377e924c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchClearHistoryAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This action clears the history in the Remote Search view.
- */
-public class SystemSearchClearHistoryAction extends SystemBaseAction {
-
- private SystemSearchViewPart searchView;
-
- /**
- * Constructor for action.
- * @param searchView the remote search view.
- * @param shell the shell.
- */
- public SystemSearchClearHistoryAction(SystemSearchViewPart searchView, Shell shell) {
- super(SystemResources.RESID_SEARCH_CLEAR_HISTORY_LABEL,SystemResources.RESID_SEARCH_CLEAR_HISTORY_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_CLEAR_HISTORY_ID), shell);
-
- this.searchView = searchView;
- RSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, RSEUIPlugin.HELPPREFIX + "search_clear_history"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- searchView.deleteAllPages();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchCopyToClipboardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchCopyToClipboardAction.java
deleted file mode 100644
index d1af839ff..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchCopyToClipboardAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.rse.ui.actions.SystemCopyToClipboardAction;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Action that copies objects selected in Remote Search view to clipboard.
- */
-public class SystemSearchCopyToClipboardAction extends SystemCopyToClipboardAction {
-
- /**
- * Constructor.
- * @param shell the shell.
- * @param clipboard the system clipboard.
- */
- public SystemSearchCopyToClipboardAction(Shell shell, Clipboard clipboard) {
- super(shell, clipboard);
- }
-
- /**
- * Returns the string "\t" if the object is a remote search result, otherwise returns the super class
- * implementation.
- * @see org.eclipse.rse.ui.actions.SystemCopyToClipboardAction#getTextTransferPrepend(java.lang.Object, org.eclipse.rse.ui.view.ISystemViewElementAdapter)
- */
- protected String getTextTransferPrepend(Object obj, ISystemViewElementAdapter adapter) {
- /** shouldn't be coupled with search (files ui)
- if (adapter instanceof SystemViewRemoteSearchResultAdapter)
- {
- return "\t";
- }
- else
- **/
- {
- return super.getTextTransferPrepend(obj, adapter);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchHistoryAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchHistoryAction.java
deleted file mode 100644
index 9f22ce89e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchHistoryAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-/**
- * This is the history action for the remote system search view.
- */
-public class SystemSearchHistoryAction extends Action {
-
-
-
- private SystemSearchViewPart searchView;
- private int index;
-
- /**
- * Constructor for SystemSearchHistoryAction.
- * @param text the text for the action.
- * @param image the image.
- * @param searchView the search view.
- * @param index the index in the history.
- */
- public SystemSearchHistoryAction(String text, ImageDescriptor image, SystemSearchViewPart searchView, int index) {
- super(text, image);
- setToolTipText(text);
- this.searchView = searchView;
- this.index = index;
- RSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, RSEUIPlugin.HELPPREFIX + "search_history"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- searchView.showSearchResult(index);
- }
-
- /**
- * Sets the text and the tooltip.
- * @see org.eclipse.jface.action.IAction#setText(java.lang.String)
- */
- public void setText(String text) {
- super.setText(text);
- setToolTipText(text);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveAllMatchesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveAllMatchesAction.java
deleted file mode 100644
index d103744c7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveAllMatchesAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This action removes all matches from the Remote Search view.
- */
-public class SystemSearchRemoveAllMatchesAction extends SystemBaseAction {
-
- private SystemSearchViewPart searchView;
-
- /**
- * Constructor for action.
- * @param searchView the remote search view.
- * @param shell the shell.
- */
- public SystemSearchRemoveAllMatchesAction(SystemSearchViewPart searchView, Shell shell) {
- super(SystemResources.RESID_SEARCH_REMOVE_ALL_MATCHES_LABEL,SystemResources.RESID_SEARCH_REMOVE_ALL_MATCHES_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_REMOVE_ALL_MATCHES_ID),
- shell);
-
- this.searchView = searchView;
- RSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, RSEUIPlugin.HELPPREFIX + "search_remove_all"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- searchView.deleteCurrentPage();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java
deleted file mode 100644
index 6edb8c691..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchRemoveSelectedMatchesAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This action removes selected matches from the Remote Search view.
- */
-public class SystemSearchRemoveSelectedMatchesAction extends SystemBaseAction {
-
- private SystemSearchViewPart searchView;
-
- /**
- * Constructor for action.
- * @param searchView the remote search view.
- * @param shell the shell.
- */
- public SystemSearchRemoveSelectedMatchesAction(SystemSearchViewPart searchView, Shell shell) {
- super(SystemResources.RESID_SEARCH_REMOVE_SELECTED_MATCHES_LABEL,SystemResources.RESID_SEARCH_REMOVE_SELECTED_MATCHES_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SEARCH_REMOVE_SELECTED_MATCHES_ID),
- shell);
-
- this.searchView = searchView;
- RSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, RSEUIPlugin.HELPPREFIX + "search_remove_selected"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- searchView.deleteSelected();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableView.java
deleted file mode 100644
index 5c319d7d3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableView.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Kevin Doyle (IBM) - [192725] Deleting Files doesn't remove them from Search view
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.view.SystemDecoratingLabelProvider;
-import org.eclipse.rse.internal.ui.view.SystemTableTreeView;
-import org.eclipse.rse.internal.ui.view.SystemTableTreeViewProvider;
-import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
-import org.eclipse.rse.services.search.IHostSearchResultSet;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.Widget;
-
-
-public class SystemSearchTableView extends SystemTableTreeView
-{
-
-
- private boolean _firstRefresh = true;
- private IHostSearchResultSet resultSet;
-
- public SystemSearchTableView(Tree tabletree, IHostSearchResultSet resultSet, ISystemMessageLine msgLine)
- {
- super(tabletree, msgLine);
- this.resultSet = resultSet;
-
- _provider.disableDeferredQueries(true);
- setLabelProvider(new SystemDecoratingLabelProvider(_provider, RSEUIPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
- }
-
- public IHostSearchResultSet getResultSet() {
- return resultSet;
- }
-
-
- public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
- {
- int eventType = event.getEventType();
-
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)getContentProvider();
-
- IHostSearchResultSet resultSet = null;
-
- if (getInput() instanceof IHostSearchResultSet) {
- resultSet = (IHostSearchResultSet)getInput();
- }
-
- if (resultSet == null) {
- return;
- }
-
- switch (eventType)
- {
- // --------------------------
- // REMOTE RESOURCE DELETED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
- {
- {
- Object remoteResource = event.getResource();
- List remoteResourceNames = null;
-
- if (remoteResource instanceof List)
- {
- remoteResourceNames = (List) remoteResource;
- remoteResource = remoteResourceNames.get(0);
- }
- else
- {
- remoteResourceNames = new Vector();
- remoteResourceNames.add(remoteResource);
- }
-
- for (int d = 0; d < remoteResourceNames.size(); d++)
- {
- Object dchild = remoteResourceNames.get(d);
-
- ISystemViewElementAdapter dadapt = getViewAdapter(dchild);
- ISubSystem dSubSystem = dadapt.getSubSystem(dchild);
- String dkey = dadapt.getAbsoluteName(dchild);
-
- // this will use cache if there is one already
- // note: do not call provider.getCache() since the
- // cache is changed if getChildren() is called with
- // an object other than the input (so if we expand
- // a tree node then the cache will be the children
- // of that node, and not the root nodes of the tree)
- Object[] children = provider.getChildren(resultSet);
-
- for (int i = 0; i < children.length; i++)
- {
- Object existingChild = children[i];
-
- if (existingChild != null)
- {
- ISystemViewElementAdapter eadapt = getViewAdapter(existingChild);
- ISubSystem eSubSystem = eadapt.getSubSystem(existingChild);
-
- if (dSubSystem == eSubSystem)
- {
- String ekey = eadapt.getAbsoluteName(existingChild);
-
- boolean matches = false;
-
- // to compare absolute paths, check whether the system
- // is case sensitive or not
- if (dSubSystem.getSubSystemConfiguration().isCaseSensitive()) {
- matches = ekey.equals(dkey);
- }
- else {
- matches = ekey.equalsIgnoreCase(dkey);
- }
-
- if (matches)
- {
- resultSet.removeResult(existingChild);
- provider.setCache(resultSet.getAllResults());
- remove(existingChild);
- }
- }
- }
- }
-
- // If the deleted object is part of an archive it might be
- // visible in the search view, but not part of the result set
- Widget widget = findItem(dchild);
- if (widget != null)
- {
- Object data = widget.getData();
- remove(data);
- }
- }
- }
-
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
- {
- Object resource = event.getResource();
- // String resourceOldPath = event.getOldName();
-
- /** FIXME - IREmoteFile is systems.core independent now
- // we only care about remote file renames
- if (resource instanceof IRemoteFile) {
-
- ISystemRemoteElementAdapter adapter = getRemoteAdapter(resource);
- resourceSubSystem = adapter.getSubSystem(resource);
-
- if (resourceSubSystem == null) {
- return;
- }
- }
- else
- {
- return;
- }
- */
- if (true) // DKM - hack to avoid this
- return;
- if (provider != null)
- {
- // this will use cache if there is one already
- // note: do not call provider.getCache() since the
- // cache is changed if getChildren() is called with
- // an object other than the input (so if we expand
- // a tree node then the cache will be the children
- // of that node, and not the root nodes of the tree)
- Object[] children = provider.getChildren(resultSet);
-
- for (int i = 0; i < children.length; i++)
- {
- Object child = children[i];
-
- // found same object. This means:
- // a) rename happened in this view, or
- // b) we are using the same object to populate this view
- // and another view, and the rename happened in the
- // other view
- if (child == resource)
- {
- Widget widget = findItem(child);
-
- if (widget != null)
- {
- update(child, null);
- return;
- }
- }
-
- /** FIXME - IREmoteFile is systems.core independent now
- // did not find object
- // rename happened in another view and we are not populating
- // this view and the other view with the same object
- else if (child instanceof IRemoteFile)
- {
- ISystemRemoteElementAdapter adapt = getRemoteAdapter(child);
- ISubSystem childSubSystem = adapt.getSubSystem(child);
-
- // check if both are from the same subsystem
- if (childSubSystem == resourceSubSystem) {
-
- String childPath = adapt.getAbsoluteName(child);
-
- // find out if system is case sensitive
- boolean isCaseSensitive = resourceSubSystem.getParentSubSystemConfiguration().isCaseSensitive();
-
- boolean matches = false;
-
- // look for the child whose path matches the old path of the resource
- if (isCaseSensitive) {
- matches = childPath.equals(resourceOldPath);
- }
- else {
- matches = childPath.equalsIgnoreCase(resourceOldPath);
- }
-
- // if paths match, update the object and then update the view
- if (matches) {
-
-
-
- // now update label for child
- Widget widget = findItem(child);
-
- if (widget != null) {
- update(child, null);
- return;
- }
- }
- }
- }*/
-
- }
- }
- break;
- }
- default :
- super.systemRemoteResourceChanged(event);
- break;
- }
- }
-
- protected void doUpdateItem(Widget widget, Object element, boolean flag)
- {
- if (_firstRefresh)
- {
- computeLayout(true);
- _firstRefresh = false;
- }
-
- super.doUpdateItem(widget, element, flag);
- }
-
- public void systemResourceChanged(ISystemResourceChangeEvent event) {
- Object actualSource = event.getSource();
-
- switch (event.getType()) {
-
- case ISystemResourceChangeEvents.EVENT_REFRESH :
-
- if (actualSource == null) {
- return;
- }
-
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)getContentProvider();
-
- if (provider == null) {
- return;
- }
-
- if (actualSource instanceof IHostSearchResultConfiguration) {
-
- IHostSearchResultConfiguration config = (IHostSearchResultConfiguration)actualSource;
- IHostSearchResultSet resultSet = config.getParentResultSet();
-
- if (resultSet == getInput()) {
- // this will use cache if there is one already
- // note: do not call provider.getCache() since the
- // cache is changed if getChildren() is called with
- // an object other than the input (so if we expand
- // a tree node then the cache will be the children
- // of that node, and not the root nodes of the tree)
- Object[] previousResults = provider.getCachedObjects(resultSet);
- Object[] newResults = resultSet.getAllResults();
-
- int newSize = newResults.length;
-
- // merge items so only one creation
- if ((previousResults == null || previousResults.length == 0) && newResults.length != 0) {
- provider.flushCache();
- refresh(getInput());
-
- }
- else if (previousResults != null) {
-
- int deltaSize = newSize - previousResults.length;
-
- if (deltaSize > 0) {
-
- Object[] delta = new Object[deltaSize];
- int d = 0;
-
- for (int i = 0; i < newSize; i++) {
- Object nobj = newResults[i];
-
- if (previousResults.length > i) {
- Object pobj = previousResults[i];
-
- if (pobj == null) {
- delta[d] = nobj;
- d++;
- }
- }
- else {
- delta[d] = nobj;
- d++;
- }
- }
-
- // must set the cache before calling add()
- provider.setCache(newResults);
-
- // set the cached objects
- provider.setCachedObjects(resultSet, newResults);
-
- if (delta.length > 2000) {
- internalRefresh(getInput());
- }
- else {
- add(getInput(), delta);
- }
- }
- }
- }
- }
-
- break;
-
- default :
- super.systemResourceChanged(event);
- break;
- }
- }
-
- protected Object getParentForContent(Object element)
- {
- return getViewAdapter(element).getParent(element);
- }
-
-
- /**
- * Does nothing.
- * @see org.eclipse.rse.internal.ui.view.SystemTableTreeView#handleKeyPressed(org.eclipse.swt.events.KeyEvent)
- */
- protected void handleKeyPressed(KeyEvent event) {
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableViewProvider.java
deleted file mode 100644
index 6b70eda66..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchTableViewProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.rse.internal.ui.view.SystemTableTreeViewProvider;
-import org.eclipse.rse.internal.ui.view.SystemTableViewColumnManager;
-
-public class SystemSearchTableViewProvider extends SystemTableTreeViewProvider
-{
-
- public SystemSearchTableViewProvider(SystemTableViewColumnManager columnManager)
- {
- super(columnManager);
- }
-
- public String getText(Object object)
- {
- String text = getAdapterFor(object).getName(object);
- /** FIXME - IREmoteFile is systems.core independent now
- if (object instanceof IRemoteFile) {
- IRemoteFile parent = ((IRemoteFile)object).getParentRemoteFile();
- String absolutePath = getAdapterFor(parent).getAbsoluteName(parent);
- return text + " - " + absolutePath;
- }
- else {
- return text;
- }
- */
- return text;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchUI.java
deleted file mode 100644
index 31f9bd1e6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchUI.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.PartInitException;
-
-
-/**
- * A singleton class for dealing with Remote Search view
- */
-public class SystemSearchUI {
-
-
-
- // singleton instance
- private static SystemSearchUI instance;
-
- // search view id
- public static final String SEARCH_RESULT_VIEW_ID = "org.eclipse.rse.ui.view.SystemSearchView"; //$NON-NLS-1$
-
- /**
- * Constructor for SystemSearchUI.
- */
- private SystemSearchUI() {
- super();
- }
-
- /**
- * Get the singleton instance.
- * @return the singleton object of this type
- */
- public static SystemSearchUI getInstance() {
-
- if (instance == null) {
- instance = new SystemSearchUI();
- }
-
- return instance;
- }
-
- /**
- * Activate search result view.
- * @return <code>true</code> if successful, <code>false</false> otherwise
- */
- public SystemSearchViewPart activateSearchResultView() {
-
- SystemSearchViewPart searchView = null;
-
- try {
- searchView = (SystemSearchViewPart)(SystemBasePlugin.getActiveWorkbenchWindow().getActivePage().showView(SystemSearchUI.SEARCH_RESULT_VIEW_ID));
- }
- catch (PartInitException e) {
- SystemBasePlugin.logError("Can not open search result view", e); //$NON-NLS-1$
- }
-
- return searchView;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewContentProvider.java
deleted file mode 100644
index eb3485087..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewContentProvider.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.ui.part.ViewPart;
-
-
-/**
- * This class is the content provider for the remote systems search viewer.
- */
-public class SystemSearchViewContentProvider implements ITreeContentProvider {
-
-
- private ViewPart viewPart;
-
- /**
- * Constructor for SystemSearchViewContentProvider.
- */
- public SystemSearchViewContentProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
- */
- public Object[] getChildren(Object parentElement) {
-
- if (parentElement == null) {
- return null;
- }
-
- if (parentElement instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = getViewAdapter(parentElement);
-
- if (adapter == null) {
- return null;
- }
- else {
- return adapter.getChildren((IAdaptable)parentElement, new NullProgressMonitor());
- }
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object)
- */
- public Object getParent(Object element) {
-
- if (element == null) {
- return null;
- }
-
- if (element instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
-
- if (adapter == null) {
- return null;
- }
- else {
- return adapter.getParent(element);
- }
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)
- */
- public boolean hasChildren(Object element) {
-
- if (element == null) {
- return false;
- }
-
- if (element instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
-
- if (adapter == null) {
- return false;
- }
- else {
- return adapter.hasChildren((IAdaptable)element);
- }
- }
-
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object inputElement) {
-
- if (inputElement == null) {
- return null;
- }
-
- if (inputElement instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = getViewAdapter(inputElement);
-
- if (adapter == null) {
- return null;
- }
- else {
- return adapter.getChildren((IAdaptable)inputElement, new NullProgressMonitor());
- }
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- if (newInput == null) {
- return;
- }
-
- if (newInput instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = getViewAdapter(newInput);
-
- if (adapter != null) {
- viewer.refresh();
- }
- }
- }
-
- /**
- * Get the adapter for the given object.
- * @param the object
- * @return the adapter
- */
- public ISystemViewElementAdapter getViewAdapter(Object element)
- {
- return SystemAdapterHelpers.getViewAdapter(element);
- }
- /**
- * Set the ViewPart of this provider
- * @param ViewPart of this provider
- */
- public void setViewPart(ViewPart viewPart)
- {
- this.viewPart = viewPart;
- }
- /**
- * Get the ViewPart of this provider
- * @return ViewPart of this provider
- */
- public ViewPart getViewPart()
- {
- return viewPart;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewLabelProvider.java
deleted file mode 100644
index 470ce1792..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewLabelProvider.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * This is the label provider for the remote systems search view.
- */
-public class SystemSearchViewLabelProvider extends LabelProvider {
-
-
-
- /**
- * Constructor for SystemSearchViewLabelProvider.
- */
- public SystemSearchViewLabelProvider() {
- super();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(Object)
- */
- public Image getImage(Object element) {
-
- if (element == null) {
- return null;
- }
-
- if (element instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
-
- if (adapter != null) {
- ImageDescriptor descriptor = adapter.getImageDescriptor(element);
-
- if (descriptor != null) {
- return descriptor.createImage();
- }
- }
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(Object)
- */
- public String getText(Object element) {
-
- if (element == null) {
- return null;
- }
-
- if (element instanceof IAdaptable) {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
-
- if (adapter != null) {
- return adapter.getText(element);
- }
- }
-
- return null;
- }
-
- /**
- * Get the adapter for the given object.
- * @param the object
- * @return the adapter
- */
- public ISystemViewElementAdapter getViewAdapter(Object element)
- {
- return SystemAdapterHelpers.getViewAdapter(element);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewPart.java
deleted file mode 100644
index 3d4d57dca..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/search/SystemSearchViewPart.java
+++ /dev/null
@@ -1,1278 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.search;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemTableTreeViewProvider;
-import org.eclipse.rse.internal.ui.view.SystemView;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
-import org.eclipse.rse.services.search.IHostSearchResultSet;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.IRSEViewPart;
-import org.eclipse.rse.ui.view.ISystemRemoveElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * This class defines the Remote Search view.
- */
-public class SystemSearchViewPart extends ViewPart
- implements ISystemResourceChangeListener, ISystemShellProvider,
- IMenuListener, ISelectionChangedListener,
- ISystemMessageLine, IRSEViewPart
-{
- private PageBook pageBook;
- private StructuredViewer currentViewer;
-
- private IActionBars actionBars;
- private IMenuManager mMgr;
- private IToolBarManager tbMgr;
- //private IStatusLineManager slMgr;
-
- private static final String MENU_HISTORY_GROUP_NAME = "historyGroup"; //$NON-NLS-1$
- private static final String MENU_CLEAR_HISTORY_GROUP_NAME = "clearHistoryGroup"; //$NON-NLS-1$
-
- private ArrayList viewers = new ArrayList();
- private ArrayList historyActions = new ArrayList();
-
- private CancelAction cancelAction;
- private SystemSearchClearHistoryAction clearHistoryAction;
- private SystemSearchRemoveSelectedMatchesAction removeSelectedAction;
- private SystemSearchRemoveAllMatchesAction removeAllAction;
-
- private SystemSearchCopyToClipboardAction copyAction;
- private SystemPasteFromClipboardAction pasteAction;
-
- // for ISystemMessageLine
- private String _message, _errorMessage;
- private SystemMessage sysErrorMessage;
- private IStatusLineManager _statusLine = null;
-
-
- /**
- * Double click listener.
- */
- public class SystemSearchDoubleClickListener implements IDoubleClickListener {
-
- /**
- * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(DoubleClickEvent)
- */
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) (event.getSelection());
-
- if (!selection.isEmpty()) {
- Object element = selection.getFirstElement();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- adapter.setViewer(currentViewer);
- adapter.handleDoubleClick(element);
- }
- }
- }
-
- class SelectAllAction extends Action {
-
- public SelectAllAction() {
- super(SystemResources.ACTION_SELECT_ALL_LABEL, null);
- }
-
- public void run() {
-
- if ((currentViewer != null) && (currentViewer instanceof TableViewer)) {
- TableViewer viewer = (TableViewer) currentViewer;
- viewer.getTable().selectAll();
- // force viewer selection change
- viewer.setSelection(viewer.getSelection());
- }
- }
- }
-
- public class CancelAction extends Action {
-
- public CancelAction() {
- super(SystemResources.ACTION_CANCEL_SEARCH_LABEL, RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_STOP_ID));
- setToolTipText(SystemResources.ACTION_CANCEL_SEARCH_TOOLTIP);
- RSEUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, RSEUIPlugin.HELPPREFIX + "search_cancel"); //$NON-NLS-1$
- }
-
- public void run() {
-
- if (currentViewer == null) {
- return;
- }
-
- Object input = currentViewer.getInput();
-
- if (input != null) {
-
- if (input instanceof IHostSearchResultSet) {
- IHostSearchResultSet resultSet = (IHostSearchResultSet)input;
- setEnabled(false);
- resultSet.cancel();
- }
- }
- }
-
- public void updateEnableState(IAdaptable input) {
-
- // no input yet, so disable it
- if (input == null) {
- setEnabled(false);
- }
-
- if (input instanceof IHostSearchResultSet) {
- IHostSearchResultSet set = (IHostSearchResultSet)input;
-
- // running, so enable it
- if (set.isRunning()) {
- setEnabled(true);
- }
- // otherwise, disable
- else {
- setEnabled(false);
- }
- }
- // some other input, disable it
- else {
- setEnabled(false);
- }
- }
- }
-
- /**
- * Constructor for SystemSearchViewPart.
- */
- public SystemSearchViewPart() {
- super();
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
-
- // create the page book
- pageBook = new PageBook(parent, SWT.NONE);
-
- // pageBook.showPage(createDummyControl());
-
- // get view site
- IViewSite site = getViewSite();
-
- // set a dummy selection provider
- // getSite().setSelectionProvider(createDummySelectionProvider());
-
- // get action bars
- actionBars = site.getActionBars();
-
- // get the menu manager
- mMgr = actionBars.getMenuManager();
-
- // get the tool bar manager
- tbMgr = actionBars.getToolBarManager();
-
- _statusLine = actionBars.getStatusLineManager();
-
-
- // initialize toolbar actions
- initToolBarActions(tbMgr);
-
- // get the status line manager
- //slMgr = actionBars.getStatusLineManager();
-
- // update action bars
- actionBars.updateActionBars();
-
- // add view as a system listener
- RSECorePlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
-
- // set help
- SystemWidgetHelpers.setHelp(pageBook, RSEUIPlugin.HELPPREFIX + "srch0000"); //$NON-NLS-1$
- }
-
- private void initToolBarActions(IToolBarManager tbMgr) {
-
- // create cancel action
- if (cancelAction == null) {
- cancelAction = new CancelAction();
-
- if (currentViewer == null) {
- cancelAction.setEnabled(false);
- }
- else if (currentViewer.getInput() == null){
- cancelAction.setEnabled(false);
- }
- else {
- cancelAction.setEnabled(true);
- }
- }
-
- // create remove selected matches action
- if (removeSelectedAction == null) {
- removeSelectedAction = new SystemSearchRemoveSelectedMatchesAction(this, getShell());
-
- if (currentViewer == null) {
- removeSelectedAction.setEnabled(false);
- }
- else {
- removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
- }
- }
-
- // create remove all matches action
- if (removeAllAction == null) {
- removeAllAction = new SystemSearchRemoveAllMatchesAction(this, getShell());
-
- if (currentViewer == null) {
- removeAllAction.setEnabled(false);
- }
- else {
- Object input = currentViewer.getInput();
- removeAllAction.setEnabled(isRemoveAllEnabled((IAdaptable)input));
- }
- }
-
- // add cancel action
- tbMgr.add(cancelAction);
-
- // add remove selected action
- tbMgr.add(removeSelectedAction);
-
- // add remove all action
- tbMgr.add(removeAllAction);
-
- // clipboard
- Clipboard clipboard = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboard();
- Shell shell = RSEUIPlugin.getTheSystemRegistryUI().getShell();
-
- copyAction = new SystemSearchCopyToClipboardAction(shell, clipboard);
- pasteAction = new SystemPasteFromClipboardAction(shell, clipboard);
-
- CellEditorActionHandler editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
-
- editorActionHandler.setCopyAction(copyAction);
- editorActionHandler.setPasteAction(pasteAction);
- editorActionHandler.setDeleteAction(removeSelectedAction);
- // editorActionHandler.setSelectAllAction(new SelectAllAction());
- }
-
- /**
- * Updates the remove selected action.
- * @return <code>true</code> if remove selected action should be enabled, <code>false</code> otherwise.
- */
- private boolean isRemoveSelectedEnabled() {
-
- ISelection selection = getSelection();
-
- if (selection == null) {
- return false;
- }
- else if (selection.isEmpty()) {
- return false;
- }
- else {
-
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection strSel = (IStructuredSelection)selection;
-
- // note that SystemSearchTableView returns the current input
- // if the actual selection is null
- // so we check for it and return null
- if (strSel.getFirstElement() == currentViewer.getInput()) {
- return false;
- }
- else {
- return true;
- }
- }
- else {
- return false;
- }
- }
- }
-
- /**
- * Updates the remove all matches action.
- * @param input the input to the current viewer, or <code>null</code> if there is currently no input.
- * @return <code>true</code> if remove all action should be enabled, <code>false</code> otherwise.
- */
- private boolean isRemoveAllEnabled(IAdaptable input) {
-
- if (input == null) {
- return false;
- }
-
- ISystemViewElementAdapter adapter = getViewAdapter(input);
-
- if (adapter == null) {
- return false;
- }
- else {
- return adapter.hasChildren(input);
- }
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- pageBook.setFocus();
- }
-
- /**
- * @see org.eclipse.ui.IViewPart#init(IViewSite, IMemento)
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- }
-
- /**
- * @see org.eclipse.ui.IViewPart#saveState(IMemento)
- */
- public void saveState(IMemento memento) {
- super.saveState(memento);
- }
-
- /**
- * Add a search result set.
- * @param resultSet the search result set
- */
- public void addSearchResult(IAdaptable resultSet) {
-
- // if the correct adapter is not registered, then return
- ISystemViewElementAdapter adapter = getViewAdapter(resultSet);
-
- if (adapter == null) {
- return;
- }
-
- if (resultSet instanceof IHostSearchResultSet) {
- currentViewer = createSearchResultsTable((IHostSearchResultSet)resultSet, adapter);
- }
- else {
- currentViewer = createSearchResultsTree(resultSet, adapter);
-
- TreeViewer treeViewer = (TreeViewer)currentViewer;
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(this);
- Tree tree = (Tree)treeViewer.getControl();
- Menu menu = menuMgr.createContextMenu(tree);
- tree.setMenu(menu);
- }
-
- // set input
- currentViewer.setInput(resultSet);
-
- // add as selection changed listener to current viewer
- currentViewer.addSelectionChangedListener(this);
-
- // set as selection provider
- getSite().setSelectionProvider(currentViewer);
-
- // add double click listener
- currentViewer.addDoubleClickListener(new SystemSearchDoubleClickListener());
-
- // set help for control
- SystemWidgetHelpers.setHelp(currentViewer.getControl(), RSEUIPlugin.HELPPREFIX + "srch0000"); //$NON-NLS-1$
-
- // add current viewer to viewer list
- viewers.add(currentViewer);
-
- // get title to use from adapter
- String title = adapter.getText(resultSet);
-
- // set the title of the view
- setContentDescription(title);
-
- int num = viewers.size()-1;
-
- // create history action
- SystemSearchHistoryAction historyAction = new SystemSearchHistoryAction(title, RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SEARCH_RESULT_ID), this, num);
-
- // add to list of history actions
- historyActions.add(historyAction);
-
- // if this is the first result set, add the clear history action
- if (viewers.size() == 1) {
-
- // create a group for history actions
- mMgr.add(new GroupMarker(MENU_HISTORY_GROUP_NAME));
-
- // create a separator with a group for clear history action
- mMgr.add(new Separator(MENU_CLEAR_HISTORY_GROUP_NAME));
-
- // add the clear history action to the group
- clearHistoryAction = new SystemSearchClearHistoryAction(this, getShell());
- mMgr.appendToGroup(MENU_CLEAR_HISTORY_GROUP_NAME, clearHistoryAction);
- }
-
- // add history action to the menu manager
- mMgr.appendToGroup(MENU_HISTORY_GROUP_NAME, historyAction);
-
- // add global actions
- // actionBars.setGlobalActionHandler(ActionFactory.DELETE, new SystemSearchDeleteAction(this));
-
- // update action bars
- actionBars.updateActionBars();
-
- // show the control
- pageBook.showPage(currentViewer.getControl());
-
- // enable/disable state for this input
- if (cancelAction != null) {
- cancelAction.updateEnableState(resultSet);
- }
-
- // enable/disable state
- if (removeSelectedAction != null) {
- removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
- }
-
- // enable/disable state for this input
- if (removeAllAction != null) {
- removeAllAction.setEnabled(isRemoveAllEnabled(resultSet));
- }
- }
-
- private StructuredViewer createSearchResultsTree(IAdaptable resultSet, ISystemViewElementAdapter adapter)
- {
-
- // create the current tree
- Tree currentControl = new Tree(pageBook, SWT.MULTI);
-
- // create the current viewer
- TreeViewer currentViewer = new TreeViewer(currentControl);
- currentViewer.setUseHashlookup(true);
- currentViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
-
- // create a new content provider
- SystemSearchViewContentProvider contentProvider = new SystemSearchViewContentProvider();
- // save the viewpart to the provider
- contentProvider.setViewPart(this);
- // add the content provider to the viewer
- currentViewer.setContentProvider(contentProvider);
-
- // create a new label provider
- SystemSearchViewLabelProvider labelProvider = new SystemSearchViewLabelProvider();
-
- // add the label provider to the viewer
- currentViewer.setLabelProvider(labelProvider);
-
- return currentViewer;
- }
-
- private StructuredViewer createSearchResultsTable(IHostSearchResultSet resultSet, ISystemViewElementAdapter adapter) {
-
- // create table portion
- // TODO change to tabletree when eclipse fixes the swt widget
- //TableTree table = new TableTree(pageBook, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- Tree tabletree = new Tree(pageBook, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
- SystemSearchTableView viewer = new SystemSearchTableView(tabletree, resultSet, this);
-
- getSite().registerContextMenu(viewer.getContextMenuManager(), viewer);
- return viewer;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
-
- // remove as resource change listener
- RSECorePlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
-
- // clear viewers
- clearViewers();
-
- // clear arrays
- viewers.clear();
- historyActions.clear();
-
- // call super as required
- super.dispose();
- }
-
- /**
- * Remove current viewer as selection provider, removes children of all the inputs and disposes
- * the controls if they haven't already been disposed.
- */
- private void clearViewers() {
-
- // remove current viewer as selection provider if it exists
- if (currentViewer != null) {
-
- // remove as selection changed listener to current viewer
- currentViewer.removeSelectionChangedListener(this);
-
- if (getSite().getSelectionProvider() == currentViewer) {
- getSite().setSelectionProvider(null);
- }
- }
-
- for (int i = 0; i < viewers.size(); i++) {
-
- Object viewer = viewers.get(i);
-
- // if we're dealing with universal search
- if (viewer instanceof SystemSearchTableView) {
-
- SystemSearchTableView tableView = (SystemSearchTableView)viewer;
-
- Object input = tableView.getInput();
-
- // dispose the remote search result set
- // which cancels the search and removes contents from the input
- // (i.e. removes from model)
- if (input instanceof IHostSearchResultSet) {
- IHostSearchResultSet set = (IHostSearchResultSet)input;
- set.dispose();
- }
-
- // dispose viewer
- tableView.dispose();
- }
- // other search
- else if (viewer instanceof TreeViewer){
-
- TreeViewer treeView = (TreeViewer)viewer;
-
- Object input = treeView.getInput();
-
- ISystemViewElementAdapter adapter = getViewAdapter(input);
-
- if (adapter != null && adapter instanceof ISystemRemoveElementAdapter) {
- ISystemRemoveElementAdapter rmAdapter = (ISystemRemoveElementAdapter)adapter;
- rmAdapter.removeAllChildren(input);
-
- Control control = treeView.getControl();
-
- if (!control.isDisposed()) {
- control.dispose();
- }
- }
- }
- }
- }
-
- /**
- * Show search result with the given index.
- * @param index the index in the result history list
- */
- public void showSearchResult(int index) {
-
- // remove as selection listener from current viewer
- if (currentViewer != null) {
- currentViewer.removeSelectionChangedListener(this);
- }
-
- // get viewer with this index and make it current
- currentViewer = (StructuredViewer)(viewers.get(index));
-
- // set as selection provider
- getSite().setSelectionProvider(currentViewer);
-
- // add as selection changed listener to current viewer
- currentViewer.addSelectionChangedListener(this);
-
- // get the input
- IAdaptable resultSet = (IAdaptable)(currentViewer.getInput());
-
- if (resultSet == null) {
- return;
- }
-
- ISystemViewElementAdapter adapter = getViewAdapter(resultSet);
-
- // if the correct adapter is not registered, then return
- if (adapter == null) {
- return;
- }
-
- // get title to use from adapter
- String title = adapter.getText(resultSet);
-
- // set the title of the view
- setContentDescription(title);
-
- // get the associated control
- Control currentControl = currentViewer.getControl();
-
- // show the control
- pageBook.showPage(currentControl);
-
- // enable/disable state for this input
- if (cancelAction != null) {
- cancelAction.updateEnableState(resultSet);
- }
-
- // enable/disable state
- if (removeSelectedAction != null) {
- removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
- }
-
- // enable/disable state for this input
- if (removeAllAction != null) {
- removeAllAction.setEnabled(isRemoveAllEnabled(resultSet));
- }
- }
-
- /**
- * Delete the selected object in the view.
- * @return <code>true</code> if the selection has been deleted, <code>false</code> otherwise.
- */
- public boolean deleteSelected() {
-
- if (currentViewer == null) {
- return false;
- }
-
- IStructuredSelection selection = (IStructuredSelection)(currentViewer.getSelection());
-
- if (selection == null || selection.isEmpty()) {
- return false;
- }
-
- Object input = currentViewer.getInput();
-
- ISystemViewElementAdapter adapter = getViewAdapter(input);
-
- // adapter should be an instance of ISystemRemoveElementAdapter
- if (adapter == null || !(adapter instanceof ISystemRemoveElementAdapter)) {
- return false;
- }
-
- Iterator elements = selection.iterator();
-
- ArrayList removeElements = new ArrayList();
-
- while (elements.hasNext()) {
- Object element = elements.next();
- ((ISystemRemoveElementAdapter)adapter).remove(input, element);
- removeElements.add(element);
- }
-
- // current viewer should be an instance of tree viewer
- // remove the elements from it to update the view
- if (currentViewer instanceof TreeViewer) {
- ((TreeViewer)currentViewer).remove(removeElements.toArray());
- }
-
- // get title to use from adapter
- String title = adapter.getText(input);
-
- // set the title of the view
- setContentDescription(title);
-
- // enable/disable state for this input
- if (cancelAction != null) {
- cancelAction.updateEnableState((IAdaptable)input);
- }
-
- // enable/disable state for this input
- if (removeSelectedAction != null) {
- removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
- }
-
- // enable/disable state for this input
- if (removeAllAction != null) {
- removeAllAction.setEnabled(isRemoveAllEnabled((IAdaptable)input));
- }
-
- return true;
- }
-
- /**
- * Deletes all the pages in the view.
- * @return <code>true</code> if all pages have been deleted, <code>false</code> otherwise.
- */
- public boolean deleteAllPages() {
-
- // first show a dummy control in page book
- // this must be done before viewers are cleared
- // reason is that current showing control in page book can not be disposed
- // SWT doesn't seem to like it
- // This is fixed in 3.0
- pageBook.showPage(createDummyControl());
-
- // clear viewers
- clearViewers();
-
- // current viewer is null again
- currentViewer = null;
-
- // clear the viewer list
- viewers.clear();
-
- // disable cancel action
- cancelAction.setEnabled(false);
-
- // disable remove all action
- removeSelectedAction.setEnabled(false);
-
- // disable remove all action
- removeAllAction.setEnabled(false);
-
- // clear the history action list
- historyActions.clear();
-
- // get rid of all menu manager actions
- mMgr.removeAll();
-
- // update action bars
- actionBars.updateActionBars();
-
- // clear the content description
- setContentDescription(""); //$NON-NLS-1$
-
- return true;
- }
-
- /**
- * Creates a dummy control to show in the page book.
- * @return a dummy control.
- */
- private Control createDummyControl() {
- Control control = new Composite(pageBook, SWT.NONE);
- return control;
- }
-
- /**
- * Deletes the current page.
- * @return <code>true</code> if the current page has been deleted, <code>false</code> otherwise.
- */
- public boolean deleteCurrentPage() {
-
- // remove current viewer as selection provider if it exists
- if (currentViewer != null) {
-
- // remove as selection changed listener to current viewer
- currentViewer.removeSelectionChangedListener(this);
-
- if (getSite().getSelectionProvider() == currentViewer) {
- getSite().setSelectionProvider(null);
- }
- }
- else {
- return false;
- }
-
- Object input = currentViewer.getInput();
-
- ISystemViewElementAdapter adapter = getViewAdapter(input);
-
- // universal search
- if (currentViewer instanceof SystemSearchTableView)
- {
-
- SystemSearchTableView tableView = (SystemSearchTableView)currentViewer;
-
- // remove viewer as listener
- tableView.removeAsListener();
-
- // clear model
- if (input instanceof IHostSearchResultSet) {
- IHostSearchResultSet set = (IHostSearchResultSet)input;
- set.dispose();
- }
-
- // now refresh viewer
- // but flush cache of the provider first for an accurate refresh
- SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)(tableView.getContentProvider());
- provider.flushCache();
- tableView.refresh();
- }
- // other search
- else if (currentViewer instanceof TreeViewer){
-
- TreeViewer treeView = (TreeViewer)currentViewer;
-
- if (adapter != null && adapter instanceof ISystemRemoveElementAdapter) {
- ISystemRemoveElementAdapter rmAdapter = (ISystemRemoveElementAdapter)adapter;
- rmAdapter.removeAllChildren(input);
- treeView.refresh();
- }
- }
-
- // get title to use from adapter
- String title = null;
- if (adapter != null)
- title = adapter.getText(input);
-
- // set the title of the view
- setContentDescription(title);
-
- // disable cancel action
- cancelAction.setEnabled(false);
-
- // disable remove selected action
- removeSelectedAction.setEnabled(false);
-
- // disable remove all action
- removeAllAction.setEnabled(false);
-
- return true;
- }
-
- /**
- * Get the adapter for the given object.
- * @param element the object the object for which I want the adapter.
- * @return the adapter for the object.
- */
- public ISystemViewElementAdapter getViewAdapter(Object element) {
- return SystemAdapterHelpers.getViewAdapter(element);
- }
-
- /**
- * Get the shell.
- * @return the shell
- */
- public Shell getShell() {
- return getSite().getShell();
- }
-
- public void systemResourceChanged(ISystemResourceChangeEvent event) {
-
- // need to introduce another event type for this....
- if (event.getType() == ISystemResourceChangeEvents.EVENT_SEARCH_FINISHED) {
-
- // the view is added as a system listener when the part is created
- // so the current viewer may not exist if the search results has not been added yet
- if (currentViewer == null) {
- return;
- }
-
- Object actualSource = event.getSource();
-
- if (actualSource instanceof IHostSearchResultConfiguration) {
-
- IHostSearchResultSet source = ((IHostSearchResultConfiguration)actualSource).getParentResultSet();
-
- // get title to use from adapter
- ISystemViewElementAdapter adapter = getViewAdapter(source);
-
- if (adapter == null) {
- return;
- }
-
- int index = -1;
-
- // if the source is the input to the current viewer
- // update view title and cancel action
- // also update the history action corresponding to the current view
- if (currentViewer.getInput() == source) {
-
- // end of a search
- String title = adapter.getText(source);
-
- // set the title of the view
- setContentDescription(title);
-
- // enable/disable state for this input
- if (cancelAction != null) {
- cancelAction.updateEnableState((IAdaptable)source);
- }
-
- // enable/disable state for this input
- if (removeSelectedAction != null) {
- removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
- }
-
- // enable/disable state for this input
- if (removeAllAction != null) {
- removeAllAction.setEnabled(isRemoveAllEnabled((IAdaptable)source));
- }
-
- // find out where the current viewer is in the viewer list
- index = viewers.indexOf(currentViewer);
- }
- // if the source is not the input to the current view
- // we simply update the history action
- else {
-
- for (int i = 0; i < viewers.size(); i++) {
-
- SystemSearchTableView view = (SystemSearchTableView)viewers.get(i);
-
- if (view.getInput() == source) {
- index = i;
- break;
- }
- }
- }
-
- // since the history actions list paralles the viewer list, use the index to
- // get the history action
- if (index >= 0) {
- SystemSearchHistoryAction historyAction = (SystemSearchHistoryAction)historyActions.get(index);
- historyAction.setText(adapter.getText(source));
- }
- }
- }
- }
-
- //------------------------------------------------------
- // Methods used by the tree view pop-up menu
- //------------------------------------------------------
- /**
- * Fill context for the tree view pop-up menu.
- * @param menu the menu manager.
- */
- public void fillContextMenu(IMenuManager menu)
- {
- IStructuredSelection selection = (IStructuredSelection)currentViewer.getSelection();
-
- if (selection == null) {
- return;
- }
-
- int selectionCount = selection.size();
-
- if (selectionCount == 0) { // nothing selected
- return;
- }
- else {
-
- // if only one selection, check if selection is the input
- // if so add no actions
- if (selectionCount == 1) {
-
- if (selection.getFirstElement() == currentViewer.getInput()) {
- return;
- }
- }
-
- // if selection count is more than 1
- // check if all have same parent
- // if not, check if they have ancestor relationship
- // if so, add no actions
-// if (selectionCount > 1) {
-// boolean allSelectionsFromSameParent = sameParent();
-//
-// // if all selections do not have the same parent, do not show anything in the menu
-// if (!allSelectionsFromSameParent) {
-//
-// if (selectionHasAncestryRelationship()) {
-// // don't show the menu because actions with
-// // multiple select on objects that are ancestors
-// // of each other is problematic
-// // still create the standard groups
-// SystemView.createStandardGroups(menu);
-// return;
-// }
-// }
-// }
-
- // partition into groups...
- SystemView.createStandardGroups(menu);
-
- // adapter actions
- SystemMenuManager ourMenu = new SystemMenuManager(menu);
- Object element = selection.getFirstElement();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- adapter.setViewer(currentViewer);
- adapter.addActions(ourMenu, selection,
- getShell(),
- ISystemContextMenuConstants.GROUP_ADAPTERS);
- }
- }
-
- /**
- * This is called to ensure all elements in a multiple-selection have the same parent in the
- * tree viewer. If they don't we automatically disable all actions.
- * <p>
- * Designed to be as fast as possible by going directly to the SWT widgets
- */
- public boolean sameParent()
- {
- boolean same = true;
-
- Tree tree = null;
-
- if (currentViewer instanceof AbstractTreeViewer) {
- tree = (Tree)(currentViewer.getControl());
- }
- else {
- return false;
- }
-
- TreeItem[] items = tree.getSelection();
-
- if ((items == null) || (items.length == 0))
- return true;
-
- TreeItem prevParent = null;
- TreeItem currParent = null;
-
- for (int idx=0; same && (idx<items.length); idx++)
- {
- currParent = items[idx].getParentItem();
-
- if ((idx>0) && (currParent != prevParent))
- {
- same = false;
- }
- else
- {
- prevParent = currParent;
- }
- }
-
- return same;
- }
-
- /**
- * Called when the context menu is about to open.
- * Calls {@link #fillContextMenu(IMenuManager)}
- */
- public void menuAboutToShow(IMenuManager menu)
- {
- fillContextMenu(menu);
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- currentViewer.addSelectionChangedListener(listener);
- }
-
- /**
- * Returns the current selection for this provider.
- *
- * @return the current selection
- */
- public ISelection getSelection()
- {
- if (currentViewer == null) {
- return null;
- }
- else {
- return currentViewer.getSelection();
- }
- }
- /**
- * Removes the given selection change listener from this selection provider.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a selection changed listener
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- currentViewer.removeSelectionChangedListener(listener);
- }
- /**
- * Sets the current selection for this selection provider.
- *
- * @param selection the new selection
- */
- public void setSelection(ISelection selection)
- {
- currentViewer.setSelection(selection);
- }
- /**
- * Set the title of this view part
- * @param title
- */
- public void setViewPartTitle(String title)
- {
- setContentDescription(title);
- }
-
- /**
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
-
- if (event.getSelectionProvider() == currentViewer) {
- removeSelectedAction.setEnabled(isRemoveSelectedEnabled());
- }
- else {
- removeSelectedAction.setEnabled(false);
- }
-
- IStructuredSelection sel = (IStructuredSelection)(event.getSelection());
-
- Iterator iter = sel.iterator();
-
- // set viewer for adapters of the selected elements
- while (iter.hasNext()) {
- ISystemViewElementAdapter adapter = getViewAdapter(iter.next());
- adapter.setViewer(currentViewer);
- }
-
- copyAction.setEnabled(copyAction.updateSelection(sel));
- pasteAction.setEnabled(pasteAction.updateSelection(sel));
- }
-
- /**
- * Gets the current viewer, i.e. the viewer whose control is being currently displayed in the view.
- * @return the current viewer, or <code>null</code> if there is no current viewer.
- */
- public StructuredViewer getCurrentViewer() {
- return currentViewer;
- }
-
- public Viewer getRSEViewer()
- {
- return currentViewer;
- }
-
-// -------------------------------
- // ISystemMessageLine interface...
- // -------------------------------
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- _errorMessage = null;
- sysErrorMessage = null;
- if (_statusLine != null)
- _statusLine.setErrorMessage(_errorMessage);
- }
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- _message = null;
- if (_statusLine != null)
- _statusLine.setMessage(_message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage()
- {
- return _errorMessage;
- }
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage()
- {
- return _message;
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- this._errorMessage = message;
- if (_statusLine != null)
- _statusLine.setErrorMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- return sysErrorMessage;
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- sysErrorMessage = message;
- setErrorMessage(message.getLevelOneText());
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(Throwable exc)
- {
- setErrorMessage(exc.getMessage());
- }
-
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- this._message = message;
- if (_statusLine != null)
- _statusLine.setMessage(message);
- }
- /**
- *If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- setMessage(message.getLevelOneText());
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemResourceAdaptableProfile.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemResourceAdaptableProfile.java
deleted file mode 100644
index 02629c149..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemResourceAdaptableProfile.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.rse.core.model.ISystemProfile;
-
-/**
- * This class wrappers a SystemProfile and adapts it to an IResource
- * by mapping to its underlying folder.
- */
-public class SystemResourceAdaptableProfile
-{
- /**
- * Constructor
- */
- public SystemResourceAdaptableProfile(ISystemProfile profile)
- {
- super();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamView.java
deleted file mode 100644
index c6cdae4eb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamView.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-
-//import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-
-/**
- * We specialize tree viewer for the Team view, so we know
- * when we are dealing with the team view in common code.
- */
-public class SystemTeamView extends TreeViewer
- implements ISystemSelectAllTarget, ISystemResourceChangeListener,
- ISystemShellProvider
-{
- private SystemTeamViewPart teamViewPart;
-
- /**
- * @param parent
- */
- public SystemTeamView(Composite parent, SystemTeamViewPart teamViewPart)
- {
- super(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); // DKM - putting style here to avoid SWT.BORDER (defect 168972)
- this.teamViewPart = teamViewPart;
- SystemWidgetHelpers.setHelp(getTree(), RSEUIPlugin.HELPPREFIX+"teamview"); //$NON-NLS-1$
- }
-
- /**
- * @param parent
- * @param style
- */
- public SystemTeamView(Composite parent, int style, SystemTeamViewPart teamViewPart)
- {
- super(parent, style);
- this.teamViewPart = teamViewPart;
- SystemWidgetHelpers.setHelp(getTree(), RSEUIPlugin.HELPPREFIX+"teamview"); //$NON-NLS-1$
- }
-
- /**
- * @param tree
- */
- public SystemTeamView(Tree tree, SystemTeamViewPart teamViewPart)
- {
- super(tree);
- this.teamViewPart = teamViewPart;
- SystemWidgetHelpers.setHelp(getTree(), RSEUIPlugin.HELPPREFIX+"teamview"); //$NON-NLS-1$
- }
-
- /**
- * Return the part view part of this tree view
- */
- public SystemTeamViewPart getTeamViewPart()
- {
- return teamViewPart;
- }
-
- /**
- * This returns an array containing each element in the tree, up to but not including the root.
- * The array is in reverse order, starting at the leaf and going up.
- */
- public Object[] getElementNodes(Object element)
- {
- Widget w = findItem(element);
- if ((w != null) && (w instanceof TreeItem))
- return getElementNodes((TreeItem)w);
- return null;
- }
- /**
- * This returns an array containing each element in the tree, up to but not including the root.
- * The array is in reverse order, starting at the leaf and going up.
- * This flavour is optimized for the case when you have the tree item directly.
- */
- public Object[] getElementNodes(TreeItem item)
- {
- Vector v = new Vector();
- v.addElement(item.getData());
- while (item != null)
- {
- item = item.getParentItem();
- if (item != null)
- v.addElement(item.getData());
- }
- Object[] nodes = new Object[v.size()];
- for (int idx=0; idx<nodes.length; idx++)
- nodes[idx] = v.elementAt(idx);
- return nodes;
- }
-
- /**
- * Use findItem to find a tree item given its data object, or null if given object not in tree.
- */
- public TreeItem findTreeItem(Object dataObject)
- {
- Widget widget = findItem(dataObject);
- if (widget instanceof TreeItem)
- return (TreeItem)widget;
- else
- return null;
- }
- /**
- * Given a tree item, search the immediate children for an item representing the given object.
- */
- public TreeItem findChildTreeItem(TreeItem parentItem, Object dataObject)
- {
- TreeItem[] childItems = parentItem.getItems();
- TreeItem childItem = null;
- for (int idx=0; (childItem==null) && (idx<childItems.length); idx++)
- {
- if ((childItems[idx].getData() != null) && childItems[idx].getData().equals(dataObject))
- childItem = childItems[idx];
- }
- return childItem;
- }
-
- /**
- * Called when a property is updated and we need to inform the Property Sheet viewer.
- * There is no formal mechanism for this so we simulate a selection changed event as
- * this is the only event the property sheet listens for.
- */
- public void updatePropertySheet()
- {
- ISelection selection = getSelection();
- if (selection == null)
- return;
- // create an event
- SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
- // fire the event
- fireSelectionChanged(event);
- }
-
- // ----------------------------------------
- // ISystemResourceChangeListener methods...
- // ----------------------------------------
-
- /**
- * Called when something changes in the model
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
- int type = event.getType();
- switch(type)
- {
- case ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL:
- collapseToLevel(getInput(), AbstractTreeViewer.ALL_LEVELS);
- break;
- }
- }
-
- /**
- * Return the shell
- */
- public Shell getShell()
- {
- return super.getControl().getShell();
- }
-
- // -----------------------------------------------------------------
- // ISystemSelectAllTarget methods to facilitate the global action...
- // -----------------------------------------------------------------
- /**
- * Return true if select all should be enabled for the given object.
- * For a tree view, you should return true if and only if the selected object has children.
- * You can use the passed in selection or ignore it and query your own selection.
- */
- public boolean enableSelectAll(IStructuredSelection selection)
- {
- Tree tree = getTree();
- TreeItem[] items = tree.getSelection();
- if ((items==null) || (items.length!=1)) // only allow for single selections
- return false;
-
- TreeItem ti = items[0];
- int count = getItemCount(ti);
- if (count == 1) // is it a dummy?
- {
- if ((getItems(ti)[0]).getData() == null)
- count = 0; // assume a dummy
- }
- return (count > 0);
- }
- /**
- * When this action is run via Edit->Select All or via Ctrl+A, perform the
- * select all action. For a tree view, this should select all the children
- * of the given selected object. You can use the passed in selected object
- * or ignore it and query the selected object yourself.
- */
- public void doSelectAll(IStructuredSelection selection)
- {
- Tree tree = getTree();
- TreeItem[] currSel = tree.getSelection();
- TreeItem[] childItems = currSel[0].getItems();
- if (childItems.length == 0)
- return;
- tree.setSelection(childItems);
- Object[] childObjects = new Object[childItems.length];
- for (int idx=0; idx<childObjects.length; idx++)
- childObjects[idx] = childItems[idx].getData();
- fireSelectionChanged(
- new SelectionChangedEvent(this,
- new StructuredSelection(childObjects)));
- }
-
- /**
- * Handles a collapse-selected request
- */
- public void collapseSelected()
- {
- TreeItem[] selectedItems = ((Tree)getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length>0))
- {
- for (int idx=0; idx<selectedItems.length; idx++)
- selectedItems[idx].setExpanded(false);
- }
- }
- /**
- * Handles an expand-selected request
- */
- public void expandSelected()
- {
- TreeItem[] selectedItems = ((Tree)getControl()).getSelection();
- if ((selectedItems != null) && (selectedItems.length>0))
- {
- for (int idx=0; idx<selectedItems.length; idx++)
- {
- if (!selectedItems[idx].getExpanded())
- {
- createChildren(selectedItems[idx]);
- }
- selectedItems[idx].setExpanded(true);
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryAdapter.java
deleted file mode 100644
index bf79f15a1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryAdapter.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [197036] rewrote getSubSystemConfigurationNodes to get filter pools
- * in a way that delays the loading of subsystem configurations
- * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
- * Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.core.model.IPropertySetContainer;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Adapter for displaying and processing SystemTeamViewCategoryNode objects in tree views, such as
- * the Team view.
- */
-public class SystemTeamViewCategoryAdapter
- extends AbstractSystemViewAdapter {
-
- private boolean actionsCreated = false;
- //private Hashtable categoriesByProfile = new Hashtable();
-
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given element.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- if (!actionsCreated)
- createActions();
- //menu.add(menuGroup, copyAction);
- }
- private void createActions()
- {
- actionsCreated = true;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return category.getImageDescriptor();
- }
-
- /**
- * Return the label for this object
- */
- public String getText(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return category.getLabel();
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return category.getLabel();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return category.getProfile() + "." + category.getLabel(); //$NON-NLS-1$
- }
-
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- return SystemViewResources.RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE;
- }
-
- /**
- * Return the string to display in the status line when the given object is selected.
- * We return:
- */
- public String getStatusLineText(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return SystemResources.RESID_TEAMVIEW_CATEGORY_VALUE + ": " + category.getLabel() + " - " + category.getDescription(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Return the parent of this object. We return the RemoteSystemsConnections project
- */
- public Object getParent(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return category.getProfile();
- }
-
- /**
- * Return the children of this profile.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- ISystemProfile profile = category.getProfile();
- String categoryType = category.getMementoHandle();
- if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_CONNECTIONS))
- {
- return profile.getHosts();
- }
- else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_PROPERTYSETS))
- {
- return createSystemTeamViewPropertySetNodes(profile, category);
- }
- else
- return createSubSystemConfigurationNodes(profile, category);
- }
-
-
- /**
- * Create subsystem configuration child nodes for expanded category node.
- */
- private SystemTeamViewSubSystemConfigurationNode[] createSubSystemConfigurationNodes(ISystemProfile profile, SystemTeamViewCategoryNode category) {
- // create a sorted set to hold the subsystem configurations based on the proxy ordering
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- final List proxies = Arrays.asList(sr.getSubSystemConfigurationProxies());
- Comparator comparator = new Comparator() {
- public int compare(Object o1, Object o2) {
- ISubSystemConfiguration c1 = (SubSystemConfiguration) o1;
- ISubSystemConfiguration c2 = (SubSystemConfiguration) o2;
- ISubSystemConfigurationProxy proxy1 = c1.getSubSystemConfigurationProxy();
- ISubSystemConfigurationProxy proxy2 = c2.getSubSystemConfigurationProxy();
- Integer p1 = new Integer(proxies.indexOf(proxy1));
- Integer p2 = new Integer(proxies.indexOf(proxy2));
- int result = p1.compareTo(p2);
- return result;
- }
- };
- SortedSet activeSubsystemConfigurations = new TreeSet(comparator);
- // find the active subsystem configurations
- for (Iterator z = proxies.iterator(); z.hasNext();) {
- ISubSystemConfigurationProxy proxy = (ISubSystemConfigurationProxy) z.next();
- if (proxy.isSubSystemConfigurationActive()) {
- ISubSystemConfiguration config = proxy.getSubSystemConfiguration();
- activeSubsystemConfigurations.add(config);
- }
- }
- // construct the nodes for the view based on these configurations
- List nodes = new ArrayList();
- String categoryType = category.getMementoHandle();
- for (Iterator z = activeSubsystemConfigurations.iterator(); z.hasNext();) {
- ISubSystemConfiguration ssf = (ISubSystemConfiguration) z.next();
- boolean createNode = false;
- if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS)) {
- createNode = ssf.supportsFilters() && (profile.getFilterPools(ssf).length > 0);
- } else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_TARGETS)) {
- createNode = ssf.supportsTargets(); // && profile.getTargets(ssf).length > 0;
- }
- if (createNode) {
- nodes.add(new SystemTeamViewSubSystemConfigurationNode(profile, category, ssf));
- }
- }
- SystemTeamViewSubSystemConfigurationNode[] result = new SystemTeamViewSubSystemConfigurationNode[nodes.size()];
- nodes.toArray(result);
- return result;
- }
-
- /**
- * Create subsystem configuration child nodes for expanded category node.
- */
- private SystemTeamViewPropertySetNode[] createSystemTeamViewPropertySetNodes(IPropertySetContainer profile, SystemTeamViewCategoryNode category) {
-
- IPropertySet[] propertySets = profile.getPropertySets();
- if (null == propertySets || propertySets.length == 0)
- {
- return new SystemTeamViewPropertySetNode[0];
- }
- // construct the nodes for the view based on these configurations
- List nodes = new ArrayList();
- //String categoryType = category.getMementoHandle();
- for (int i = 0; i < propertySets.length; i++) {
- nodes.add(new SystemTeamViewPropertySetNode(profile, propertySets[i]));
- }
- SystemTeamViewPropertySetNode[] result = new SystemTeamViewPropertySetNode[nodes.size()];
- nodes.toArray(result);
- return result;
- }
-
- /**
- * Return true if this profile has children. We return true.
- */
- public boolean hasChildren(IAdaptable element)
- {
- return true;
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
- /**
- * Return our unique property descriptors, which getPropertyDescriptors adds to the common properties.
- */
- protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- /*
- propertyDescriptorArray = new PropertyDescriptor[1];
- RSEUIPlugin plugin = RSEUIPlugin.getDefault();
- int idx = 0;
- // status
- propertyDescriptorArray[idx] = new PropertyDescriptor(ISystemPropertyConstants.P_IS_ACTIVE,
- SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL);
- propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_PROFILESTATUS_DESCRIPTION));
- ++idx;
- */
- }
- return propertyDescriptorArray;
- }
-
- /**
- * Returns the current value for the named property.
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param key - the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- public Object internalGetPropertyValue(Object key)
- {
- /*
- if (name.equals(P_IS_ACTIVE))
- {
- boolean active = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName());
- if (active)
- return SystemViewResources.RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL);
- else
- return SystemViewResources.RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL);
- }
- else
- */
- return null;
- }
-
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- */
- public String getMementoHandle(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return category.getMementoHandle();
- }
- /**
- * Return a short string to uniquely identify the type of resource.
- */
- public String getMementoHandleKey(Object element)
- {
- SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
- return category.getProfile().getName() + "." + category.getLabel(); //$NON-NLS-1$
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryNode.java
deleted file mode 100644
index 4448293d7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewCategoryNode.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- * Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.model.ISystemProfile;
-
-
-/**
- * This class represents a child node under a profile, in the Team view.
- * It represents expandable categories such as "Connections", "Filter Pools",
- * "User Actions" and "Compile Commands".
- */
-public class SystemTeamViewCategoryNode implements IAdaptable
-{
- private String label, mementoHandle, description;
- private ImageDescriptor imageDescriptor;
- private ISystemProfile profile;
- public static final String MEMENTO_CONNECTIONS = "conns"; //$NON-NLS-1$
- public static final String MEMENTO_FILTERPOOLS = "pools"; //$NON-NLS-1$
- public static final String MEMENTO_USERACTIONS = "actions"; //$NON-NLS-1$
- public static final String MEMENTO_COMPILECMDS = "cmds"; //$NON-NLS-1$
- public static final String MEMENTO_PROPERTYSETS = "propertysets"; //$NON-NLS-1$
- public static final String MEMENTO_TARGETS = "targets"; //$NON-NLS-1$
-
- /**
- * Constructor
- */
- public SystemTeamViewCategoryNode(ISystemProfile profile)
- {
- super();
- this.profile = profile;
- }
-
- /**
- * This is the method required by the IAdaptable interface.
- * Given an adapter class type, return an object castable to the type, or
- * null if this is not possible.
- */
- public Object getAdapter(Class adapterType)
- {
- return Platform.getAdapterManager().getAdapter(this, adapterType);
- }
-
- /**
- * Return this node's image
- * @return the image to show in the tree, for this node
- */
- public ImageDescriptor getImageDescriptor()
- {
- return imageDescriptor;
- }
-
- /**
- * Return this node's label
- * @return the translated label to show in the tree, for this node
- */
- public String getLabel()
- {
- return label;
- }
-
- /**
- * Set the image for this node
- * @param descriptor ... the image to show in the tree, for this node
- */
- public void setImageDescriptor(ImageDescriptor descriptor)
- {
- imageDescriptor = descriptor;
- }
-
- /**
- * Set the label for this node
- * @param string ... the label to show in the tree, for this node
- */
- public void setLabel(String string)
- {
- label = string;
- }
- /**
- * Convert to string. We call getLabel()
- */
- public String toString()
- {
- return getLabel();
- }
-
- /**
- * @return profile this category is associated with
- */
- public ISystemProfile getProfile()
- {
- return profile;
- }
-
- /**
- * @param profile ... the profile this category is associated with
- */
- public void setProfile(ISystemProfile profile)
- {
- this.profile = profile;
- }
-
- /**
- * @return the untranslated value to store in the memento, to uniquely identify this node
- */
- public String getMementoHandle()
- {
- return mementoHandle;
- }
-
- /**
- * Set the untranslated value to store in the memento, to uniquely identify this node
- * @param string - untranslated value
- */
- public void setMementoHandle(String string)
- {
- mementoHandle = string;
- }
-
- /**
- * Return the description of this node. Shown on status line.
- */
- public String getDescription()
- {
- return description;
- }
-
- /**
- * Set the description of this node. Shown on status line.
- */
- public void setDescription(String string)
- {
- description = string;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewContentProvider.java
deleted file mode 100644
index b220e3d4a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewContentProvider.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- * David Dykstal (IBM) - [189858] Removed the remote systems project in the team view
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-
-/**
- * Content provider for the RSE's Team view part.
- */
-public class SystemTeamViewContentProvider extends WorkbenchContentProvider
-{
- private SystemTeamViewInputProvider inputProvider = null;
- private Viewer viewer;
- /**
- * Constructor
- */
- public SystemTeamViewContentProvider()
- {
- }
-
- /**
- * Return the children of the given node, when it is expanded
- */
- public Object[] getChildren(Object element)
- {
- Object[] children;
- // for the project root node, return the SystemProfile objects
- if (element instanceof IProject)
- {
- //IProject rseProject = (IProject)element;
- ISystemProfile[] profiles = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfiles();
- children = profiles;
- //return profiles;
- }
- else
- {
- ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
- if (adapter != null)
- children = adapter.getChildren((IAdaptable)element, new NullProgressMonitor());
- else
- children = super.getChildren(element);
- }
- /*
- String name = element.getClass().getName();
- if (element instanceof SystemTeamViewSubSystemConfigurationNode)
- {
- SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode)element;
- name = ssfNode.getParentCategory().getLabel() + "." + ssfNode.getSubSystemConfiguration().getName();
- }
- else if (element instanceof SystemTeamViewCategoryNode)
- {
- SystemTeamViewCategoryNode catNode = (SystemTeamViewCategoryNode)element;
- name = catNode.getLabel();
- }
- System.out.println(" "+Integer.toString(counter-1)+". In getChildren for object '"+name +"', returned "+((children==null)?"null":Integer.toString(children.length)));
- */
- return children;
- }
-
- /**
- * Return the parent of the given node
- */
- public Object getParent(Object element)
- {
- if (element instanceof ISystemProfile)
-// return SystemResourceManager.getRemoteSystemsProject();
- return null;
- ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
- if (adapter != null)
- return adapter.getParent(element);
- return super.getParent(element);
- }
-
- /**
- * Return true if given element has children.
- */
- public boolean hasChildren(Object element)
- {
- if (element instanceof IContextObject)
- {
- element = ((IContextObject)element).getModelObject();
- }
- boolean children = false;
- if (element instanceof IProject)
- children = (getChildren(element).length > 0);
- else
- {
- ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
- if (adapter != null)
- children = adapter.hasChildren((IAdaptable)element);
- else
- children = super.hasChildren(element);
- }
- /* debug info
- String name = element.getClass().getName();
- if (element instanceof SystemTeamViewSubSystemConfigurationNode)
- {
- SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode)element;
- name = ssfNode.getParentCategory().getLabel() + "." + ssfNode.getSubSystemConfiguration().getName();
- }
- else if (element instanceof SystemTeamViewCategoryNode)
- {
- SystemTeamViewCategoryNode catNode = (SystemTeamViewCategoryNode)element;
- name = catNode.getLabel();
- }
- System.out.println(Integer.toString(counter++)+". In hasChildren for object: '"+name+"', returned "+children);
- */
- return children;
- }
-
- /**
- * Return the roots elements to display in the tree initially.
- * For us, this is the RSE singleton project.
- */
- public Object[] getElements(Object element)
- {
- if (inputProvider == null)
- return new Object[0];
- else
- return inputProvider.getRoots(); // returns our single RSE project
- }
-
- /**
- * View is going away: dispose of any local resources
- */
- public void dispose()
- {
- super.dispose();
- // we need to remove this provider from the Workspace
- // ResourceChange listeners list. The parent dispose will
- // not do this for us.
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
- }
-
- /**
- * This hooks this content provider as an IResourceChangeListener.<br>
- * We will not use parent code.
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- this.viewer = viewer;
-
- // TODO DKM - replace this with appropriate thing
- // super.viewer = viewer;
-
- // TODO DKM - get rid of inputChanged. I put it here temporarily so that there's a way to set super.viewer in 3.0
- super.inputChanged(viewer, oldInput, newInput);
-
- //System.out.println("inside inputChanged. oldInput = " + oldInput + ", newInput = " + newInput);
- if (newInput != null)
- {
- if (newInput instanceof SystemTeamViewInputProvider)
- {
- inputProvider = (SystemTeamViewInputProvider)newInput;
- /*
- getResourceDeltaHandler().registerTreeViewer((TreeViewer)viewer);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(this,
- //IResourceChangeEvent.POST_AUTO_BUILD
- //IResourceChangeEvent.PRE_AUTO_BUILD
- IResourceChangeEvent.POST_CHANGE
- // IResourceChangeEvent.PRE_CLOSE
- //| IResourceChangeEvent.PRE_DELETE
- //| IResourceChangeEvent.POST_AUTO_BUILD
- );
- */
- }
- }
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getSystemViewAdapter(Object o)
- {
- ISystemViewElementAdapter adapter = null;
- if (o == null)
- {
- SystemBasePlugin.logWarning("ERROR: null passed to getAdapter in SystemTeamViewContentProvider"); //$NON-NLS-1$
- return null;
- }
- if (!(o instanceof IAdaptable))
- adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class);
- else
- adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
- //if (adapter == null)
- // RSEUIPlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName());
- if ((adapter!=null) && (viewer != null))
- {
- Shell shell = null;
- if (viewer instanceof ISystemShellProvider)
- shell = ((ISystemShellProvider)viewer).getShell();
- else if (viewer != null)
- shell = viewer.getControl().getShell();
- if (shell != null)
- adapter.setShell(shell);
- adapter.setViewer(viewer);
- if (viewer.getInput() instanceof ISystemViewInputProvider)
- {
- ISystemViewInputProvider inputProvider = (ISystemViewInputProvider)viewer.getInput();
- adapter.setInput(inputProvider);
- }
- }
- else if (viewer == null)
- SystemBasePlugin.logWarning("VIEWER IS NULL FOR SystemTeamViewContentProvider"); //$NON-NLS-1$
- return adapter;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewInputProvider.java
deleted file mode 100644
index c4c7a0eb8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewInputProvider.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * David Dykstal (IBM) - [189858] Removed the remote systems project in the team view
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Martin Oberhuber (Wind River) - [218524][api] Remove deprecated ISystemViewInputProvider#getShell()
- * Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.internal.core.model.SystemProfileManager;
-
-
-/**
- * Represents the input to the team viewer.
- * For now, this really doesn't do much since we always list the same thing.
- */
-public class SystemTeamViewInputProvider implements IAdaptable, ISystemViewInputProvider
-{
- private Viewer viewer;
-
- /**
- * Constructor for SystemTeamViewInputProvider.
- */
- public SystemTeamViewInputProvider()
- {
- super();
- }
-
- /**
- * Return the roots to display in the team viewer.
- * This is simply the RSE singleton project
- */
- public Object[] getRoots()
- {
- ISystemProfile[] roots = SystemProfileManager.getDefault().getSystemProfiles();
- return roots;
- }
-
- /**
- * This is the method required by the IAdaptable interface.
- * Given an adapter class type, return an object castable to the type, or
- * null if this is not possible.
- */
- public Object getAdapter(Class adapterType)
- {
- return Platform.getAdapterManager().getAdapter(this, adapterType);
- }
-
- // ----------------------------------------
- // Methods from ISystemViewInputProvider...
- // ----------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getSystemViewRoots()
- */
- public Object[] getSystemViewRoots()
- {
- return getRoots();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#hasSystemViewRoots()
- */
- public boolean hasSystemViewRoots()
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#showingConnections()
- */
- public boolean showingConnections()
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getConnectionChildren(org.eclipse.rse.ui.model.IHost)
- */
- public Object[] getConnectionChildren(IHost selectedConnection)
- {
- IPropertySet[] propertySets = selectedConnection.getPropertySets();
- if (null == propertySets || propertySets.length == 0)
- {
- return new SystemTeamViewPropertySetNode[0];
- }
- List nodes = new ArrayList();
- for (int i = 0; i < propertySets.length; i++) {
- nodes.add(new SystemTeamViewPropertySetNode(selectedConnection, propertySets[i]));
- }
- SystemTeamViewPropertySetNode[] result = new SystemTeamViewPropertySetNode[nodes.size()];
- nodes.toArray(result);
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#hasConnectionChildren(org.eclipse.rse.ui.model.IHost)
- */
- public boolean hasConnectionChildren(IHost selectedConnection)
- {
- IPropertySet[] sets = selectedConnection.getPropertySets();
- if (sets == null || sets.length == 0){
- return false;
- }
- else {
- return true;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(org.eclipse.jface.viewers.Viewer)
- */
- public void setViewer(Object viewer)
- {
- this.viewer = (Viewer)viewer;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getViewer()
- */
- public Object getViewer()
- {
- return viewer;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewLabelProvider.java
deleted file mode 100644
index 1659eeccc..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewLabelProvider.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-
-/**
- * Base label provider for System Team View part
- */
-public class SystemTeamViewLabelProvider extends LabelProvider
-{
-
- public static final String Copyright =
- "(C) Copyright IBM Corp. 2002, 2003. All Rights Reserved."; //$NON-NLS-1$
-
- // Used to grab Workbench standard icons.
- private WorkbenchLabelProvider aWorkbenchLabelProvider = new WorkbenchLabelProvider();
- private Viewer viewer;
- /**
- * The cache of images that have been dispensed by this provider.
- * Maps ImageDescriptor->Image.
- */
- private Map imageTable = new Hashtable(40);
-
- /**
- * Constructor
- */
- public SystemTeamViewLabelProvider(Viewer viewer)
- {
- super();
- this.viewer = viewer;
- }
- /**
- * Get the image to display
- */
- public Image getImage(Object element)
- {
- Image image = null;
-
- if (element instanceof ISystemProfile)
- {
- ISystemProfile profile = (ISystemProfile)element;
- if (RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName()))
- return RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE_ID);
- else
- return RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
- }
-
- // If we have a project, return the resource project images.
- else if (element instanceof IProject)
- {
- Image projectImage = aWorkbenchLabelProvider.getImage(element);
- return projectImage;
- }
-
- // User system view element adapter
- ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
- if (adapter != null)
- {
- //return adapter.getImage(element);
- ImageDescriptor descriptor = adapter.getImageDescriptor(element);
- if (descriptor != null)
- {
- return getImageFromImageDescriptor(descriptor);
- }
- }
-
- // use Workbench stuff.
- image = aWorkbenchLabelProvider.getImage(element);
- if (image != null)
- {
- return image;
- }
-
- // all failed, use parent code.
- return super.getImage(element);
- }
- /**
- * Turn image descriptor into image
- */
- private Image getImageFromImageDescriptor(ImageDescriptor descriptor)
- {
- if (descriptor == null)
- return null;
- Image image = (Image) imageTable.get(descriptor);
- if (image == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- return image;
-
- }
-
- /**
- * Get the label to display
- */
- public String getText(Object element)
- {
- ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
- if (adapter != null)
- return adapter.getText(element);
-
- // If we have a project, return the resource project images.
- if (element instanceof IProject)
- {
- return ((IProject)element).getName();
- }
- // use Workbench stuff.
- String text = aWorkbenchLabelProvider.getText(element);
- if (text.length() > 0)
- return text;
-
- // all failed, use parent code.
- return super.getText(element);
- }
-
- /**
- * Dispose of images created here.<br>
- */
- public void dispose()
- {
- // The following we got from WorkbenchLabelProvider
- if (imageTable != null)
- {
- Collection imageValues = imageTable.values();
- if (imageValues!=null)
- {
- Iterator images = imageValues.iterator();
- if (images!=null)
- while (images.hasNext())
- ((Image)images.next()).dispose();
- imageTable = null;
- }
- }
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getSystemViewAdapter(Object o)
- {
- ISystemViewElementAdapter adapter = null;
- if (o == null)
- {
- SystemBasePlugin.logWarning("ERROR: null passed to getAdapter in SystemTeamViewLabelProvider"); //$NON-NLS-1$
- return null;
- }
- if (!(o instanceof IAdaptable))
- adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class);
- else
- adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
- //if (adapter == null)
- // RSEUIPlugin.logWarning("ADAPTER IS NULL FOR ELEMENT OF TYPE: " + o.getClass().getName());
- if ((adapter!=null) && (viewer != null))
- {
- Shell shell = null;
- if (viewer instanceof ISystemShellProvider)
- shell = ((ISystemShellProvider)viewer).getShell();
- else if (viewer != null)
- shell = viewer.getControl().getShell();
- if (shell != null)
- adapter.setShell(shell);
- adapter.setViewer(viewer);
- if (viewer.getInput() instanceof ISystemViewInputProvider)
- {
- ISystemViewInputProvider inputProvider = (ISystemViewInputProvider)viewer.getInput();
- adapter.setInput(inputProvider);
- }
- }
- else if (viewer == null)
- SystemBasePlugin.logWarning("VIEWER IS NULL FOR SystemTeamViewLabelProvider"); //$NON-NLS-1$
- return adapter;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeActiveProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeActiveProfileAction.java
deleted file mode 100644
index bfc311051..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeActiveProfileAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [202630] getDefaultPrivateProfile() and ensureDefaultPrivateProfile() are inconsistent
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.core.model.SystemProfileManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The action allows users to activate all selected profiles
- */
-public class SystemTeamViewMakeActiveProfileAction extends SystemBaseAction
-
-{
-
- /**
- * Constructor
- */
- public SystemTeamViewMakeActiveProfileAction(Shell parent) {
- super(SystemResources.ACTION_PROFILE_MAKEACTIVE_LABEL, SystemResources.ACTION_PROFILE_MAKEACTIVE_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptor(
- ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEACTIVE_ID), parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
- setHelp(RSEUIPlugin.HELPPREFIX + "ActionMakeActive"); //$NON-NLS-1$
- }
-
- /**
- * Here we decide whether to enable ths action or not. We enable it
- * if every selected object is a profile, and if its not the case
- * that every selected profile is already active.
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- ISystemProfileManager manager = SystemProfileManager.getDefault();
- ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile();
- boolean enabled = false;
- if (!getSelection().isEmpty()) {
- enabled = true;
- Object currsel = getFirstSelection();
- while (currsel != null && enabled) {
- if (currsel instanceof ISystemProfile) {
- ISystemProfile profile = (ISystemProfile) currsel;
- if (profile.isActive() || profile == defaultProfile) {
- enabled = false;
- }
- } else {
- enabled = false;
- }
- currsel = getNextSelection();
- }
- }
- return enabled;
- }
-
- /**
- * This is the method called when the user selects this action.
- * It walks through all the selected profiles and make them all active
- */
- public void run() {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = (ISystemProfile) getFirstSelection();
- while (profile != null) {
- sr.setSystemProfileActive(profile, true);
- profile = (ISystemProfile) getNextSelection();
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java
deleted file mode 100644
index 6f25c2603..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewMakeInActiveProfileAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [202630] getDefaultPrivateProfile() and ensureDefaultPrivateProfile() are inconsistent
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.core.model.SystemProfileManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The action allows users to de-activate all selected profiles
- */
-public class SystemTeamViewMakeInActiveProfileAction extends SystemBaseAction
-
-{
-
- /**
- * Constructor
- */
- public SystemTeamViewMakeInActiveProfileAction(Shell parent) {
- super(SystemResources.ACTION_PROFILE_MAKEINACTIVE_LABEL, SystemResources.ACTION_PROFILE_MAKEINACTIVE_TOOLTIP, RSEUIPlugin.getDefault().getImageDescriptor(
- ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEINACTIVE_ID), parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
- setHelp(RSEUIPlugin.HELPPREFIX + "ActionMakeInactive"); //$NON-NLS-1$
- }
-
- /**
- * Here we decide whether to enable ths action or not. We enable it
- * if every selected object is a profile, and if its not the case
- * that every selected profile is already inactive.
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- ISystemProfileManager manager = SystemProfileManager.getDefault();
- ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile();
- boolean enabled = false;
- if (!getSelection().isEmpty()) {
- enabled = true;
- Object currsel = getFirstSelection();
- while (currsel != null && enabled) {
- if (currsel instanceof ISystemProfile) {
- ISystemProfile profile = (ISystemProfile) currsel;
- if (!profile.isActive() || profile == defaultProfile) {
- enabled = false;
- }
- } else {
- enabled = false;
- }
- currsel = getNextSelection();
- }
- }
- return enabled;
- }
-
- /**
- * This is the method called when the user selects this action.
- * It walks through all the selected profiles and make them all inactive
- */
- public void run() {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = (ISystemProfile) getFirstSelection();
- while (profile != null) {
- sr.setSystemProfileActive(profile, false);
- profile = (ISystemProfile) getNextSelection();
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPart.java
deleted file mode 100644
index 021778706..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPart.java
+++ /dev/null
@@ -1,1585 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [189858] Removed the remote systems project in the team view
- * David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
- * API to the user actions plugin
- * Rupen Mardirossian (IBM) - [187741] Implemented the handleDoubleClick method
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
- * David Dykstal (IBM) - [202630] getDefaultPrivateProfile() and ensureDefaultPrivateProfile() are inconsistent
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.SameShellProvider;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemResourceManager;
-import org.eclipse.rse.core.events.ISystemModelChangeEvent;
-import org.eclipse.rse.core.events.ISystemModelChangeEvents;
-import org.eclipse.rse.core.events.ISystemModelChangeListener;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemCollapseAllAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonSelectAllAction;
-import org.eclipse.rse.internal.ui.actions.SystemNewProfileAction;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.internal.ui.actions.SystemTeamReloadAction;
-import org.eclipse.rse.internal.ui.view.ISystemMementoConstants;
-import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
-import org.eclipse.rse.internal.ui.view.SystemViewPart;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemDeleteTarget;
-import org.eclipse.rse.ui.ISystemRenameTarget;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.IRSEViewPart;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.eclipse.ui.part.ViewPart;
-import org.osgi.framework.Bundle;
-
-
-/**
- * The viewer and view part for the Team view
- */
-public class SystemTeamViewPart
- extends ViewPart
- implements ISetSelectionTarget, ISelectionProvider, ISystemModelChangeListener,
- ISystemMessageLine, ISelectionChangedListener,
- ISystemDeleteTarget, ISystemRenameTarget, IRSEViewPart
-{
-
- private boolean menuListenerAdded;
- public static final String ID = "org.eclipse.rse.ui.view.teamView"; //$NON-NLS-1$
-
- private SystemTeamViewInputProvider input = null;
- private SystemTeamView treeViewer = null;
- //private FrameList frameList = null;
- private IStatusLineManager statusLine = null;
- private String message, errorMessage;
- private SystemMessage sysErrorMessage;
-
- // selectionChangedListeners
- private ListenerList selectionChangedListeners = new ListenerList(ListenerList.IDENTITY);
-
- // context menu actions for project...
- protected SystemTeamReloadAction reloadRSEAction;
- protected SystemNewProfileAction newProfileAction;
- // common context menu actions...
- protected SystemCommonDeleteAction deleteAction;
- protected PropertyDialogAction propertyDialogAction;
- protected SystemTeamViewRefreshAllAction toolBarRefreshAllAction, menuRefreshAllAction;
- protected SystemCollapseAllAction collapseAllAction;
-
-
- // remember-state variables...
- private IMemento fMemento;
- // state...
- static final String TAG_RELEASE= "release"; //$NON-NLS-1$
- static final String TAG_SELECTION= "selection"; //$NON-NLS-1$
- static final String TAG_EXPANDED_TO= "expandedTo"; //$NON-NLS-1$
- static final String TAG_EXPANDED= "expanded"; //$NON-NLS-1$
- static final String TAG_ELEMENT= "element"; //$NON-NLS-1$
- static final String TAG_PATH= "path"; //$NON-NLS-1$
- static final String TAG_INPUT= "svInput"; //$NON-NLS-1$
- static final String TAG_VERTICAL_POSITION= "verticalPosition"; //$NON-NLS-1$
- static final String TAG_HORIZONTAL_POSITION= "horizontalPosition"; //$NON-NLS-1$
- static final String MEMENTO_DELIM = "///"; //$NON-NLS-1$
-
- /**
- * Remove a selection change listener
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.remove(listener);
- }
- /**
- * Add a selection change listener
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.add(listener);
- }
-
- /**
- * Returns selection for the tree view
- */
- public ISelection getSelection()
- {
- return treeViewer.getSelection();
- }
-
- public void setSelection(ISelection selection)
- {
- treeViewer.setSelection(selection);
- }
-
- /**
- * Returns the tree viewer selection as a structured selection
- */
- public IStructuredSelection getStructuredSelection()
- {
- // we know we have a ss.
- return (IStructuredSelection) (treeViewer.getSelection());
- }
-
- public TreeViewer getTreeViewer() {
- return treeViewer;
- }
-
- public Viewer getRSEViewer()
- {
- return treeViewer;
- }
-
- /**
- * We are getting focus
- */
- public void setFocus()
- {
- if (treeViewer == null)
- return;
- Tree tree = treeViewer.getTree();
- if (tree != null)
- treeViewer.getTree().setFocus();
- }
-
- /**
- * Create the viewer to go in this view part.
- */
- public void createPartControl(Composite parent)
- {
- treeViewer =
- //new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- new SystemTeamView(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, this);
- treeViewer.setUseHashlookup(true);
- treeViewer.setContentProvider(new SystemTeamViewContentProvider());
- treeViewer.setLabelProvider(new SystemTeamViewLabelProvider(treeViewer));
-
- treeViewer.setInput(getInput());
-
- addTreeViewerListeners();
-
- // create the frame list.
- //frameList = createFrameList();
-
- // now update title of the view part.
- updateTitle();
-
- // Handle menus:
- // think about menu manager id later.
- MenuManager menuMgr = new MenuManager();
- menuMgr.setRemoveAllWhenShown(true);
- Menu menu = menuMgr.createContextMenu(treeViewer.getTree());
- treeViewer.getTree().setMenu(menu);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- fillContextMenu(manager);
- addMenuListener(manager);
- }
- });
- getSite().registerContextMenu(menuMgr, treeViewer);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- scrubOtherContributions(manager);
- }
- });
- // important to add our listener after registering, so we are called second!
- // This gives us the opportunity to scrub the contributions added by others, to screen out
- // non-team additions.
- /*
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- SystemTeamViewPart.this.fillContextMenu(manager);
- }
- });*/
-
- // Fill the action bars and update the global action handlers'
- // enabled state to match the current selection. We pass the selection
- // based on the iSeries object model. The action group will handle
- // delegating the correct object model to the actions.
- fillActionBars(getViewSite().getActionBars());
- //updateActionBars(getStructuredSelection());
-
- // this is a must here to get Properties Pages to work.
- getSite().setSelectionProvider(treeViewer);
- //getSite().setSelectionProvider(this);
-
- // Update status line.
- statusLine = getViewSite().getActionBars().getStatusLineManager();
- //updateStatusLine(getStructuredSelection());
-
- // we need to refresh viewer when page gets activated for Marker updates
- //pageListener = new CurrentPageListener(getSite().getPage());
- //getSite().getWorkbenchWindow().addPageListener(pageListener);
-
- // update F1 help
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IF1HelpContextID.NAV01);
-
- RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(this);
-
- treeViewer.setAutoExpandLevel(2); // dang, it doesn't work!
-
- // ----------------------
- // Restore previous state
- // ----------------------
- if (fMemento != null)
- restoreState(fMemento);
- fMemento= null;
- }
-
- private void addMenuListener(IMenuManager menu) {
- if (!menuListenerAdded)
- {
- if (menu instanceof MenuManager)
- {
- Menu m = ((MenuManager)menu).getMenu();
- if (m != null)
- {
- menuListenerAdded = true;
- SystemViewMenuListener ml = new SystemViewMenuListener();
- ml.setShowToolTipText(true, this);
- m.addMenuListener(ml);
- }
- }
- }
- }
-
- // -------------------------------------------
- // MEMENTO SUPPORT (SAVING/RESTORING STATE)...
- // -------------------------------------------
- /**
- * Initializes this view with the given view site. A memento is passed to
- * the view which contains a snapshot of the views state from a previous
- * session. Where possible, the view should try to recreate that state
- * within the part controls.
- * <p>
- * The parent's default implementation will ignore the memento and initialize
- * the view in a fresh state. Subclasses may override the implementation to
- * perform any state restoration as needed.
- */
- public void init(IViewSite site,IMemento memento) throws PartInitException
- {
- super.init(site,memento);
- fMemento = memento;
- //System.out.println("INSIDE INIT");
- }
-
- /**
- * Adds the listeners to the tree viewer.
- */
- protected void addTreeViewerListeners()
- {
- treeViewer.addDoubleClickListener(new IDoubleClickListener()
- {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
-
- //System.out.println("Add key listener");
-
- treeViewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- handleKeyReleased(e);
- } });
- treeViewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- handleKeyPressed(e);
- } });
-
- treeViewer.addSelectionChangedListener(this);
-
- treeViewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- handleOpen(event);
- }
- });
- }
-
-
- /**
- * Returns the shell to use for opening dialogs.
- * Used in this class, and in the actions.
- */
- public Shell getShell()
- {
- return getViewSite().getShell();
- }
-
- /**
- * Handles double-click in viewer. It is responsible for expanding
- * and collapsing nodes in the tree.
- * @param event the double click event to handle.
- * Contains the selection on which to operate.
- */
- private void handleDoubleClick(DoubleClickEvent event) {
- ITreeSelection s = (ITreeSelection) event.getSelection();
- Object element = s.getFirstElement(); // double-click only has 0 or 1 elements
- if (element != null) {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) element).getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null) {
- if (adapter.hasChildren((IAdaptable) element)) {
- // Get the path for the element and use it for setting expanded state,
- // so the proper TreeItem is expanded/collapsed
- TreePath[] paths = s.getPathsFor(element);
- if (paths != null && paths.length > 0 && paths[0] != null) {
- TreePath elementPath = paths[0];
- if (treeViewer.getExpandedState(elementPath)) {
- treeViewer.collapseSelected();
- } else {
- treeViewer.expandSelected();
- }
- }
- } else {
- adapter.handleDoubleClick(element);
- }
- }
- }
- }
-
- /**
- * Handles an open event from the viewer.
- * Opens an editor on the selected file.
- */
- protected void handleOpen(OpenEvent event)
- {
- }
-
- /**
- * Handles key events in viewer.<br>
- * This is needed for various keys (eg: delete key) and for model dump.
- */
- private void handleKeyReleased(KeyEvent event)
- {
- //System.out.println("in handleKeyPressed. keyCode == SWT.F5? " + (event.keyCode==SWT.F5) + ", keyCode: "+event.keyCode);
- if (event.keyCode == SWT.F5)
- {
- getRefreshAllToolbarAction(getStructuredSelection()).run();
- }
- }
- /**
- * Handles key events in viewer.<br>
- * This is needed for various keys (eg: delete key) and for model dump.
- */
- private void handleKeyPressed(KeyEvent event)
- {
- //System.out.println("in handleKeyPressed. keyCode == SWT.F5? " + (event.keyCode==SWT.F5) + ", keyCode: "+event.keyCode);
- IStructuredSelection selection = (IStructuredSelection)getSelection();
- /*
- * DKM - taking this out since the delete key should be handled by the retargetable action
- *
- if ((event.character == SWT.DEL) && (event.stateMask == 0) && (selection.size()>0) )
- {
- if (showDelete() && canDelete())
- {
- SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction)getDeleteAction(selection);
- dltAction.setShell(getShell());
- dltAction.setSelection(getSelection());
- dltAction.setViewer(getViewer());
- dltAction.run();
- }
- }
- else
- */
- if ((event.character == '-') && (event.stateMask == SWT.CTRL) )
- {
- SystemCollapseAllAction collapseAllAction = getCollapseAllAction();
- collapseAllAction.setShell(getShell());
- collapseAllAction.run();
- }
- else if ((event.character == '-') && (selection.size()>0) )
- {
- //System.out.println("Inside Ctrl+- processing");
- treeViewer.collapseSelected();
- }
- else if ((event.character == '+') && (selection.size()>0) )
- {
- //System.out.println("Inside Ctrl++ processing");
- treeViewer.expandSelected();
- }
-
- }
-
- /**
- * Reveal and selects the passed selection in viewer.<br>
- */
- public void selectReveal(ISelection selection)
- {
- if (!(selection instanceof StructuredSelection))
- return;
- StructuredSelection ssel = (StructuredSelection)selection;
- if (!ssel.isEmpty()) {
- // select and reveal the item
- treeViewer.setSelection(ssel, true);
- }
- }
-
- /**
- * Called when the context menu is about to open.
- */
- private void fillContextMenu(IMenuManager menu)
- {
- SystemMenuManager ourMenu = new SystemMenuManager(menu);
-
- // Populate with our stuff...
- IStructuredSelection selection = getStructuredSelection();
- Object firstSelection = selection.getFirstElement();
- createStandardGroups(menu);
- if (firstSelection instanceof IProject)
- {
- // Scrub unrelated menu items
- if (selection.size() == 1)
- fillProjectContextMenu(ourMenu, selection);
- }
- else
- {
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(firstSelection, treeViewer);
- if (adapter != null)
- {
- if ((firstSelection instanceof SystemTeamViewSubSystemConfigurationNode) ||
- // FIXME - compile actions separate now (firstSelection instanceof SystemTeamViewCompileTypeNode) ||
- (firstSelection instanceof ISystemProfile))
- {
- addActions(ourMenu, selection);
- }
- else if (firstSelection instanceof ISystemFilterPool)
- {
- //SystemTestingAction testAction = new SystemTestingAction(getShell(), this);
- //testAction.setSelection(getSelection());
- //ourMenu.add(ISystemContextMenuConstants.GROUP_CHANGE, testAction);
- }
- }
- }
- // whale through all actions, updating shell and selection
- IContributionItem[] items = menu.getItems();
- for (int idx=0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) &&
- (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
- try{
- item.setInputs(getShell(), getViewer(), selection);
- } catch (Exception e)
- {
- SystemBasePlugin.logError("Error configuring action " + item.getClass().getName(),e); //$NON-NLS-1$
- System.err.println("Error configuring action " + item.getClass().getName()); //$NON-NLS-1$
- }
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
- item.setInputs(getShell(), getViewer(), selection);
- }
- }
- PropertyDialogAction pdAction = getPropertyDialogAction(selection);
- if (pdAction.isApplicableForSelection())
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
- }
-
- /**
- * Let each object add their own actions...
- * @param ourMenu the menu for the team view
- * @param selection the current selection in the view
- */
- protected void addActions(SystemMenuManager ourMenu, IStructuredSelection selection)
- {
- // ADAPTER SPECIFIC ACTIONS
- Iterator elements= selection.iterator();
- Hashtable adapters = new Hashtable();
- while (elements.hasNext())
- {
- Object element= elements.next();
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(element, treeViewer);
- if (adapter != null)
- adapters.put(adapter,element); // want only unique adapters
- }
- Enumeration uniqueAdapters = adapters.keys();
- Shell shell = getShell();
- while (uniqueAdapters.hasMoreElements())
- {
- ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter)uniqueAdapters.nextElement();
- nextAdapter.addActions(ourMenu,selection,shell,ISystemContextMenuConstants.GROUP_ADAPTERS);
- //if (nextAdapter instanceof AbstractSystemViewAdapter)
- // ((AbstractSystemViewAdapter)nextAdapter).addCommonRemoteActions(ourMenu,selection,shell,ISystemContextMenuConstants.GROUP_ADAPTERS);
- }
-
- // wail through all actions, updating shell and selection
- IContributionItem[] items = ourMenu.getMenuManager().getItems();
- for (int idx=0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) &&
- (((ActionContributionItem)items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) ( ((ActionContributionItem)items[idx]).getAction() );
- try{
- item.setInputs(getShell(), treeViewer, selection);
- } catch (Exception e)
- {
- SystemBasePlugin.logError("Error configuring action " + item.getClass().getName(),e); //$NON-NLS-1$
- System.out.println("Error configuring action " + item.getClass().getName()); //$NON-NLS-1$
- }
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager)items[idx];
- item.setInputs(getShell(), treeViewer, selection);
- }
- }
- }
-
- /**
- * Creates the Systems plugin standard groups in a context menu.
- */
- public void createStandardGroups(IMenuManager menu)
- {
- //if (!menu.isEmpty())
- // return;
- // simply sets partitions in the menu, into which actions can be directed.
- // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
- // Deleted groups are not used yet.
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW)); // new->
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW_NONCASCADING)); // new stuff
- /*
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO)); // goto into, go->
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO)); // expand to->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND)); // expand, collapse
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN)); // open xxx
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH)); // open with->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH)); // open with->
- */
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH)); // work with->
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD)); // build, rebuild, refresh
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE)); // update, change
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); // rename,move,copy,delete,bookmark,refactoring
- /*
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); // move up, move down
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE)); // getters/setters, etc. Typically in editor
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH)); // search
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION)); // connection-related actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_STARTSERVER)); // Start Remote Server cascading menu
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT)); // get or put actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS)); // actions queried from adapters
- */
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_VIEWER_SETUP)); // ? Probably View->by xxx, yyy
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM)); // Team
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES)); // Properties
- }
-
-
- /**
- * Fill context menu for IProjects
- */
- private void fillProjectContextMenu(SystemMenuManager menu, IStructuredSelection selection)
- {
- menu.add(ISystemContextMenuConstants.GROUP_BUILD,getRefreshAllMenuAction(selection));
- menu.add(ISystemContextMenuConstants.GROUP_BUILD,getReloadRSEAction(selection));
- menu.add(ISystemContextMenuConstants.GROUP_NEW,getNewProfileAction(selection));
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES));
- //menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, getPropertyDialogAction(selection));
- }
-
- /**
- * Get the properties dialog action
- */
- private PropertyDialogAction getPropertyDialogAction(IStructuredSelection selection)
- {
- if (propertyDialogAction == null)
- propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), treeViewer);
- propertyDialogAction.selectionChanged(selection);
- return propertyDialogAction;
- }
- /**
- * Get the reload RSE action for the context menu
- */
- private SystemTeamReloadAction getReloadRSEAction(IStructuredSelection selection)
- {
- boolean privateProfileStillExists = (RSECorePlugin.getTheSystemProfileManager().getDefaultPrivateSystemProfile() != null);
- if (reloadRSEAction == null)
- reloadRSEAction = new SystemTeamReloadAction(getShell());
- reloadRSEAction.setSelection(selection);
- if (privateProfileStillExists)
- reloadRSEAction.setEnabled(false);
- return reloadRSEAction;
- }
- /**
- * Get the refresh All action for the context menu
- */
- private SystemTeamViewRefreshAllAction getRefreshAllMenuAction(IStructuredSelection selection)
- {
- if (menuRefreshAllAction == null)
- menuRefreshAllAction = new SystemTeamViewRefreshAllAction(getShell(), this);
- menuRefreshAllAction.setSelection(selection);
- return menuRefreshAllAction;
- }
- /**
- * Get the refresh All action for the toolbar
- */
- private SystemTeamViewRefreshAllAction getRefreshAllToolbarAction(IStructuredSelection selection)
- {
- if (toolBarRefreshAllAction == null)
- toolBarRefreshAllAction = new SystemTeamViewRefreshAllAction(getShell(), this);
- toolBarRefreshAllAction.setSelection(selection);
- return toolBarRefreshAllAction;
- }
-
- /**
- * Get the profile adapter for a given profile
- */
- private SystemTeamViewProfileAdapter getProfileAdapter(ISystemProfile profile) {
- RSEUIPlugin plugin = RSEUIPlugin.getDefault();
-
- IAdapterFactory factory = plugin.getSystemViewAdapterFactory();
- SystemTeamViewProfileAdapter adapter = (SystemTeamViewProfileAdapter) factory.getAdapter(profile, SystemTeamViewProfileAdapter.class);
- return adapter;
- }
-
- /**
- * Get the New Profile action
- */
- private SystemNewProfileAction getNewProfileAction(IStructuredSelection selection)
- {
- if (newProfileAction == null)
- {
- newProfileAction = new SystemNewProfileAction(getShell(), false);
- newProfileAction.setViewer(getViewer());
- }
- newProfileAction.setSelection(selection);
- return newProfileAction;
- }
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected IAction getDeleteAction(IStructuredSelection selection)
- {
- if (deleteAction == null)
- {
- deleteAction = new SystemCommonDeleteAction(getShell(),this);
- deleteAction.setViewer(getViewer());
- deleteAction.setHelp(RSEUIPlugin.HELPPREFIX+"actndlpr"); //$NON-NLS-1$
- deleteAction.setDialogHelp(RSEUIPlugin.HELPPREFIX+"ddltprfl"); //$NON-NLS-1$
- deleteAction.setPromptLabel(SystemResources.RESID_DELETE_PROFILES_PROMPT);
- }
- deleteAction.setSelection(selection);
- return deleteAction;
- }
-
- /**
- * Scrub the popup menu to remove everything but team-related stuff...
- */
- private void scrubOtherContributions(IMenuManager menuMgr) {
- IStructuredSelection selection = getStructuredSelection();
- Object firstSelection = selection.getFirstElement();
- if (firstSelection instanceof IProject) {
- boolean privateProfileStillExists = (RSECorePlugin.getTheSystemProfileManager().getDefaultPrivateSystemProfile() != null);
- IContributionItem items[] = menuMgr.getItems();
- if (items != null) {
- for (int idx = 0; idx < items.length; idx++) {
- IContributionItem item = items[idx];
- if (item.getId() != null) {
- if (!item.getId().equals("team.main") || privateProfileStillExists) menuMgr.remove(item); //$NON-NLS-1$
- }
- }
- }
- }
- }
-
- public void dispose()
- {
- RSECorePlugin.getTheSystemRegistry().removeSystemModelChangeListener(this);
- super.dispose();
- }
-
- /**
- * Return our viewer.
- */
- public TreeViewer getViewer()
- {
- return treeViewer;
- }
-
- /**
- * Updates the title text and title tool tip.
- * Called whenever the input of the viewer changes.
- */
- public void updateTitle()
- {
-// Object input = getTreeViewer().getInput();
-// String viewName = getConfigurationElement().getAttribute("name");
- setPartName(getTitle());
- setTitleToolTip(""); //$NON-NLS-1$
- }
-
- /**
- * Determines the input for the viewer. This is needed for the "Open
- * in New Window" action that sets the input to the workbench page,
- * and expects the viewers to use it.
- */
- protected IAdaptable getInput()
- {
- if (input == null)
- input = new SystemTeamViewInputProvider();
- return input;
- }
-
- /**
- * Adds the actions in this group and its subgroups to the action bars.
- */
- public void fillActionBars(IActionBars actionBars)
- {
- IStructuredSelection selection = getStructuredSelection();
- actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), getPropertyDialogAction(selection));
- SystemTeamViewRefreshAllAction refreshAllAction = getRefreshAllToolbarAction(selection);
- actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAllAction);
-
- actionBars.getToolBarManager().add(getNewProfileAction(selection));
- // now add the global Refresh action in the view tool bar.
- actionBars.getToolBarManager().add(refreshAllAction);
-
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getDeleteAction(selection));
-
- // add rename action
- SystemCommonRenameAction renameAction = new SystemCommonRenameAction(getShell(), this);
- renameAction.setViewer(getViewer());
- // renameAction.setSelection(selection);
- actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction);
-
- SystemCommonSelectAllAction selAllAction = new SystemCommonSelectAllAction(getShell(), treeViewer, treeViewer);
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selAllAction);
-
- actionBars.getToolBarManager().add(new Separator());
- actionBars.getToolBarManager().add(getCollapseAllAction());
-
- statusLine = actionBars.getStatusLineManager();
- }
-
- /**
- * Return the collapseAll action
- */
- protected SystemCollapseAllAction getCollapseAllAction()
- {
- if (collapseAllAction == null)
- {
- collapseAllAction = new SystemCollapseAllAction(getShell());
- collapseAllAction.setSelectionProvider(treeViewer);
- collapseAllAction.setViewer(treeViewer);
- collapseAllAction.setImageDescriptor(getNavigatorImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$
- // DKM - changed this icon from clcl16 since navigator no longer has it
- collapseAllAction.setHoverImageDescriptor(getNavigatorImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$
- }
- return collapseAllAction;
- }
-
- /**
- * Updates the actions which were added to the action bars.
- */
- public void updateActionBars(IStructuredSelection selection)
- {
- getPropertyDialogAction(selection);
- getRefreshAllToolbarAction(selection);
- getDeleteAction(selection);
- }
-
- /**
- * This is the method in your class that will be called when a resource in the
- * RSE model changes. You will be called after the resource is changed.
- * @see ISystemModelChangeEvent
- */
- public void systemModelResourceChanged(ISystemModelChangeEvent event)
- {
- int resourceType = event.getResourceType();
- boolean testMode = false;
- if ((event.getEventType() == ISystemModelChangeEvents.SYSTEM_RESOURCE_ALL_RELOADED) ||
- (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_PROFILE))
- {
- getTreeViewer().refresh();
- treeViewer.updatePropertySheet();
- if (testMode && (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_PROFILE))
- System.out.println("Profile change event of type: " + event.getEventType()); //$NON-NLS-1$
- }
- else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTER)
- {
- if (testMode)
- System.out.println("Filter change event of type: " + event.getEventType()); //$NON-NLS-1$
- ISystemFilter filter = (ISystemFilter)event.getResource();
- ISystemFilterPool pool = filter.getParentFilterPool();
- if (pool == null) // maybe for transient filters?
- return;
- if (isModelObjectExpanded(pool)) // if parent is expanded...
- treeViewer.refresh(pool); // refresh the parent.
- }
- else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_FILTERPOOL)
- {
- if (testMode)
- System.out.println("Filter Pool change event of type: " + event.getEventType()); //$NON-NLS-1$
- ISystemFilterPool pool = (ISystemFilterPool)event.getResource();
- ISystemProfile profile = ((ISubSystemConfiguration)pool.getProvider()).getSystemProfile(pool);
- TreeItem filterCategoryItem = getCategoryNodeTreeItem(profile, SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS);
- if ((filterCategoryItem!=null) && filterCategoryItem.getExpanded())
- treeViewer.refresh(filterCategoryItem.getData());
- }
- else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION)
- {
- if (testMode)
- System.out.println("Connection change event of type: " + event.getEventType()); //$NON-NLS-1$
- IHost conn = (IHost)event.getResource();
- ISystemProfile profile = conn.getSystemProfile();
-
- TreeItem connCategoryItem = getCategoryNodeTreeItem(profile, SystemTeamViewCategoryNode.MEMENTO_CONNECTIONS);
- if ((connCategoryItem != null) && connCategoryItem.getExpanded())
- {
- treeViewer.refresh(connCategoryItem.getData());
- }
- }
- else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_SUBSYSTEM)
- {
- if (testMode)
- System.out.println("SubSystem change event of type: " + event.getEventType()); //$NON-NLS-1$
- }
-
-// FIXME - user actions separate now
-// else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_USERACTION)
-// {
-// if (testMode)
-// System.out.println("User Action change event of type: " + event.getEventType());
-// SystemUDActionElement action = (SystemUDActionElement)event.getResource();
-// ISystemProfile profile = action.getProfile();
-// TreeItem actionCategoryItem = getCategoryNodeTreeItem(profile, SystemTeamViewCategoryNode.MEMENTO_USERACTIONS);
-// if ((actionCategoryItem!=null) && actionCategoryItem.getExpanded())
-// {
-// // note if the updated action is currently selected, we lose that selection because
-// // when we save actions, their wrapper objects are recreated (yes, its bad but who
-// // has time to fix it?) and so the binary address of the old no longer exists.
-// // To circumvent we need to detect the situation and reselect the new one. But how to tell
-// // if one action is equal to another? Compare their xml element nodes.
-// ISelection s = getSelection();
-// boolean reselect = false;
-// if (s instanceof StructuredSelection)
-// {
-// Object firstSel = ((StructuredSelection)s).getFirstElement();
-// if (firstSel instanceof SystemUDActionElement)
-// if ( ((SystemUDActionElement)firstSel).getElement() ==
-// action.getElement() )
-// reselect = true;
-// }
-// // the problem we have here is refresh will cause yet another fresh set of SystemUDActionElement objects
-// // to be created! We really should fix that.
-//
-// //if (event.getEventType() != ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED)
-// treeViewer.refresh(actionCategoryItem.getData());
-// // I tried this and update didn't update the label, damn.
-// //else
-// //{
-// //String[] allProps = {IBasicPropertyConstants.P_TEXT,IBasicPropertyConstants.P_IMAGE};
-// //treeViewer.update(actionCategoryItem.getData(), allProps);
-// //}
-// if (reselect)
-// treeViewer.setSelection(new StructuredSelection(action));
-// }
-// }
-// else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_NAMEDTYPE)
-// {
-// if (testMode)
-// System.out.println("Named Type change event of type: " + event.getEventType()); //$NON-NLS-1$
-// }
-
-// compile actions separate now
-// else if (resourceType == ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_COMPILECMD)
-// {
-// if (testMode)
-// System.out.println("Compile Command change event of type: " + event.getEventType());
-// SystemCompileCommand cmd = (SystemCompileCommand)event.getResource();
-// ISystemProfile profile = cmd.getParentType().getParentProfile().getProfile();
-// TreeItem actionCategoryItem = getCategoryNodeTreeItem(profile, SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS);
-// if ((actionCategoryItem!=null) && actionCategoryItem.getExpanded())
-// treeViewer.refresh(actionCategoryItem.getData());
-// }
- }
- /**
- * Return true if the given profile is expanded
- */
- private boolean isModelObjectExpanded(Object object)
- {
- TreeItem item = treeViewer.findTreeItem(object);
- return ((item != null) && item.getExpanded());
- }
- /**
- * Find a category node of a particular type, under the node of a given profile
- */
- private TreeItem getCategoryNodeTreeItem(ISystemProfile profile, String mementoKey)
- {
- TreeItem item = treeViewer.findTreeItem(profile);
- if ((item==null) || !item.getExpanded() )
- return null;
-
- TreeItem[] childItems = item.getItems();
- item = null;
- if (childItems != null)
- {
- boolean found = false;
- for (int idx=0; !found && (idx<childItems.length); idx++)
- {
- if (childItems[idx].getData() instanceof SystemTeamViewCategoryNode)
- {
- SystemTeamViewCategoryNode node = (SystemTeamViewCategoryNode)childItems[idx].getData();
- if ((node!=null) && node.getMementoHandle().equals(mementoKey))
- {
- found = true;
- item = childItems[idx];
- }
- }
- }
- }
- return item;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.ISystemDeleteTarget#showDelete()
- */
- public boolean showDelete()
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.ISystemDeleteTarget#canDelete()
- */
- public boolean canDelete() {
- boolean ok = false;
- IStructuredSelection selection = getStructuredSelection();
- if (!selection.isEmpty()) {
- ok = true;
- ISystemProfileManager manager = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager();
- ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile();
- for (Iterator z = selection.iterator(); z.hasNext() && ok;) {
- Object object = z.next();
- if (object instanceof ISystemProfile) {
- ISystemProfile profile = (ISystemProfile) object;
- if (profile == defaultProfile) {
- ok = false;
- }
- } else {
- ok = false;
- }
- }
- }
- return ok;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.ISystemDeleteTarget#doDelete()
- */
- public boolean doDelete(IProgressMonitor monitor) {
- boolean ok = true;
- IStructuredSelection selection = getStructuredSelection();
- Iterator elements = selection.iterator();
- while (ok && elements.hasNext()) {
- ISystemProfile profile = (ISystemProfile) elements.next();
- try {
- SystemTeamViewProfileAdapter profileAdapter = getProfileAdapter(profile);
- ok = profileAdapter.doDelete(getShell(), profile, monitor);
- } catch (Exception exc) {
- String msg = "Exception deleting profile " + profile.getName(); //$NON-NLS-1$
- SystemBasePlugin.logError(msg, exc);
- SystemMessageDialog.displayExceptionMessage(getShell(), exc);
- ok = false;
- }
- }
- return ok;
- }
-
- // ------------------------------
- // ISystemRenameTarget methods...
- // ------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.ISystemRenameTarget#showRename()
- */
- public boolean showRename()
- {
- return true;
- }
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.ISystemRenameTarget#canRename()
- */
- public boolean canRename()
- {
- boolean ok = true;
- IStructuredSelection selection= getStructuredSelection();
- Iterator elements= selection.iterator();
- while (ok && elements.hasNext())
- {
- Object currObj = elements.next();
- if (!(currObj instanceof ISystemProfile))
- ok = false;
- }
- //System.out.println("Inside canRename: "+ok);
- return ok;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.ISystemRenameTarget#doRename(java.lang.String[])
- */
- public boolean doRename(String[] newNames) {
- boolean ok = true;
- IStructuredSelection selection = getStructuredSelection();
- Iterator elements = selection.iterator();
- int idx = 0;
- while (ok && elements.hasNext()) {
- ISystemProfile profile = (ISystemProfile) elements.next();
- try {
- SystemTeamViewProfileAdapter profileAdapter = getProfileAdapter(profile);
- profileAdapter.doRename(getShell(), profile, newNames[idx++], null);
- } catch (SystemMessageException exc) {
- SystemMessageDialog.displayMessage(getShell(), exc);
- ok = false;
- } catch (Exception exc) {
- String msg = "Exception renaming profile "; //$NON-NLS-1$
- SystemBasePlugin.logError(msg, exc);
- SystemMessageDialog.displayExceptionMessage(getShell(), exc);
- ok = false;
- }
- }
- return ok;
- }
-
- /**
- * Returns the image descriptor with the given relative path.
- */
- protected ImageDescriptor getNavigatorImageDescriptor(String relativePath) {
- String iconPath = "icons/full/"; //$NON-NLS-1$
- try {
- Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
- URL installURL = bundle.getEntry(""); //$NON-NLS-1$
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- // should not happen
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
-
- // ----------------
- // MEMENTO STUFF...
- // ----------------
-
- /**
- * Method declared on IViewPart.
- */
- public void saveState(IMemento memento)
- {
- if (treeViewer == null)
- {
- // part has not been created
- if (fMemento != null) //Keep the old state;
- memento.putMemento(fMemento);
- return;
- }
-
- // We record the current release for future in case anything significant changes from release to release
- memento.putString(TAG_RELEASE, RSECorePlugin.CURRENT_RELEASE_NAME);
-
- /*
- String inputMemento = memento.getString("factoryID"); // see IWorkbenchWindow ... this is only clue I can figure out!
- if (inputMemento != null)
- {
- saveInputState(memento);
- return;
- }*/
-
- Tree tree = treeViewer.getTree();
-
- // SAVE EXPANSION STATE
- Object expandedElements[]= treeViewer.getVisibleExpandedElements();
- if ( (expandedElements!=null) && (expandedElements.length > 0) )
- {
- IMemento expandedMem= memento.createChild(TAG_EXPANDED);
- for (int i= 0; i < expandedElements.length; i++)
- {
- Object o = expandedElements[i];
- String mementoHandle = getMementoHandle(o);
- if (mementoHandle != null)
- {
- IMemento elementMem= expandedMem.createChild(TAG_ELEMENT);
- elementMem.putString(TAG_PATH, getMementoHandle(o));
- //System.out.println("Added to saved expansion list: " + getMementoHandle(o));
- }
- }
- }
-
- // SAVE SELECTION STATE
- Object elements[]= ((IStructuredSelection) treeViewer.getSelection()).toArray();
- if ( (elements!=null) && (elements.length > 0) )
- {
- IMemento selectionMem= memento.createChild(TAG_SELECTION);
- for (int i= 0; i < elements.length; i++)
- {
- Object o= elements[i];
- String mementoHandle = getMementoHandle(o);
- if (mementoHandle != null)
- {
- IMemento elementMem= selectionMem.createChild(TAG_ELEMENT);
- elementMem.putString(TAG_PATH, getMementoHandle(o));
- }
- }
- }
-
- //save vertical position
- ScrollBar bar= tree.getVerticalBar();
- int position= bar != null ? bar.getSelection() : 0;
- memento.putString(TAG_VERTICAL_POSITION, String.valueOf(position));
- //save horizontal position
- bar= tree.getHorizontalBar();
- position= bar != null ? bar.getSelection() : 0;
- memento.putString(TAG_HORIZONTAL_POSITION, String.valueOf(position));
-
- }
- /**
- * Return the memento handle key plus the memento handle for
- * each part leading up to the current object.
- */
- protected String getMementoHandle(Object o)
- {
- String mementoKey = internalGetMementoHandleKey(o);
- if (mementoKey == null)
- return null;
- StringBuffer idBuffer = new StringBuffer(mementoKey);
- Object[] elementNodes = treeViewer.getElementNodes(o);
- if (elementNodes != null)
- {
- for (int idx=elementNodes.length-1; idx>=0; idx--)
- {
- o = elementNodes[idx];
- idBuffer.append(MEMENTO_DELIM+internalGetMementoHandle(o));
- }
- }
- //System.out.println("MEMENTO HANDLE: " + idBuffer.toString());
- return idBuffer.toString();
- }
- /**
- * Encapsulate code to look at object class type and determine what to return for
- * a memento handle key
- */
- protected String internalGetMementoHandleKey(Object o)
- {
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(o, treeViewer);
- String handle = null;
- if (adapter != null)
- handle = adapter.getMementoHandleKey(o);
- else if (o instanceof IResource)
- {
- if (o instanceof IProject)
- handle = "Project"; //$NON-NLS-1$
- else if (o instanceof IFolder)
- handle = "Folder"; //$NON-NLS-1$
- else
- handle = "File"; //$NON-NLS-1$
- }
- else if (o instanceof ISystemProfile)
- handle = "Profile"; //$NON-NLS-1$
- else if (o instanceof SystemTeamViewCategoryNode)
- {
- //handle = "Category";
- //handle = null; // decided not to re-expand past profiles
- }
-
- return handle;
- }
- /**
- * Encapsulate code to look at object class type and determine what to return for
- * a memento handle
- */
- protected String internalGetMementoHandle(Object o)
- {
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(o, treeViewer);
- String handle = null;
- if (adapter != null)
- handle = adapter.getMementoHandle(o);
- else if (o instanceof IResource)
- handle = ((IResource)o).getName();
- else if (o instanceof ISystemProfile)
- handle = ((ISystemProfile)o).getName();
- else if (o instanceof SystemTeamViewCategoryNode)
- handle = ((SystemTeamViewCategoryNode)o).getMementoHandle();
- return handle;
- }
-
- /**
- * Our own method for restoring state
- */
- void restoreState(IMemento memento)
- {
- RestoreStateRunnable restoreAction = new RestoreStateRunnable(memento);
- Display.getDefault().syncExec(restoreAction);
- }
-
- /**
- * Inner class for running restore-state in a thread
- */
- public class RestoreStateRunnable implements Runnable
- {
- private IMemento _memento;
- public RestoreStateRunnable(IMemento memento)
- {
- _memento = memento;
- }
-
- public void run()
- {
- IMemento memento = _memento;
- IMemento childMem = null;
-
- // restore expansion state
- childMem = memento.getChild(TAG_EXPANDED);
- if (childMem != null)
- {
- ArrayList elements = new ArrayList();
- IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT);
- for (int i = 0; i < elementMem.length; i++)
- {
- Object element = getObjectFromMemento(elementMem[i].getString(TAG_PATH));
- if (element != null)
- elements.add(element);
- }
- // expand objects...
- treeViewer.setExpandedElements(elements.toArray());
- }
-
- // restoreSelection
- childMem = memento.getChild(TAG_SELECTION);
- if (childMem != null)
- {
- ArrayList list = new ArrayList();
- IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT);
- for (int i = 0; i < elementMem.length; i++)
- {
- Object element = getObjectFromMemento(elementMem[i].getString(TAG_PATH));
- if (element != null)
- list.add(element);
- }
- treeViewer.setSelection(new StructuredSelection(list));
- }
-
- Tree tree = treeViewer.getTree();
- //restore vertical position
- ScrollBar bar = tree.getVerticalBar();
- if (bar != null)
- {
- try
- {
- String posStr = memento.getString(TAG_VERTICAL_POSITION);
- if (posStr != null)
- {
- int position;
- position = new Integer(posStr).intValue();
- bar.setSelection(position);
- }
- }
- catch (NumberFormatException e)
- {
- }
- }
- //restore vertical position
- bar = tree.getHorizontalBar();
- if (bar != null)
- {
- try
- {
- String posStr = memento.getString(TAG_HORIZONTAL_POSITION);
- if (posStr != null)
- {
- int position;
- position = new Integer(posStr).intValue();
- bar.setSelection(position);
- }
- }
- catch (NumberFormatException e)
- {
- }
- }
- }
- }
- /**
- * Private method to deconstruct an expanded/selected memento into an actual object
- */
- protected Object getObjectFromMemento(String memento)
- {
- if (memento == null)
- return null;
-
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile profile = null;
- IProject project = null;
- SystemTeamViewCategoryNode category = null;
- String elementType = ""; //$NON-NLS-1$
-
- //System.out.println("PARSING MEMENTO: " + memento);
-
- Vector v = SystemViewPart.tokenize(memento, MEMENTO_DELIM);
-
- // 0. element type
- // 1. RSE Project
- // 2. Profiles
- // 3. Categories
-
- for (int idx=0; idx<v.size(); idx++)
- {
- String token = (String)v.elementAt(idx);
- switch (idx)
- {
- // type of element
- case 0: elementType = token; break;
- // profile
- case 1:
- project = SystemResourceManager.getRemoteSystemsProject(false);
- break;
- case 2:
- profile = sr.getSystemProfile(token);
- break;
- case 3:
- if (profile != null) {
-
-
- SystemTeamViewProfileAdapter profileAdapter = (SystemTeamViewProfileAdapter)((IAdaptable)profile).getAdapter(ISystemViewElementAdapter.class);
- category = profileAdapter.restoreCategory(profile, token);
- }
- //System.out.println("Restored category: "+(category==null?"null":category.getLabel()));
- break;
- }
- }
-
- if (elementType.equals("Project")) //$NON-NLS-1$
- {
- //System.out.println("...PARSED INTO A PROJECT: " + project.getName());
- return project;
- }
- else if (elementType.equals(ISystemMementoConstants.MEMENTO_KEY_PROFILE))
- {
- //System.out.println("...PARSED INTO A PROFILE: " + profile.getName());
- return profile;
- }
- if (elementType.equals("Category")) //$NON-NLS-1$
- {
- //System.out.println("...PARSED INTO A CATEGORY: " + category.getLabel());
- return category;
- }
- else
- {
- //System.out.println("...UNKNOWN MEMENTO ");
- }
- return null;
- }
-
- // -----------------------------
- // ISelectionListener methods...
- // -----------------------------
-
- /**
- * Handles selection changed in viewer.
- * Updates global actions.
- * Links to editor (if option enabled)
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- updateActionBars(sel);
- Object firstSelection = sel.getFirstElement();
- if (firstSelection == null)
- return;
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(firstSelection);
- if (adapter != null)
- {
- setMessage(adapter.getStatusLineText(firstSelection));
- //if ((mouseButtonPressed == LEFT_BUTTON) && (!expandingTreeOnly)) //d40615
- //adapter.selectionChanged(firstSelection); //d40615
- }
- else
- setMessage(internalGetMementoHandle(firstSelection));
-
- if (newProfileAction != null)
- newProfileAction.refreshEnablement(); // not selection related, but we have no other trigger
- }
-
- // -------------------------------
- // ISystemMessageLine interface...
- // -------------------------------
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- errorMessage = null;
- sysErrorMessage = null;
- if (statusLine != null)
- statusLine.setErrorMessage(errorMessage);
- }
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- message = null;
- if (statusLine != null)
- statusLine.setMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage()
- {
- return errorMessage;
- }
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage()
- {
- return message;
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- this.errorMessage = message;
- if (statusLine != null)
- statusLine.setErrorMessage(message);
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- return sysErrorMessage;
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- sysErrorMessage = message;
- setErrorMessage(message.getLevelOneText());
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(Throwable exc)
- {
- setErrorMessage(exc.getMessage());
- }
-
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- this.message = message;
- if (statusLine != null)
- statusLine.setMessage(message);
- }
- /**
- *If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- setMessage(message.getLevelOneText());
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewProfileAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewProfileAdapter.java
deleted file mode 100644
index ac796fde5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewProfileAdapter.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David Dykstal (IBM) - [191130] use new getRemoteSystemsProject(boolean) call
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
- * David Dykstal (IBM) - [202630] getDefaultPrivateProfile() and ensureDefaultPrivateProfile() are inconsistent
- * David Dykstal (IBM) - [cleanup] formatted
- * Xuan Chen (IBM) - [222263] Need to provide a PropertySet Adapter for System Team View
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemResourceManager;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.internal.ui.actions.SystemProfileNameCopyAction;
-import org.eclipse.rse.internal.ui.view.ISystemMementoConstants;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorProfileName;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.rse.ui.view.ISystemPropertyConstants;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-/**
- * Adapter for displaying and processing SystemProfile objects in tree views, such as
- * the Team view.
- */
-public class SystemTeamViewProfileAdapter extends AbstractSystemViewAdapter {
-
- private boolean actionsCreated = false;
- private Hashtable categoriesByProfile = new Hashtable();
- // context menu actions for profiles...
- protected SystemTeamViewMakeActiveProfileAction makeProfileActiveAction;
- protected SystemTeamViewMakeInActiveProfileAction makeProfileInactiveAction;
- protected SystemCommonRenameAction renameAction;
- protected SystemCommonDeleteAction deleteAction;
- protected SystemProfileNameCopyAction copyProfileAction;
-
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given element.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup) {
- if (!actionsCreated) {
- createActions();
- }
- copyProfileAction.setProfile((ISystemProfile) selection.getFirstElement());
- menu.add(ISystemContextMenuConstants.GROUP_CHANGE, makeProfileActiveAction);
- menu.add(ISystemContextMenuConstants.GROUP_CHANGE, makeProfileInactiveAction);
- menu.add(ISystemContextMenuConstants.GROUP_REORGANIZE, copyProfileAction);
- menu.add(ISystemContextMenuConstants.GROUP_REORGANIZE, deleteAction);
- menu.add(ISystemContextMenuConstants.GROUP_REORGANIZE, renameAction);
- }
-
- private void createActions() {
- makeProfileActiveAction = new SystemTeamViewMakeActiveProfileAction(getShell());
- makeProfileInactiveAction = new SystemTeamViewMakeInActiveProfileAction(getShell());
- copyProfileAction = new SystemProfileNameCopyAction(getShell());
-
- deleteAction = new SystemCommonDeleteAction(getShell(), getTeamViewPart());
- deleteAction.setHelp(RSEUIPlugin.HELPPREFIX + "actndlpr"); //$NON-NLS-1$
- deleteAction.setDialogHelp(RSEUIPlugin.HELPPREFIX + "ddltprfl"); //$NON-NLS-1$
- deleteAction.setPromptLabel(SystemResources.RESID_DELETE_PROFILES_PROMPT);
-
- renameAction = new SystemCommonRenameAction(getShell(), getTeamViewPart());
- renameAction.setHelp(RSEUIPlugin.HELPPREFIX + "actnrnpr"); //$NON-NLS-1$
- renameAction.setDialogSingleSelectionHelp(RSEUIPlugin.HELPPREFIX + "drnsprfl"); //$NON-NLS-1$
- renameAction.setDialogMultiSelectionHelp(RSEUIPlugin.HELPPREFIX + "drnmprfl"); //$NON-NLS-1$
- renameAction.setSingleSelectPromptLabel(SystemResources.RESID_SIMPLE_RENAME_PROFILE_PROMPT_LABEL, SystemResources.RESID_SIMPLE_RENAME_PROFILE_PROMPT_TIP);
- renameAction.setMultiSelectVerbiage(SystemResources.RESID_MULTI_RENAME_PROFILE_VERBIAGE);
-
- actionsCreated = true;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element) {
- ISystemProfile profile = (ISystemProfile) element;
- if (RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName()))
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE_ID);
- else
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
- }
-
- /**
- * Return the team view part
- */
- private SystemTeamViewPart getTeamViewPart() {
- SystemTeamView viewer = (SystemTeamView) getViewer();
- return viewer.getTeamViewPart();
- }
-
- /**
- * Return the label for this object
- */
- public String getText(Object element) {
- return ((ISystemProfile) element).getName();
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element) {
- return ((ISystemProfile) element).getName();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element) {
- return ((ISystemProfile) element).getName();
- }
-
- /**
- * Return the type label for this object
- */
- public String getType(Object element) {
- return SystemViewResources.RESID_PROPERTY_PROFILE_TYPE_VALUE;
- }
-
- /**
- * Return the string to display in the status line when the given object is selected.
- * We return:
- * Connection: name - Host name: hostName - Description: description
- */
- public String getStatusLineText(Object element) {
- ISystemProfile profile = (ISystemProfile) element;
- boolean active = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName());
- return getType(element) + ": " + profile.getName() + ", " + //$NON-NLS-1$ //$NON-NLS-2$
- SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL + ": " + //$NON-NLS-1$
- (active ? SystemViewResources.RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL : SystemViewResources.RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL);
- }
-
- /**
- * Return the parent of this object. We return the RemoteSystemsConnections project
- */
- public Object getParent(Object element) {
- return SystemResourceManager.getRemoteSystemsProject(false);
- }
-
- /**
- * Return the children of this profile.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor) {
- ISystemProfile profile = (ISystemProfile) element;
- return getCategoryChildren(profile);
- }
-
- /**
- * Given a profile, return all the category children for it. If this child objects have yet to be created,
- * create them now.
- */
- public SystemTeamViewCategoryNode[] getCategoryChildren(ISystemProfile profile) {
- SystemTeamViewCategoryNode[] children = (SystemTeamViewCategoryNode[]) categoriesByProfile.get(profile);
- if (children == null) {
- children = new SystemTeamViewCategoryNode[3]; //5];
- for (int idx = 0; idx < children.length; idx++)
- children[idx] = new SystemTeamViewCategoryNode(profile);
- children[0].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_CONNECTIONS_LABEL);
- children[0].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_CONNECTIONS_TOOLTIP);
- children[0].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CONNECTION_ID));
- children[0].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_CONNECTIONS);
-
- children[1].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_LABEL);
- children[1].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_FILTERPOOLS_TOOLTIP);
- children[1].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID));
- children[1].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS);
-
- children[2].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_PROPERTYSET_LABEL);
- children[2].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_PROPERTYSET_TOOLTIP);
- children[2].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROPERTIES_ID));
- children[2].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_PROPERTYSETS);
-/*
- children[2].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_USERACTIONS_LABEL);
- children[2].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_USERACTIONS_TOOLTIP);
- children[2].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_USERACTION_USR_ID));
- children[2].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_USERACTIONS);
-
- children[3].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_COMPILECMDS_LABEL);
- children[3].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_COMPILECMDS_TOOLTIP);
- children[3].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_COMPILE_ID));
- children[3].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS);
- */
- /*
- children[4].setLabel(SystemResources.RESID_TEAMVIEW_CATEGORY_TARGETS_LABEL);
- children[4].setDescription(SystemResources.RESID_TEAMVIEW_CATEGORY_TARGETS_TOOLTIP);
- children[4].setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_TARGET_ID));
- children[4].setMementoHandle(SystemTeamViewCategoryNode.MEMENTO_TARGETS);
- */
-
- categoriesByProfile.put(profile, children);
- }
- return children;
- }
-
- /**
- * Given a profile and memento handle, return the appropriate category node. This is used when
- * restoring the expansion and selection state of the team view.
- */
- public SystemTeamViewCategoryNode restoreCategory(ISystemProfile profile, String mementoHandle) {
- SystemTeamViewCategoryNode[] children = getCategoryChildren(profile);
- SystemTeamViewCategoryNode category = null;
- for (int idx = 0; (category == null) && (idx < 2); idx++) {
- if (children[idx].getMementoHandle().equals(mementoHandle)) category = children[idx];
- }
- return category;
- }
-
- /**
- * Return true if this profile has children. We return true.
- */
- public boolean hasChildren(IAdaptable element) {
- return true;
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
- /**
- * Return our unique property descriptors, which getPropertyDescriptors adds to the common properties.
- */
- protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors() {
- if (propertyDescriptorArray == null) {
- propertyDescriptorArray = new PropertyDescriptor[1];
- int idx = 0;
- // status
- propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_IS_ACTIVE, SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL,
- SystemViewResources.RESID_PROPERTY_PROFILESTATUS_TOOLTIP);
- }
- return propertyDescriptorArray;
- }
-
- /**
- * Returns the current value for the named property.
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param key - the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- public Object internalGetPropertyValue(Object key) {
- String name = (String) key;
- ISystemProfile profile = (ISystemProfile) propertySourceInput;
-
- if (name.equals(ISystemPropertyConstants.P_IS_ACTIVE)) {
- boolean active = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName());
- if (active)
- return SystemViewResources.RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL;
- else
- return SystemViewResources.RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL;
- } else
- return null;
- }
-
- // FOR COMMON DELETE ACTIONS
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element) {
- boolean ok = true;
- if (!(element instanceof ISystemProfile)) {
- ok = false;
- } else {
- ISystemProfile profile = (ISystemProfile) element;
- ISystemProfileManager manager = RSECorePlugin.getTheSystemProfileManager();
- ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile();
- if (profile == defaultProfile) {
- ok = false;
- }
- }
- return ok;
- }
-
- /**
- * Perform the delete action.
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception {
- boolean ok = true;
- RSECorePlugin.getTheSystemRegistry().deleteSystemProfile((ISystemProfile) element);
- return ok;
- }
-
- // FOR COMMON RENAME ACTIONS
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename popup menu item will be enabled.
- */
- public boolean canRename(Object element) {
- boolean ok = true;
- if (!(element instanceof ISystemProfile)) ok = false;
- return ok;
- }
-
- /**
- * Perform the rename action.
- */
- public boolean doRename(Shell shell, Object element, String newName, IProgressMonitor monitor) throws Exception {
- boolean ok = true;
- RSECorePlugin.getTheSystemRegistry().renameSystemProfile((ISystemProfile) element, newName);
- return ok;
- }
-
- /**
- * Return a validator for verifying the new name is correct.
- */
- public ISystemValidator getNameValidator(Object element) {
- String[] nameArray = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNames();
- Vector names = new Vector(nameArray.length);
- names.addAll(Arrays.asList(nameArray));
- ISystemValidator validator = new ValidatorProfileName(names);
- return validator;
- }
-
- /**
- * Parent override.
- * <p>
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * Returns profile.connectionName, upperCased
- */
- public String getCanonicalNewName(Object element, String newName) {
- return newName.toUpperCase();
- }
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- */
- public String getMementoHandle(Object element) {
- ISystemProfile profile = (ISystemProfile) element;
- return profile.getName();
- }
-
- /**
- * Return a short string to uniquely identify the type of resource.
- */
- public String getMementoHandleKey(Object element) {
- return ISystemMementoConstants.MEMENTO_KEY_PROFILE;
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetAdapter.java
deleted file mode 100644
index a31f768fe..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetAdapter.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xuan Chen (IBM) - [222263] initial contribution.
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API type
- *********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.IProperty;
-import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Adapter for displaying and processing SystemTeamViewSubSystemConfigurationNode objects in tree views, such as
- * the Team view.
- */
-public class SystemTeamViewPropertySetAdapter
- extends AbstractSystemViewAdapter
-{
- private boolean actionsCreated = false;
-
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given element.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- if (!actionsCreated)
- createActions();
- }
- private void createActions()
- {
- actionsCreated = true;
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- return ((SystemTeamViewPropertySetNode)element).getImageDescriptor();
- }
-
- /**
- * Return the label for this object
- */
- public String getText(Object element)
- {
- return ((SystemTeamViewPropertySetNode)element).getLabel();
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return ((SystemTeamViewPropertySetNode)element).getLabel();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
- return factory.getLabel();
- }
-
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- return SystemViewResources.RESID_PROPERTY_TEAM_PROPERTYSET_TYPE_VALUE;
- }
-
- /**
- * Return the string to display in the status line when the given object is selected.
- */
- public String getStatusLineText(Object element)
- {
- SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
- return SystemResources.RESID_TEAMVIEW_PROPERTYSET_VALUE + ": " + factory.getLabel(); //$NON-NLS-1$
- }
-
- /**
- * Return the parent of this object. We return the RemoteSystemsConnections project
- */
- public Object getParent(Object element)
- {
- SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
- return factory.getParent();
- }
-
- /**
- * Return the children of this profile.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)element;
- IPropertySet propertySet = propertySetNode.getPropertySet();
- IPropertySet[] children = propertySet.getPropertySets();
- if (null == children || children.length == 0)
- {
- return new Object[0];
- }
-
- // construct the nodes for the view based on these configurations
- SystemTeamViewPropertySetNode[] nodes = new SystemTeamViewPropertySetNode[children.length];
- //String categoryType = category.getMementoHandle();
- for (int i = 0; i < children.length; i++)
- {
- nodes[i] = new SystemTeamViewPropertySetNode(propertySet, children[i]);
- }
- return nodes;
-
- }
-
- /**
- * Return true if this profile has children. We return true.
- */
- public boolean hasChildren(IAdaptable element)
- {
- SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)element;
- IPropertySet propertySet = propertySetNode.getPropertySet();
- IPropertySet[] children = propertySet.getPropertySets();
- if (null == children || children.length == 0)
- {
- return false;
- }
-
- return true;
-
- }
-
- /**
- * For PropertySet Node Adapter, we need to override this method since we don't want to display "name" and "type" twice.
- *
- * @return an array containing all descriptors.
- *
- * @see #internalGetPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- return internalGetPropertyDescriptors();
- }
-
- protected IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)propertySourceInput;
- IPropertySet propertySet = propertySetNode.getPropertySet();
-
- String[] propertyKeys = propertySet.getPropertyKeys();
-
- int size = propertyKeys.length;
-
- IProperty nameProperty = propertySet.getProperty(SystemTeamViewPropertySetNode.NAME_PROPERTY);
- if (null == nameProperty)
- {
- nameProperty = propertySet.getProperty(SystemTeamViewPropertySetNode.NAME_PROPERTY1);
- }
- int startingIndex = 0;
- if (nameProperty == null)
- {
- size++;
- }
-
- propertyDescriptorArray = new PropertyDescriptor[size];
-
- if (nameProperty == null)
- {
- propertyDescriptorArray[startingIndex++] = createSimplePropertyDescriptor(SystemTeamViewPropertySetNode.NAME_PROPERTY, SystemTeamViewPropertySetNode.NAME_PROPERTY, propertySet.getName());
- }
-
- for (int i = startingIndex, j = 0; i < size; i++, j++)
- {
- propertyDescriptorArray[i] = createSimplePropertyDescriptor(propertyKeys[j], propertyKeys[j], propertySet.getPropertyValue(propertyKeys[j]));
- }
-
-
- return propertyDescriptorArray;
- }
-
-
- /**
- * Returns the current value for the named property.
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param key - the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- public Object internalGetPropertyValue(Object key)
- {
- SystemTeamViewPropertySetNode propertySetNode = (SystemTeamViewPropertySetNode)propertySourceInput;
- IPropertySet propertySet = propertySetNode.getPropertySet();
- return propertySet.getPropertyValue((String)key);
- }
-
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- */
- public String getMementoHandle(Object element)
- {
- SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
- return factory.getMementoHandle();
- }
- /**
- * Return a short string to uniquely identify the type of resource.
- */
- public String getMementoHandleKey(Object element)
- {
- SystemTeamViewPropertySetNode factory = (SystemTeamViewPropertySetNode)element;
- return factory.getLabel();
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetNode.java
deleted file mode 100644
index 7efd45f45..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewPropertySetNode.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Xuan Chen (IBM) - [222263] initial contribution.
- *********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.model.IProperty;
-import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.core.model.IPropertySetContainer;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class represents a child node under category nodes, in the Team view.
- * It represents expandable subsystem factories such as "Files" or "iSeries Objects".
- */
-public class SystemTeamViewPropertySetNode implements IAdaptable
-{
- private String mementoHandle;
- private IPropertySetContainer parent;
- private IPropertySet propertySet;
- static public final String NAME_PROPERTY = "name"; //$NON-NLS-1$
- static public final String NAME_PROPERTY1 = "Name"; //$NON-NLS-1$
-
- /**
- * Constructor
- */
- public SystemTeamViewPropertySetNode(IPropertySetContainer parent, IPropertySet propertySet)
- {
- super();
- this.parent = parent;
- this.propertySet = propertySet;
- }
-
- /**
- * This is the method required by the IAdaptable interface.
- * Given an adapter class type, return an object castable to the type, or
- * null if this is not possible.
- */
- public Object getAdapter(Class adapterType)
- {
- return Platform.getAdapterManager().getAdapter(this, adapterType);
- }
-
- /**
- * Compare this node to another.
- */
- public boolean equals(Object o)
- {
- if (o instanceof SystemTeamViewPropertySetNode)
- {
- /*
- SystemTeamViewPropertySetNode other = (SystemTeamViewPropertySetNode)o;
- if ((ssf == other.getSubSystemConfiguration()) &&
- (parentCategory == other.getParentCategory()) &&
- (profile == other.getProfile()))
- return true;
- else
- return false;
- */
- return super.equals(o);
- }
- else
- return super.equals(o);
- }
-
- /**
- * Return this node's image
- * @return the image to show in the tree, for this node
- */
- public ImageDescriptor getImageDescriptor()
- {
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROPERTIES_ID);
- }
-
- public Object getParent()
- {
- return parent;
- }
-
- /**
- * Return this node's label
- * @return the translated label to show in the tree, for this node
- */
- public String getLabel()
- {
- String label = null;
- //First, check if this PropertySet has a property called "name"
- IProperty nameProperty = propertySet.getProperty(NAME_PROPERTY);
- if (null != nameProperty)
- {
- label = nameProperty.getValue();
- }
- else
- {
- label = propertySet.getName();
- }
- return label;
- }
-
- /**
- * Convert to string. We call getLabel()
- */
- public String toString()
- {
- return getLabel();
- }
-
-
-
- /**
- * @return PropertySet this node is associated with
- */
- public IPropertySet getPropertySet()
- {
- return propertySet;
- }
-
- /**
- * @return the untranslated value to store in the memento, to uniquely identify this node
- */
- public String getMementoHandle()
- {
- return mementoHandle;
- }
-
- /**
- * Set the untranslated value to store in the memento, to uniquely identify this node
- * @param string - untranslated value
- */
- public void setMementoHandle(String string)
- {
- mementoHandle = string;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewRefreshAllAction.java
deleted file mode 100644
index 72d5b74af..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewRefreshAllAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Michael Berger (IBM) - 146339 Added refresh action graphic.
- * David Dykstal (IBM) - [191130] use new getRemoteSystemsProject(boolean) method
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.SystemResourceManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseAction;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to refresh the entire System Team tree view
- */
-public class SystemTeamViewRefreshAllAction extends SystemBaseAction
- //
-{
- private SystemTeamViewPart teamView;
-
- /**
- * Constructor for SystemRefreshAllAction
- */
- public SystemTeamViewRefreshAllAction(Shell parent, SystemTeamViewPart teamView)
- {
- super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID),
- parent);
- this.teamView = teamView;
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
- setSelectionSensitive(false);
-
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0009"); //$NON-NLS-1$
- }
-
- /**
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- try {
- IProject connectionsProject = SystemResourceManager.getRemoteSystemsProject(false);
- if (connectionsProject.isAccessible()) {
- connectionsProject.refreshLocal(IResource.DEPTH_INFINITE, null);
- }
- } catch (Exception exc) {}
- SystemTeamView teamViewer = (SystemTeamView)teamView.getTreeViewer();
- teamViewer.refresh();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewResourceAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewResourceAdapterFactory.java
deleted file mode 100644
index 145c0be62..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewResourceAdapterFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [191130] fix unnecessary creation of the remote systems project
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.rse.core.SystemResourceManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-
-
-/**
- * Special adapter factory that maps Remote Systems Framework objects to underlying workbench resources
- */
-public class SystemTeamViewResourceAdapterFactory implements IAdapterFactory
-{
- /**
- * @see IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList()
- {
- return new Class[] {IResource.class};
- }
- /**
- * Called by our plugin's startup method to register our adaptable object types
- * with the platform. We prefer to do it here to isolate/encapsulate all factory
- * logic in this one place.
- */
- public void registerWithManager(IAdapterManager manager)
- {
- manager.registerAdapters(this, ISystemRegistry.class);
- //manager.registerAdapters(this, SystemProfile.class); DEFERRED UNTIL NEXT RELEASE
- }
- /**
- * @see IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType)
- {
- Object adapter = null;
- if (adaptableObject instanceof ISystemRegistry)
- {
- //SystemRegistry sr = (SystemRegistry)adaptableObject;
- // [191130] do not force the creation of the project, just return its handle
- adapter = SystemResourceManager.getRemoteSystemsProject(false);
- }
- /* deferred
- else if (adaptableObject instanceof SystemProfile)
- {
- SystemProfile profile = (SystemProfile)adaptableObject;
- adapter = SystemResourceManager.getProfileFolder(profile);
- }*/
- return adapter;
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationAdapter.java
deleted file mode 100644
index a83646c7d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationAdapter.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemFilterWorkWithFilterPoolsAction;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Adapter for displaying and processing SystemTeamViewSubSystemConfigurationNode objects in tree views, such as
- * the Team view.
- */
-public class SystemTeamViewSubSystemConfigurationAdapter
- extends AbstractSystemViewAdapter
-{
- private boolean actionsCreated = false;
- //private Hashtable categoriesByProfile = new Hashtable();
- private SystemFilterWorkWithFilterPoolsAction wwPoolsAction;
-
- // -------------------
- // property descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
-
- /**
- * Returns any actions that should be contributed to the popup menu
- * for the given element.
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell Shell of viewer
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- if (!actionsCreated)
- createActions();
-
- SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode)selection.getFirstElement();
- SystemTeamViewCategoryNode category = ssfNode.getParentCategory();
- String categoryType = category.getMementoHandle();
-
- if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS) && ssfNode.getSubSystemConfiguration().supportsFilters())
- {
- wwPoolsAction.reset();
- wwPoolsAction.setShell(shell);
- wwPoolsAction.setFilterPoolManagerProvider(ssfNode.getSubSystemConfiguration());
- ISystemFilterPoolManager[] poolMgrs = new ISystemFilterPoolManager[1];
- poolMgrs[0] = ssfNode.getSubSystemConfiguration().getFilterPoolManager(ssfNode.getProfile());
- wwPoolsAction.setFilterPoolManagers(poolMgrs);
- menu.add(menuGroup, wwPoolsAction);
- }
- }
- private void createActions()
- {
- actionsCreated = true;
-
-// FIXME - user actions and compile actions no longer coupled to core
-// wwActionsAction = new SystemWorkWithUDAsAction(null, true);
-// wwCmdsAction = new SystemWorkWithCompileCommandsAction(null, true);
- wwPoolsAction = new SystemFilterWorkWithFilterPoolsAction(null, false);
- }
-
- /**
- * Returns an image descriptor for the image. More efficient than getting the image.
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element)
- {
- return ((SystemTeamViewSubSystemConfigurationNode)element).getImageDescriptor();
- }
-
- /**
- * Return the label for this object
- */
- public String getText(Object element)
- {
- return ((SystemTeamViewSubSystemConfigurationNode)element).getLabel();
- }
-
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- * <p>
- * Called by common rename and delete actions.
- */
- public String getName(Object element)
- {
- return ((SystemTeamViewSubSystemConfigurationNode)element).getLabel();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier#getAbsoluteName(java.lang.Object)
- */
- public String getAbsoluteName(Object element)
- {
- SystemTeamViewSubSystemConfigurationNode factory = (SystemTeamViewSubSystemConfigurationNode)element;
- return factory.getProfile().getName() + "." + factory.getParentCategory().getLabel() + factory.getLabel(); //$NON-NLS-1$
- }
-
- /**
- * Return the type label for this object
- */
- public String getType(Object element)
- {
- return SystemViewResources.RESID_PROPERTY_TEAM_SSFACTORY_TYPE_VALUE;
- }
-
- /**
- * Return the string to display in the status line when the given object is selected.
- */
- public String getStatusLineText(Object element)
- {
- SystemTeamViewSubSystemConfigurationNode factory = (SystemTeamViewSubSystemConfigurationNode)element;
- return SystemResources.RESID_TEAMVIEW_SUBSYSFACTORY_VALUE + ": " + factory.getLabel(); //$NON-NLS-1$
- }
-
- /**
- * Return the parent of this object. We return the RemoteSystemsConnections project
- */
- public Object getParent(Object element)
- {
- SystemTeamViewSubSystemConfigurationNode factory = (SystemTeamViewSubSystemConfigurationNode)element;
- return factory.getParentCategory();
- }
-
- /**
- * Return the children of this profile.
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor)
- {
- SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode)element;
- SystemTeamViewCategoryNode category = ssfNode.getParentCategory();
- ISystemProfile profile = ssfNode.getProfile();
- String categoryType = category.getMementoHandle();
- ISubSystemConfiguration ssf = ssfNode.getSubSystemConfiguration();
- if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS))
- {
- return profile.getFilterPools(ssf);
- }
- else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_USERACTIONS))
- {
- /* FIXME
- SystemUDActionElement[] children = profile.getUserActions(ssf);
- for (int idx=0; idx<children.length; idx++)
- {
- children[idx].setData(ssfNode);
- }
- return children;
- */
- return null;
- }
- else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS))
- {
- /* FIXME
- SystemCompileType[] types = profile.getCompileCommandTypes(ssf);
- if (types != null)
- {
- SystemTeamViewCompileTypeNode[] typeNodes = new SystemTeamViewCompileTypeNode[types.length];
- for (int idx=0; idx<types.length; idx++)
- typeNodes[idx] = new SystemTeamViewCompileTypeNode(ssfNode, types[idx]);
- return typeNodes;
- }
- else
- */
- return null;
- }
- else
- return null;
- }
-
- /**
- * Return true if this profile has children. We return true.
- */
- public boolean hasChildren(IAdaptable element)
- {
- SystemTeamViewSubSystemConfigurationNode ssConfNode = (SystemTeamViewSubSystemConfigurationNode)element;
- SystemTeamViewCategoryNode category = ssConfNode.getParentCategory();
- //ISystemProfile profile = ssConfNode.getProfile();
- String categoryType = category.getMementoHandle();
- //ISubSystemConfiguration ssConf = ssConfNode.getSubSystemConfiguration();
- if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_FILTERPOOLS))
- return true;
- else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_USERACTIONS))
- {
- /* FIXME
- return (profile.getUserActions(ssConf).length > 0);
- */
- return false;
- }
- else if (categoryType.equals(SystemTeamViewCategoryNode.MEMENTO_COMPILECMDS))
- {
- /* FIXME
- return (profile.getCompileCommandTypes(ssConf).length > 0);
- */
- return false;
- }
- else
- return false;
- }
-
- // Property sheet descriptors defining all the properties we expose in the Property Sheet
- /**
- * Return our unique property descriptors, which getPropertyDescriptors adds to the common properties.
- */
- protected org.eclipse.ui.views.properties.IPropertyDescriptor[] internalGetPropertyDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- /*
- propertyDescriptorArray = new PropertyDescriptor[1];
- RSEUIPlugin plugin = RSEUIPlugin.getDefault();
- int idx = 0;
- // status
- propertyDescriptorArray[idx] = new PropertyDescriptor(ISystemPropertyConstants.P_IS_ACTIVE,
- SystemViewResources.RESID_PROPERTY_PROFILESTATUS_LABEL);
- propertyDescriptorArray[idx].setDescription(SystemViewResources.RESID_PROPERTY_PROFILESTATUS_DESCRIPTION));
- ++idx;
- */
- }
- return propertyDescriptorArray;
- }
-
- /**
- * Returns the current value for the named property.
- * The parent handles P_TEXT and P_TYPE only, and we augment that here.
- * @param key - the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- public Object internalGetPropertyValue(Object key)
- {
- /*
- if (name.equals(P_IS_ACTIVE))
- {
- boolean active = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().isSystemProfileActive(profile.getName());
- if (active)
- return SystemViewResources.RESID_PROPERTY_PROFILESTATUS_ACTIVE_LABEL);
- else
- return SystemViewResources.RESID_PROPERTY_PROFILESTATUS_NOTACTIVE_LABEL);
- }
- else
- */
- return null;
- }
-
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- */
- public String getMementoHandle(Object element)
- {
- SystemTeamViewSubSystemConfigurationNode factory = (SystemTeamViewSubSystemConfigurationNode)element;
- return factory.getMementoHandle();
- }
- /**
- * Return a short string to uniquely identify the type of resource.
- */
- public String getMementoHandleKey(Object element)
- {
- SystemTeamViewSubSystemConfigurationNode factory = (SystemTeamViewSubSystemConfigurationNode)element;
- return factory.getProfile().getName() + "." + factory.getParentCategory().getLabel() + "." + factory.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * This is a local RSE artifact so returning false
- *
- * @param element the object to check
- * @return false since this is not remote
- */
- public boolean isRemote(Object element) {
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java
deleted file mode 100644
index 3bd2f032a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
- ********************************************************************************/
-
-package org.eclipse.rse.internal.ui.view.team;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapter;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-
-
-/**
- * This class represents a child node under category nodes, in the Team view.
- * It represents expandable subsystem factories such as "Files" or "iSeries Objects".
- */
-public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable
-{
- private String mementoHandle;
- private ISystemProfile profile;
- private ISubSystemConfiguration ssf;
- private SystemTeamViewCategoryNode parentCategory;
- private String name = null;
-
- /**
- * Constructor
- */
- public SystemTeamViewSubSystemConfigurationNode(ISystemProfile profile, SystemTeamViewCategoryNode parentCategory, ISubSystemConfiguration ssf)
- {
- super();
- this.profile = profile;
- this.ssf = ssf;
- this.parentCategory = parentCategory;
- }
-
- /**
- * This is the method required by the IAdaptable interface.
- * Given an adapter class type, return an object castable to the type, or
- * null if this is not possible.
- */
- public Object getAdapter(Class adapterType)
- {
- return Platform.getAdapterManager().getAdapter(this, adapterType);
- }
-
- /**
- * Compare this node to another.
- */
- public boolean equals(Object o)
- {
- if (o instanceof SystemTeamViewSubSystemConfigurationNode)
- {
- SystemTeamViewSubSystemConfigurationNode other = (SystemTeamViewSubSystemConfigurationNode)o;
- if ((ssf == other.getSubSystemConfiguration()) &&
- (parentCategory == other.getParentCategory()) &&
- (profile == other.getProfile()))
- return true;
- else
- return false;
- }
- else
- return super.equals(o);
- }
-
- /**
- * Return this node's image
- * @return the image to show in the tree, for this node
- */
- public ImageDescriptor getImageDescriptor()
- {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter != null) {
- return adapter.getImage(ssf);
- } else {
- // Fall back to using the Proxy -- see also
- // SystemViewSubSystemAdapter.getImageDescriptor()
- ISubSystemConfigurationProxy proxy = ssf.getSubSystemConfigurationProxy();
- SubSystemConfigurationProxyAdapter proxyAdapter = (SubSystemConfigurationProxyAdapter) Platform.getAdapterManager().getAdapter(proxy,
- SubSystemConfigurationProxyAdapter.class);
- if (proxyAdapter != null) {
- return proxyAdapter.getImageDescriptor();
- } else {
- SystemBasePlugin.logWarning("Unexpected error: SubSystemConfiguration has no adapter and no proxyAdapter: " + ssf.getId()); //$NON-NLS-1$
- return null;
- }
- }
- }
-
- /**
- * Return this node's label
- * @return the translated label to show in the tree, for this node
- */
- public String getLabel()
- {
- if (name == null)
- {
- StringBuffer buf = new StringBuffer();
- buf.append(ssf.getName());
- buf.append(" ("); //$NON-NLS-1$
- if (ssf.getSubSystemConfigurationProxy().supportsAllSystemTypes())
- {
- buf.append(SystemResources.TERM_ALL);
- }
- else
- {
- IRSESystemType[] types = ssf.getSystemTypes();
- for (int idx=0; idx<types.length; idx++)
- {
- if (idx>0) buf.append(", "); //$NON-NLS-1$
- buf.append(types[idx].getLabel());
- }
- }
- buf.append(")"); //$NON-NLS-1$
- name = buf.toString();
- }
- return name;
- }
-
- /**
- * Convert to string. We call getLabel()
- */
- public String toString()
- {
- return getLabel();
- }
-
- /**
- * @return profile this category is associated with
- */
- public ISystemProfile getProfile()
- {
- return profile;
- }
-
- /**
- * @param profile ... the profile this category is associated with
- */
- public void setProfile(ISystemProfile profile)
- {
- this.profile = profile;
- }
-
- /**
- * @return the untranslated value to store in the memento, to uniquely identify this node
- */
- public String getMementoHandle()
- {
- return mementoHandle;
- }
-
- /**
- * Set the untranslated value to store in the memento, to uniquely identify this node
- * @param string - untranslated value
- */
- public void setMementoHandle(String string)
- {
- mementoHandle = string;
- }
-
- /**
- * Return the subsystem factory this node represents
- */
- public ISubSystemConfiguration getSubSystemConfiguration()
- {
- return ssf;
- }
-
- /**
- * Set the subsystem factory this node represents
- */
- public void setSubSystemConfiguration(ISubSystemConfiguration factory)
- {
- ssf = factory;
- }
-
- /**
- * Return the parent category this is a child of.
- */
- public SystemTeamViewCategoryNode getParentCategory()
- {
- return parentCategory;
- }
-
- /**
- * Set the parent category this is a child of.
- */
- public void setParentCategory(SystemTeamViewCategoryNode node)
- {
- parentCategory = node;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/SSLForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/SSLForm.java
deleted file mode 100644
index b5a7f6d5d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/SSLForm.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.internal.ui.widgets;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-
-
-/**
- * This class provides a reusable widget for selecting whether or not
- * a communications connection should use SSL
- */
-public class SSLForm extends SystemBaseForm {
-
-
- private Button _sslCheckBox;
- private Button _nonsslCheckBox;
-
- /**
- * Constructor for SSLForm.
- * @param msgLine
- */
- public SSLForm(ISystemMessageLine msgLine) {
- super(null, msgLine); // null is the shell.
- }
-
- /**
- * Determines whether ssl is checked or not
- * @return whether ssl alert is checked
- */
- public boolean isSSLAlertChecked()
-
- {
- return _sslCheckBox.getSelection();
- }
-
- /**
- * Check/uncheck the ssl checkbox
- * @param flag
- */
- public void setSSLALertIsChecked(boolean flag)
-
- {
- _sslCheckBox.setSelection(flag);
- }
-
- /**
- * Determines whether non-ssl is checked or not
- * @return whether non ssl alert is checked
- */
- public boolean isNonSSLAlertChecked()
- {
- return _nonsslCheckBox.getSelection();
- }
-
-
- /**
- * Check/uncheck the ssl checkbox
- * @param flag
- */
- public void setNonSSLALertIsChecked(boolean flag)
- {
- _nonsslCheckBox.setSelection(flag);
- }
-
- /**
- * Enable/disable the ssl checkbox
- * @param flag
- */
- public void enableCheckBoxes(boolean flag)
-
- {
- _sslCheckBox.setEnabled(flag);
- _nonsslCheckBox.setEnabled(flag);
- }
-
- /**
- * @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite)
- */
- public Control createContents(Composite parent)
- {
- super.setShell(parent.getShell());
- _sslCheckBox = SystemWidgetHelpers.createCheckBox(parent, SystemResources.RESID_SUBSYSTEM_SSL_ALERT_LABEL, this);
- _sslCheckBox.setToolTipText(SystemResources.RESID_SUBSYSTEM_SSL_ALERT_TIP);
- _nonsslCheckBox = SystemWidgetHelpers.createCheckBox(parent, SystemResources.RESID_SUBSYSTEM_NONSSL_ALERT_LABEL, this);
- _nonsslCheckBox.setToolTipText(SystemResources.RESID_SUBSYSTEM_NONSSL_ALERT_TIP);
- return parent;
- }
-
-
-
- public void handleEvent(Event evt)
- {
-
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/ServerConnectionSecurityForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/ServerConnectionSecurityForm.java
deleted file mode 100644
index e144ad588..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/widgets/ServerConnectionSecurityForm.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-
-package org.eclipse.rse.internal.ui.widgets;
-
-
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class ServerConnectionSecurityForm extends SystemBaseForm
-{
-
-
-
- private SSLForm _sslForm;
-
- private ISystemMessageLine _msgLine;
-
- public ServerConnectionSecurityForm(Shell shell, ISystemMessageLine msgLine)
- {
- super(shell, msgLine);
- _msgLine = msgLine;
- }
-
- public void disable()
- {
- _sslForm.enableCheckBoxes(false);
- }
-
- public void enable()
- {
- _sslForm.enableCheckBoxes(true);
- }
-
- /**
- * @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite)
- */
- public Control createContents(Composite parent)
- {
-
- _sslForm = new SSLForm(_msgLine);
- _sslForm.createContents(parent);
-
- // help
-
- // initialization
- initDefaults();
- return parent;
- }
-
- private void initDefaults()
- {
- // pull info from preferences and/or persistence model
-
- }
-
- public void setAlertSSL(boolean flag)
- {
- _sslForm.setSSLALertIsChecked(flag);
- }
-
- public boolean getAlertSSL()
- {
- return _sslForm.isSSLAlertChecked();
- }
-
- public void setAlertNonSSL(boolean flag)
- {
- _sslForm.setNonSSLALertIsChecked(flag);
- }
-
- public boolean getAlertNonSSL()
- {
- return _sslForm.isNonSSLAlertChecked();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRSEAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRSEAdapter.java
deleted file mode 100644
index 3b58a954a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRSEAdapter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-package org.eclipse.rse.ui;
-
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter2;
-
-/**
- * Base interface for all RSE adapters.
- */
-public interface IRSEAdapter extends IWorkbenchAdapter, IWorkbenchAdapter2 {
-
- /**
- * Returns the description text for this element. This is typically used to show the description of an object
- * when displayed in the UI. Returns an empty string if there is no appropriate description text for this object.
- * @param o the object to get the description text for
- * @return the description text for the given object
- */
- public String getDescription(Object o);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRemoteSelectionAddListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRemoteSelectionAddListener.java
deleted file mode 100644
index c608ca516..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/IRemoteSelectionAddListener.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-import org.eclipse.rse.core.model.IHost;
-
-/**
- * <p>
- * This interface is used by the remote object selection dialogs when Add mode is enabled.
- * <p>
- * This interface allows you to listen generically for selection events on any remote object,
- * and be called when the user selects something or presses. You can use instanceof to
- * decide what was selected.
- * <p>
- * If you call the enableAddButton method you must pass an object that implements this interface.
- * The dialog will call you back when the user presses the Add button, so you can take
- * appropriate action.
- */
-public interface IRemoteSelectionAddListener
-{
-
-
- /**
- * The user has selected a remote object. Is this object valid to be added?
- * If so, return null. If not, return a string to display on the
- * message line indicating why it is not valid, such as it already has
- * been added.
- *
- * @param selectedConnection The connection the object was selected in
- * @param selectedObjects Will be a list of objects such as AS400Library or IRemoteFile. They are
- * resolved so that the remote adapter is not required.
- *
- * @return A String or SystemMessage object that will be displayed if the
- * action fails, null if the action was successfull
- */
- public Object okToEnableAddButton(IHost selectedConnection, Object[] selectedObjects);
-
- /**
- * The user has pressed the Add button.
- * Do something appropriate with the request.
- * If this action fails for some reason, or you wish to display a completion
- * message, return message text that will be displayed in the dialog's message
- * line. Else, return null.
- *
- * @param selectedConnection The connection the object was selected in
- * @param selectedObjects Will be a list of objects such as AS400Library or IRemoteFile. They are
- * resolved so that the remote adapter is not required.
- *
- * @return A String or SystemMessage object that will be displayed if the
- * action fails, null if the action was successfull
- */
- public Object addButtonPressed(IHost selectedConnection, Object[] selectedObjects);
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java
deleted file mode 100644
index 0f10a2488..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Interface that any UI that uses the SystemConnectionForm must implement
- */
-public interface ISystemConnectionFormCaller {
-
- /**
- * Event: the user has selected a system type.
- *
- * @param systemType the type of system selected
- * @param duringInitialization true if this is being set at page initialization time versus selected by the user
- */
- public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization);
-
- /**
- * Return the shell hosting this form
- */
- public Shell getShell();
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java
deleted file mode 100644
index 09ede41aa..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemContextMenuConstants.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-import org.eclipse.ui.IWorkbenchActionConstants;
-/**
- * Constants defining our groups inside our right-click popup menu in the system view.
- * <pre><code>
- * // simply sets partitions in the menu, into which actions can be directed.
- * // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW)); // new->
- * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO)); // goto into, go->
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO)); // expand to->
- * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND)); // expand, collapse
- * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN)); // open xxx
- * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH)); // open with->
- * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH)); // open with->
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH)); // work with->
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD)); // build, rebuild, refresh
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE)); // update, change
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); // rename,move,copy,delete,bookmark,refactoring
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); // move up, move down
- * menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE)); // getters/setters, etc. Typically in editor
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH)); // search
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION)); // connection-related actions
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT)); // get or put actions
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS)); // actions queried from adapters
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM)); // Team
- * menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES)); // Properties
- * </code></pre>
- */
-public interface ISystemContextMenuConstants
-{
- /**
- * Pop-up menu: name of group for goto actions (value <code>"group.goto"</code>).
- * <p>
- * Examples for open actions are:
- * <ul>
- * <li>Go Into</li>
- * <li>Go To</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_GOTO= "group.goto"; //$NON-NLS-1$
- /**
- * ID of the submenu for "Go To->"
- */
- public static final String MENU_GOTO= "menu.goto"; //$NON-NLS-1$
- /**
- * ID of the submenu for "Preferences->"
- */
- public static final String MENU_PREFERENCES= "menu.preferences"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for open-with actions (value <code>"group.openwith"</code>).
- * <p>
- * Examples for open-with actions are:
- * <ul>
- * <li>Open With->Editor</li>
- * <li>Open With->Designer</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_OPENWITH= "group.openwith"; //$NON-NLS-1$
- /**
- * ID of the submenu for "Open With->"
- */
- public static final String MENU_OPENWITH= "menu.openwith"; //$NON-NLS-1$
-
- /**
- * Group name for the "Browse With" submenu
- */
- public static final String GROUP_BROWSEWITH= "group.browsewith"; //$NON-NLS-1$
-
- /**
- * Group name for the "Compare With" submenu
- */
- public static final String GROUP_COMPAREWITH= "group.comparewith"; //$NON-NLS-1$
-
- /**
- * Group name for the "Replace With" submenu
- */
- public static final String GROUP_REPLACEWITH= "group.replacewith"; //$NON-NLS-1$
-
- /**
- * ID for "Browse With" submenu
- */
- public static final String MENU_BROWSEWITH = "menu.browsewith"; //$NON-NLS-1$
-
- /**
- * ID for "Compare With" submenu
- */
- public static final String MENU_COMPAREWITH = "menu.comparewith"; //$NON-NLS-1$
-
- /**
- * ID for "Compare With" submenu
- */
- public static final String MENU_REPLACEWITH = "menu.replacewith"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for expand actions (value <code>"group.expand"</code>).
- */
- public static final String GROUP_EXPAND = "group.expand"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for expand-to cascading actions (value <code>"group.expandto"</code>).
- */
- public static final String GROUP_EXPANDTO= "group.expandto"; //$NON-NLS-1$
- /**
- * ID of the submenu for "Expand to->"
- */
- public static final String MENU_EXPANDTO= "menu.expandto"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for open-to actions (value <code>"group.opento"</code>).
- * <p>
- * Examples for open-to actions are:
- * <ul>
- * <li>Open To->Navigator</li>
- * <li>Open To->iSeries Navigator</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_OPENTO= "group.opento"; //$NON-NLS-1$
- /**
- * ID of the submenu for "Open To->"
- */
- public static final String MENU_OPENTO= "menu.opento"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for work-with actions (value <code>"group.workwith"</code>).
- * <p>
- * Examples for work-with actions are:
- * <ul>
- * <li>Work with->Filter Pools...</li>
- * <li>Work with->User Actions...</li>
- * <li>Work with->File Types...</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_WORKWITH= "group.workwith"; //$NON-NLS-1$
- /**
- * ID of the submenu for "Work Work->"
- */
- public static final String MENU_WORKWITH= "menu.workwith"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for open actions (value <code>"group.open"</code>).
- * <p>
- * Examples for open actions are:
- * <ul>
- * <li>Open To</li>
- * <li>Open With</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_OPEN= "group.open"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for show actions (value <code>"group.show"</code>).
- * <p>
- * Examples for show actions are:
- * <ul>
- * <li>Show in Navigator</li>
- * <li>Show in Type Hierarchy</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_SHOW= "group.show"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for new actions (value <code>"group.new"</code>).
- * This is a cascading group.
- * <p>
- * Examples for new actions are:
- * <ul>
- * <li>Create new filter</li>
- * <li>Create new folder</li>
- * </ul>
- * </p>
- */
- public static final String GROUP_NEW= "group.new"; //$NON-NLS-1$
- /**
- * ID of the submenu for "New->"
- */
- public static final String MENU_NEW= "menu.new"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for new actions (value <code>"group.new.noncascade"</code>).
- * This is a non-cascading group.
- * <p>
- * This is used in the Team view
- * </p>
- */
- public static final String GROUP_NEW_NONCASCADING="group.new.noncascade"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for build actions (value <code>"group.build"</code>).
- */
- public static final String GROUP_BUILD= "group.build"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for reorganize actions (value <code>"group.reorganize"</code>).
- */
- public static final String GROUP_REORGANIZE= "group.reorganize"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for reorder actions like move up/down(value <code>"group.reorder"</code>).
- */
- public static final String GROUP_REORDER= "group.reorder"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for CHANGE actions. (value <code>"group.change"</code>).
- * <p>
- * Examples for change actions are:
- * <ul>
- * <li>Change...</li>
- * <li>Update...</li>
- * </ul>
- * SHould you even have a change action? Maybe it should be a PropertyPage instead!
- * </p>
- */
- public static final String GROUP_CHANGE = "group.change"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for code generation or refactoring actions (
- * value <code>"group.generate"</code>).
- */
- public static final String GROUP_GENERATE= "group.generate"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for search actions (value <code>"group.search"</code>).
- */
- public static final String GROUP_SEARCH= "group.search"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for additional actions (value <code>"group.additions"</code>).
- */
- public static final String GROUP_ADDITIONS= IWorkbenchActionConstants.MB_ADDITIONS; //"additions";
-
- /**
- * Pop-up menu: name of group for viewer setup actions (value <code>"group.viewerSetup"</code>).
- */
- public static final String GROUP_VIEWER_SETUP= "group.viewerSetup"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for properties actions (value <code>"group.properties"</code>).
- */
- public static final String GROUP_PROPERTIES= "group.properties"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for actions contributed by the adaptors for the selected object, which
- * are related to the live connection.
- */
- public static final String GROUP_CONNECTION= "group.connection"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for actions related to getting and putting the selected object.
- */
- public static final String GROUP_IMPORTEXPORT= "group.importexport"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for actions contributed by the adaptors for the selected object
- */
- public static final String GROUP_ADAPTERS= "group.adapters"; //$NON-NLS-1$
- /**
- * Pop-up menu: name of group for team actions
- */
- public static final String GROUP_TEAM= "group.team"; //$NON-NLS-1$
-
-
- /**
- * ID of the submenu for "Compile->"
- */
- public static final String MENU_COMPILE= "menu.compile"; //$NON-NLS-1$
- /**
- * ID of the submenu for "User Actions->"
- */
- public static final String MENU_USERACTIONS= "menu.useractions"; //$NON-NLS-1$
-
- /**
- * Group for "Start Server->"
- */
- public static final String GROUP_STARTSERVER= "group.remoteservers"; //$NON-NLS-1$
- /**
- * ID of the submenu for "Start Server->"
- */
- public static final String MENU_STARTSERVER= "menu.remoteservers"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java
deleted file mode 100644
index fa90538d5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemDeleteTarget.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-
-/**
- * Any UI part that supports global deletion can implement
- * this to enable the Edit menu's delete item.
- */
-public interface ISystemDeleteTarget extends ISelectionProvider
-{
- /**
- * Return true if delete should even be shown in the popup menu
- */
- public boolean showDelete();
- /**
- * Return true if delete should be enabled based on your current selection.
- */
- public boolean canDelete();
- /**
- * Actually do the delete of currently selected items.
- * Return true if it worked. Return false if it didn't (you display msg), or throw an exception (framework displays msg)
- */
- public boolean doDelete(IProgressMonitor monitor);
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java
deleted file mode 100644
index 9dd6314ac..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemIconConstants.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Michael Berger (IBM) - 146339 Added refresh action graphic.
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
- * David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
- * API to the user actions plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-
-/**
- * Constants used throughout the System plugin.
- */
-public interface ISystemIconConstants
-{
- public static final String PLUGIN_ID ="org.eclipse.rse.ui"; //$NON-NLS-1$
- public static final String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Icons
- public static final String ICON_SUFFIX = "Icon"; //$NON-NLS-1$
- public static final String ICON_BANNER_SUFFIX = "BannerIcon"; //$NON-NLS-1$
- public static final String ICON_EXT = ".gif"; //$NON-NLS-1$
-
- // WIZARD ICONS...
- public static final String ICON_WIZARD_DIR = "full/wizban/"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWPROFILEWIZARD_ROOT = "newprofile_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWPROFILEWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWPROFILEWIZARD_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_NEWPROFILEWIZARD_ID = PREFIX + ICON_SYSTEM_NEWPROFILEWIZARD_ROOT + ICON_BANNER_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWCONNECTIONWIZARD_ROOT = "newconnection_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWCONNECTIONWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWCONNECTIONWIZARD_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_NEWCONNECTIONWIZARD_ID = PREFIX + ICON_SYSTEM_NEWCONNECTIONWIZARD_ROOT + ICON_BANNER_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFILTERWIZARD_ROOT = "newfilter_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFILTERWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFILTERWIZARD_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_NEWFILTERWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFILTERWIZARD_ROOT + ICON_BANNER_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFILTERPOOLWIZARD_ROOT = "newfilterpool_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFILTERPOOLWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFILTERPOOLWIZARD_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_NEWFILTERPOOLWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFILTERPOOLWIZARD_ROOT + ICON_BANNER_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFILEWIZARD_ROOT = "newfile_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFILEWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFILEWIZARD_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_NEWFILEWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFILEWIZARD_ROOT + ICON_BANNER_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFOLDERWIZARD_ROOT = "newfolder_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFOLDERWIZARD = ICON_WIZARD_DIR + ICON_SYSTEM_NEWFOLDERWIZARD_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_NEWFOLDERWIZARD_ID = PREFIX + ICON_SYSTEM_NEWFOLDERWIZARD_ROOT + ICON_BANNER_SUFFIX;
-
-
- // THING ICONS...
- public static final String ICON_MODEL_DIR = "full/obj16/"; //$NON-NLS-1$
-
- public static final String ICON_SYSTEM_PROFILE_ROOT = "systemprofile"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_PROFILE = ICON_MODEL_DIR + ICON_SYSTEM_PROFILE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_PROFILE_ID = PREFIX+ICON_SYSTEM_PROFILE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_PROFILE_ACTIVE_ROOT = "systemprofile_active"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_PROFILE_ACTIVE = ICON_MODEL_DIR + ICON_SYSTEM_PROFILE_ACTIVE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_PROFILE_ACTIVE_ID = PREFIX+ICON_SYSTEM_PROFILE_ACTIVE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_CONNECTION_ROOT = "systemconnection"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_CONNECTION = ICON_MODEL_DIR + ICON_SYSTEM_CONNECTION_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_CONNECTION_ID = PREFIX+ICON_SYSTEM_CONNECTION_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_CONNECTIONLIVE_ROOT = "systemconnectionlive"; // not currently used //$NON-NLS-1$
- public static final String ICON_SYSTEM_CONNECTIONLIVE = ICON_MODEL_DIR + ICON_SYSTEM_CONNECTIONLIVE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_CONNECTIONLIVE_ID = PREFIX+ICON_SYSTEM_CONNECTIONLIVE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_FILTERPOOL_ROOT = "systemfilterpool"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_FILTERPOOL = ICON_MODEL_DIR + ICON_SYSTEM_FILTERPOOL_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_FILTERPOOL_ID = PREFIX+ICON_SYSTEM_FILTERPOOL_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_FILTER_ROOT = "systemfilter"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_FILTER_ID = PREFIX + ICON_SYSTEM_FILTER_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_FILTER = ICON_MODEL_DIR + ICON_SYSTEM_FILTER_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_FILTERSTRING_ROOT = "systemfilterstring"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_FILTERSTRING_ID = PREFIX + ICON_SYSTEM_FILTERSTRING_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_FILTERSTRING = ICON_MODEL_DIR + ICON_SYSTEM_FILTERSTRING_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_ROOTDRIVE_ROOT = "systemrootdrive"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_ROOTDRIVE = ICON_MODEL_DIR + ICON_SYSTEM_ROOTDRIVE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_ROOTDRIVE_ID = PREFIX+ICON_SYSTEM_ROOTDRIVE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_ROOTDRIVEOPEN_ROOT = "systemrootdriveopen"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_ROOTDRIVEOPEN = ICON_MODEL_DIR + ICON_SYSTEM_ROOTDRIVEOPEN_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_ROOTDRIVEOPEN_ID = PREFIX+ICON_SYSTEM_ROOTDRIVEOPEN_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_FOLDER_ROOT = "systemfolder"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_FOLDER = ICON_MODEL_DIR + ICON_SYSTEM_FOLDER_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_FOLDER_ID = PREFIX+ICON_SYSTEM_FOLDER_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_PROCESS_ROOT = "systemprocess"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_PROCESS = ICON_MODEL_DIR + ICON_SYSTEM_PROCESS_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_PROCESS_ID = PREFIX+ICON_SYSTEM_PROCESS+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_TARGET_ROOT = "systemTarget"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_TARGET = ICON_MODEL_DIR + ICON_SYSTEM_TARGET_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_TARGET_ID = PREFIX+ICON_SYSTEM_TARGET_ROOT+ICON_SUFFIX;
-
- // NEW ACTION ICONS...
- public static final String ICON_NEWACTIONS_DIR = "full/ctool16/"; //$NON-NLS-1$
-
- public static final String ICON_SYSTEM_NEW_ROOT = "new"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEW = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEW_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEW_ID = PREFIX+ICON_SYSTEM_NEW_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWPROFILE_ROOT = "newprofile_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWPROFILE = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWPROFILE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEWPROFILE_ID = PREFIX+ICON_SYSTEM_NEWPROFILE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWCONNECTION_ROOT = "newconnection_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWCONNECTION = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWCONNECTION_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEWCONNECTION_ID = PREFIX+ICON_SYSTEM_NEWCONNECTION_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFILTERPOOL_ROOT = "newfilterpool_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFILTERPOOL = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILTERPOOL_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEWFILTERPOOL_ID = PREFIX+ICON_SYSTEM_NEWFILTERPOOL_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFILTERPOOLREF_ROOT = "newfilterpoolref_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFILTERPOOLREF = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILTERPOOLREF_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEWFILTERPOOLREF_ID = PREFIX+ICON_SYSTEM_NEWFILTERPOOLREF_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFILTER_ROOT = "newfilter_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFILTER = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILTER_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEWFILTER_ID = PREFIX+ICON_SYSTEM_NEWFILTER_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFILE_ROOT = "newfile_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFILE = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFILE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEWFILE_ID = PREFIX+ICON_SYSTEM_NEWFILE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_NEWFOLDER_ROOT = "newfolder_wiz"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_NEWFOLDER = ICON_NEWACTIONS_DIR + ICON_SYSTEM_NEWFOLDER_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_NEWFOLDER_ID = PREFIX+ICON_SYSTEM_NEWFOLDER_ROOT+ICON_SUFFIX;
-
-
- // OTHER ACTION ICONS...
- public static final String ICON_ACTIONS_DIR = "full/elcl16/"; //$NON-NLS-1$
-
- public static final String ICON_SYSTEM_LOCK_ROOT = "lock"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_LOCK = ICON_ACTIONS_DIR + ICON_SYSTEM_LOCK_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_LOCK_ID = PREFIX+ICON_SYSTEM_LOCK_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_MOVEUP_ROOT = "up"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_MOVEUP = ICON_ACTIONS_DIR + ICON_SYSTEM_MOVEUP_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_MOVEUP_ID = PREFIX+ICON_SYSTEM_MOVEUP_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_MOVEDOWN_ROOT = "down"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_MOVEDOWN = ICON_ACTIONS_DIR + ICON_SYSTEM_MOVEDOWN_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_MOVEDOWN_ID = PREFIX+ICON_SYSTEM_MOVEDOWN_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_MOVE_ROOT = "move"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_MOVE = ICON_ACTIONS_DIR + ICON_SYSTEM_MOVE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_MOVE_ID = PREFIX+ICON_SYSTEM_MOVE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_CLEAR_ROOT = "clear"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_CLEAR = ICON_ACTIONS_DIR + ICON_SYSTEM_CLEAR_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_CLEAR_ID = PREFIX+ICON_SYSTEM_CLEAR_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_CLEAR_ALL_ROOT = "clearall"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_CLEAR_ALL = ICON_ACTIONS_DIR + ICON_SYSTEM_CLEAR_ALL_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_CLEAR_ALL_ID = PREFIX+ICON_SYSTEM_CLEAR_ALL_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_CLEAR_SELECTED_ROOT = "clearselected"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_CLEAR_SELECTED = ICON_ACTIONS_DIR + ICON_SYSTEM_CLEAR_SELECTED_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_CLEAR_SELECTED_ID = PREFIX+ICON_SYSTEM_CLEAR_SELECTED_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_DELETEREF_ROOT = "deletereference"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_DELETEREF = ICON_ACTIONS_DIR + ICON_SYSTEM_DELETEREF_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_DELETEREF_ID = PREFIX+ICON_SYSTEM_DELETEREF_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_RUN_ROOT = "run"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_RUN = ICON_ACTIONS_DIR + ICON_SYSTEM_RUN_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_RUN_ID = PREFIX+ICON_SYSTEM_RUN_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_STOP_ROOT = "stop"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_STOP = ICON_ACTIONS_DIR + ICON_SYSTEM_STOP_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_STOP_ID = PREFIX+ICON_SYSTEM_STOP_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_RENAME_ROOT = "rename"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_RENAME = ICON_ACTIONS_DIR + ICON_SYSTEM_RENAME_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_RENAME_ID = PREFIX+ICON_SYSTEM_RENAME_ROOT+ICON_SUFFIX;
-
- public static final String ICON_IDE_REFRESH_ID = "elcl16/refresh_nav.gif"; //$NON-NLS-1$
- public static final String ICON_IDE_COLLAPSEALL_ID = "elcl16/collapseall.gif"; //$NON-NLS-1$
- public static final String ICON_IDE_LINKTOEDITOR_ID = "elcl16/synced.gif"; //$NON-NLS-1$
- public static final String ICON_IDE_FILTER_ID = "elcl16/filter_ps.gif"; //$NON-NLS-1$
-
- public static final String ICON_SYSTEM_MAKEPROFILEACTIVE_ROOT = "makeprofileactive"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_MAKEPROFILEACTIVE = ICON_ACTIONS_DIR + ICON_SYSTEM_MAKEPROFILEACTIVE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_MAKEPROFILEACTIVE_ID = PREFIX+ICON_SYSTEM_MAKEPROFILEACTIVE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_MAKEPROFILEINACTIVE_ROOT = "makeprofileinactive"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_MAKEPROFILEINACTIVE = ICON_ACTIONS_DIR + ICON_SYSTEM_MAKEPROFILEINACTIVE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_MAKEPROFILEINACTIVE_ID = PREFIX+ICON_SYSTEM_MAKEPROFILEINACTIVE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_CHANGEFILTER_ROOT = "editfilter"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_CHANGEFILTER = ICON_ACTIONS_DIR + ICON_SYSTEM_CHANGEFILTER_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_CHANGEFILTER_ID = PREFIX+ICON_SYSTEM_CHANGEFILTER_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_SELECTPROFILE_ROOT = "selectprofile"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SELECTPROFILE = ICON_ACTIONS_DIR + ICON_SYSTEM_SELECTPROFILE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_SELECTPROFILE_ID = PREFIX+ICON_SYSTEM_SELECTPROFILE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_SELECTFILTERPOOLS_ROOT = "selectpool"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SELECTFILTERPOOLS = ICON_ACTIONS_DIR + ICON_SYSTEM_SELECTFILTERPOOLS_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_SELECTFILTERPOOLS_ID = PREFIX+ICON_SYSTEM_SELECTFILTERPOOLS_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT = "workwithfilterpools"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS = ICON_ACTIONS_DIR + ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_WORKWITHFILTERPOOLS_ID = PREFIX+ICON_SYSTEM_WORKWITHFILTERPOOLS_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_SHOW_TABLE_ROOT = "systemshowintable"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SHOW_TABLE = ICON_ACTIONS_DIR + ICON_SYSTEM_SHOW_TABLE_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_SHOW_TABLE_ID = PREFIX + ICON_SYSTEM_SHOW_TABLE_ROOT + ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_SHOW_MONITOR_ROOT = "monitor_view"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SHOW_MONITOR = ICON_ACTIONS_DIR + ICON_SYSTEM_SHOW_MONITOR_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_SHOW_MONITOR_ID = PREFIX + ICON_SYSTEM_SHOW_MONITOR_ROOT + ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_SHOW_SHELL_ROOT = "systemshell"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SHOW_SHELL = ICON_ACTIONS_DIR + ICON_SYSTEM_SHOW_SHELL_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_SHOW_SHELL_ID = PREFIX + ICON_SYSTEM_SHOW_SHELL_ROOT + ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_REFRESH_ROOT = "refresh_nav"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_REFRESH = ICON_ACTIONS_DIR + ICON_SYSTEM_REFRESH_ROOT + ICON_EXT;
- public static final String ICON_SYSTEM_REFRESH_ID = PREFIX + ICON_SYSTEM_REFRESH_ROOT + ICON_SUFFIX;
-
- // SPECIAL MODEL OBJECT ICONS...
- public static final String ICON_OBJS_DIR = "full/obj16/"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_ERROR_ROOT = "error"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_ERROR_ID = PREFIX + ICON_SYSTEM_ERROR_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_ERROR = ICON_OBJS_DIR + ICON_SYSTEM_ERROR_ROOT + ICON_EXT;
-
- // info is to be used in dialogs
- public static final String ICON_SYSTEM_INFO_ROOT = "info"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_INFO_ID = PREFIX + ICON_SYSTEM_INFO_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_INFO = ICON_OBJS_DIR + ICON_SYSTEM_INFO_ROOT + ICON_EXT;
-
- // systeminfo is to be used in tree view
- public static final String ICON_SYSTEM_INFO_TREE_ROOT = "systeminfo"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_INFO_TREE_ID = PREFIX + ICON_SYSTEM_INFO_TREE_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_INFO_TREE = ICON_OBJS_DIR + ICON_SYSTEM_INFO_TREE_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_HELP_ROOT = "systemhelp"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_HELP_ID = PREFIX + ICON_SYSTEM_HELP_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_HELP = ICON_OBJS_DIR + ICON_SYSTEM_HELP_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_CANCEL_ROOT = "systemcancel"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_CANCEL_ID = PREFIX + ICON_SYSTEM_CANCEL_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_CANCEL = ICON_OBJS_DIR + ICON_SYSTEM_CANCEL_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_EMPTY_ROOT = "systemempty"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_EMPTY_ID = PREFIX + ICON_SYSTEM_EMPTY_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_EMPTY = ICON_OBJS_DIR + ICON_SYSTEM_EMPTY_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_OK_ROOT = "systemok"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_OK_ID = PREFIX + ICON_SYSTEM_OK_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_OK = ICON_OBJS_DIR + ICON_SYSTEM_OK_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_WARNING_ROOT = "warning"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_WARNING_ID = PREFIX + ICON_SYSTEM_WARNING_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_WARNING = ICON_OBJS_DIR + ICON_SYSTEM_WARNING_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_BLANK_ROOT = "systemblank"; // not used yet //$NON-NLS-1$
- public static final String ICON_SYSTEM_BLANK_ID = PREFIX + ICON_SYSTEM_BLANK_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_BLANK = ICON_OBJS_DIR + ICON_SYSTEM_BLANK_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_SEARCH_ROOT = "system_search"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SEARCH_ID = PREFIX + ICON_SYSTEM_SEARCH_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_SEARCH = ICON_OBJS_DIR + ICON_SYSTEM_SEARCH_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_SEARCH_RESULT_ROOT = "systemsearchresult"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SEARCH_RESULT_ID = PREFIX + ICON_SYSTEM_SEARCH_RESULT_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_SEARCH_RESULT = ICON_OBJS_DIR + ICON_SYSTEM_SEARCH_RESULT_ROOT + ICON_EXT;
-
- public static final String ICON_SYSTEM_PERSPECTIVE_ROOT ="system_persp"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_PERSPECTIVE_ID = PREFIX + ICON_SYSTEM_PERSPECTIVE_ROOT + ICON_SUFFIX;
- public static final String ICON_SYSTEM_PERSPECTIVE = ICON_OBJS_DIR + ICON_SYSTEM_PERSPECTIVE_ROOT + ICON_EXT;
-
-
-
- public static final String ICON_SYSTEM_ARROW_UP_ROOT = "arrowup_obj"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_ARROW_UP = ICON_OBJS_DIR + ICON_SYSTEM_ARROW_UP_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_ARROW_UP_ID = PREFIX+ICON_SYSTEM_ARROW_UP_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_ARROW_DOWN_ROOT = "arrowdown_obj"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_ARROW_DOWN = ICON_OBJS_DIR + ICON_SYSTEM_ARROW_DOWN_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_ARROW_DOWN_ID = PREFIX+ICON_SYSTEM_ARROW_DOWN_ROOT+ICON_SUFFIX;
-
-
- public static final String ICON_SYSTEM_CONNECTOR_SERVICE_ROOT = "connectorservice_obj"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_CONNECTOR_SERVICE = ICON_OBJS_DIR + ICON_SYSTEM_CONNECTOR_SERVICE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_CONNECTOR_SERVICE_ID = PREFIX+ICON_SYSTEM_CONNECTOR_SERVICE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_SERVICE_ROOT = "service_obj"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_SERVICE = ICON_OBJS_DIR + ICON_SYSTEM_SERVICE_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_SERVICE_ID = PREFIX+ICON_SYSTEM_SERVICE_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_LAUNCHER_CONFIGURATION_ROOT = "launcher_config_obj"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_LAUNCHER_CONFIGURATION = ICON_OBJS_DIR + ICON_SYSTEM_LAUNCHER_CONFIGURATION_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_LAUNCHER_CONFIGURATION_ID = PREFIX+ICON_SYSTEM_LAUNCHER_CONFIGURATION_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SYSTEM_PROPERTIES_ROOT = "properties_obj"; //$NON-NLS-1$
- public static final String ICON_SYSTEM_PROPERTIES = ICON_OBJS_DIR + ICON_SYSTEM_PROPERTIES_ROOT+ICON_EXT;
- public static final String ICON_SYSTEM_PROPERTIES_ID = PREFIX+ICON_SYSTEM_PROPERTIES_ROOT+ICON_SUFFIX;
-
- public static final String ICON_SEARCH_REMOVE_SELECTED_MATCHES_ROOT = "searchremoveselected"; //$NON-NLS-1$
- public static final String ICON_SEARCH_REMOVE_SELECTED_MATCHES = ICON_ACTIONS_DIR + ICON_SEARCH_REMOVE_SELECTED_MATCHES_ROOT + ICON_EXT;
- public static final String ICON_SEARCH_REMOVE_SELECTED_MATCHES_ID = PREFIX + ICON_SEARCH_REMOVE_SELECTED_MATCHES_ROOT + ICON_SUFFIX;
-
- public static final String ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT = "searchremoveall"; //$NON-NLS-1$
- public static final String ICON_SEARCH_REMOVE_ALL_MATCHES = ICON_ACTIONS_DIR + ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT + ICON_EXT;
- public static final String ICON_SEARCH_REMOVE_ALL_MATCHES_ID = PREFIX + ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT + ICON_SUFFIX;
-
- // we reuse the Remove all matches action icon
- public static final String ICON_SEARCH_CLEAR_HISTORY_ROOT = ICON_SEARCH_REMOVE_ALL_MATCHES_ROOT;
- public static final String ICON_SEARCH_CLEAR_HISTORY = ICON_ACTIONS_DIR + ICON_SEARCH_CLEAR_HISTORY_ROOT + ICON_EXT;
- public static final String ICON_SEARCH_CLEAR_HISTORY_ID = PREFIX + ICON_SEARCH_CLEAR_HISTORY_ROOT + ICON_SUFFIX;
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java
deleted file mode 100644
index 354ee1eaa..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMassager.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-//import org.eclipse.jface.dialogs.*;
-//import org.eclipse.jface.viewers.*;
-
-/**
- * This interface is used to identify objects whose job is to massage user-entered
- * text before saving it to a model. Eg, the text, while valid, may need to be folded
- * to uppercase or trimmed of blanks, or resolved if it has a substitution variable.
- * <p>
- * This interface, like IInputValidator, allows this work to be abstracted such that one
- * object that does it can be used in various dialogs or wizards or property sheets.
- */
-public interface ISystemMassager
-{
-
-
- /**
- * Given the user-entered input, return the massaged version of it.
- * If no massaging required, return the input as is.
- */
- public String massage(String text);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java
deleted file mode 100644
index 62ccfd048..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemMessages.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
- * API to the user actions plugin
- * Kevin Doyle (IBM) - [160769] Added FILEMSG_MOVE_FILTER_NOT_VALID
- * Kevin Doyle (IBM) - [199324] Added FILEMSG_MOVE_TARGET_EQUALS_PARENT_OF_SRC
- * Xuan Chen (IBM) - [160775] Added MSG_RENAMEGENERIC_PROGRESS, FILEMSG_MOVE_INTERRUPTED
- * FILEMSG_RENAME_INTERRUPTED, FILEMSG_DELETE_INTERRUPTED
- * FILEMSG_COPY_INTERRUPTED
- * Xuan Chen (IBM) - [209828] Need to move the Create operation to a job.
- * David McKnight (IBM) - [216252] removing unused messages and ids
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-
-/**
- * Message IDs
- */
-public interface ISystemMessages
-{
- public static final String MSG_WIZARD_PAGE_ERROR = "RSEG1240"; //$NON-NLS-1$
-
-
- public static final String MSG_CONFIRM_RELOADRSE = "RSEG1002"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_NAME_EMPTY = "RSEG1006"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_NAME_NOTUNIQUE= "RSEG1007"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_NAME_NOTVALID = "RSEG1008"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_RENAME_NOTUNIQUE= "RSEG1010"; //MSG_VALIDATE_PREFIX + "ReName.NotUnique"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_RENAME_OLDEQUALSNEW = "RSEG1009"; //MSG_VALIDATE_PREFIX+"ReName.OldEqualsNew"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_PROFILENAME_EMPTY = "RSEG1014"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PROFILENAME_NOTUNIQUE= "RSEG1015"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PROFILENAME_NOTVALID = "RSEG1016"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PROFILENAME_RESERVED = "RSEG1040"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_PATH_EMPTY = "RSEG1032"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PATH_NOTUNIQUE= "RSEG1033"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PATH_NOTVALID = "RSEG1034"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_NOT_NUMERIC = "RSEG1017"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PORT_EMPTY = "RSEG1027"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_PORT_NOTVALID = "RSEG1028"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FOLDERNAME_NOTVALID = "RSEG1018"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FILENAME_NOTVALID = "RSEG1019"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_CONNECTIONNAME_EMPTY= "RSEG1021"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE = "RSEG1022"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE_OTHERPROFILE = "RSEG1041"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_HOSTNAME_EMPTY= "RSEG1024"; //MSG_VALIDATE_PREFIX + "HostNameRequired"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_USERID_EMPTY = "RSEG1025"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_USERID_NOTVALID = "RSEG1026"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_ENTRY_EMPTY = "RSEG1029"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_ENTRY_NOTUNIQUE= "RSEG1030"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_ENTRY_NOTVALID = "RSEG1031"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_FILTERPOOLNAME_EMPTY = "RSEG1037"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FILTERPOOLNAME_NOTUNIQUE= "RSEG1038"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_FILTERNAME_EMPTY = "RSEG1042"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FILTERNAME_NOTUNIQUE= "RSEG1043"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_PASSWORD_EMPTY = "RSEG1035"; //MSG_VALIDATE_PREFIX + "PasswordRequired"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_FILTERSTRING_EMPTY = "RSEG1045"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FILTERSTRING_NOTUNIQUE= "RSEG1046"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FILTERSTRING_NOTVALID = "RSEG1047"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FILTERSTRING_DUPLICATES = "RSEG1048"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_FILTERSTRING_ALREADYEXISTS = "RSEG1049"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_NUMBER_EMPTY = "RSEG1170"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_NUMBER_NOTVALID = "RSEG1171"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_NUMBER_OUTOFRANGE= "RSEG1172"; //$NON-NLS-1$
-
- public static final String MSG_CONFIRM_DELETE = "RSEG1052"; //$NON-NLS-1$
- public static final String MSG_CONFIRM_CHANGES = "RSEG1201"; //$NON-NLS-1$
-
-
-
-
- //public static final String MSG_SAVE_PREFIX = MSG_PREFIX + "Save.";
- public static final String MSG_SAVE_FAILED = "RSEG1050"; //MSG_SAVE_PREFIX + "Failed"; //$NON-NLS-1$
-
- //public static final String MSG_EXCEPTION_PREFIX = MSG_PREFIX + "Exception.";
- public static final String MSG_EXCEPTION_OCCURRED = "RSEG1003"; //$NON-NLS-1$
- public static final String MSG_EXCEPTION_DELETING = "RSEG1063"; //""RSEG1004"; //$NON-NLS-1$
- public static final String MSG_EXCEPTION_RENAMING = "RSEG1064"; //"RSEG1005"; //MSG_EXCEPTION_PREFIX + "Renaming"; //$NON-NLS-1$
-
-
- //public static final String MSG_QUERY_PREFIX = MSG_PREFIX + "Query.";
- public static final String MSG_QUERY_PROGRESS = "RSEG1095"; //$NON-NLS-1$
-
- //public static final String MSG_COPY_PREFIX = MSG_PREFIX + "Copy.";
- public static final String MSG_COPY_PROGRESS = "RSEG1072"; //$NON-NLS-1$
- public static final String MSG_COPYCONNECTION_PROGRESS = "RSEG1073"; //$NON-NLS-1$
- public static final String MSG_COPYCONNECTIONS_PROGRESS = "RSEG1074"; //$NON-NLS-1$
- public static final String MSG_COPYFILTERPOOLS_PROGRESS = "RSEG1075"; //$NON-NLS-1$
- public static final String MSG_COPYFILTERPOOL_PROGRESS = "RSEG1076"; //$NON-NLS-1$
- public static final String MSG_COPYFILTERS_PROGRESS = "RSEG1077"; //$NON-NLS-1$
- public static final String MSG_COPYFILTER_PROGRESS = "RSEG1078"; //$NON-NLS-1$
- public static final String MSG_COPYFILTERSTRINGS_PROGRESS="RSEG1079"; //$NON-NLS-1$
- public static final String MSG_COPYFILTERSTRING_PROGRESS ="RSEG1080"; //$NON-NLS-1$
-
- public static final String MSG_COPYFILTERPOOL_COMPLETE = "RSEG1082"; //$NON-NLS-1$
-
- //public static final String MSG_MOVE_PREFIX = MSG_PREFIX + "Move.";
- public static final String MSG_MOVECONNECTION_PROGRESS = "RSEG1084"; //$NON-NLS-1$
- public static final String MSG_MOVECONNECTIONS_PROGRESS = "RSEG1085"; //$NON-NLS-1$
- public static final String MSG_MOVEFILTERPOOLS_PROGRESS = "RSEG1086"; //$NON-NLS-1$
- public static final String MSG_MOVEFILTERPOOL_PROGRESS = "RSEG1087"; //$NON-NLS-1$
- public static final String MSG_MOVEFILTERS_PROGRESS = "RSEG1088"; //$NON-NLS-1$
- public static final String MSG_MOVEFILTER_PROGRESS = "RSEG1089"; //$NON-NLS-1$
- public static final String MSG_MOVEFILTERSTRINGS_PROGRESS="RSEG1090"; //$NON-NLS-1$
- public static final String MSG_MOVEFILTERSTRING_PROGRESS ="RSEG1091"; //$NON-NLS-1$
- public static final String MSG_MOVEFILTERPOOL_COMPLETE = "RSEG1092"; //$NON-NLS-1$
-
-
- public static final String MSG_COPYGENERIC_PROGRESS = "RSEG1115"; //$NON-NLS-1$
- public static final String MSG_MOVEGENERIC_PROGRESS = "RSEG1116"; //$NON-NLS-1$
- public static final String MSG_COPYTHINGGENERIC_PROGRESS = "RSEG1117"; //$NON-NLS-1$
- public static final String MSG_MOVETHINGGENERIC_PROGRESS = "RSEG1118"; //$NON-NLS-1$
- /**
- * @since 3.0
- */
- public static final String MSG_RENAMEGENERIC_PROGRESS = "RSEG1142"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_SRCTYPE_EMPTY = "RSEG1192"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_SRCTYPE_NOTVALID = "RSEG1193"; //$NON-NLS-1$
- public static final String MSG_VALIDATE_SRCTYPE_NOTUNIQUE= "RSEG1194"; //$NON-NLS-1$
-
- public static final String MSG_VALIDATE_ARCHIVE_NAME = "RSEG1120"; //$NON-NLS-1$
-
-
- public static final String MSG_FILTERPOOL_CREATED = "RSEG1160"; // defect 42503 //$NON-NLS-1$
- public static final String MSG_UPDATEFILTER_FAILED = "RSEG1161"; //$NON-NLS-1$
- public static final String MSG_RENAMEFILTER_FAILED = "RSEG1162"; //$NON-NLS-1$
-
- //public static final String MSG_OPERATION_PREFIX = MSG_PREFIX + "Operation.";
- public static final String MSG_OPERATION_FAILED = "RSEG1066"; //$NON-NLS-1$
- public static final String MSG_OPERATION_CANCELLED = "RSEG1067"; //$NON-NLS-1$
-
-
- public static final String MSG_HOSTNAME_NOTFOUND = "RSEG1220"; //$NON-NLS-1$
- public static final String MSG_HOSTNAME_VERIFYING = "RSEG1221"; //$NON-NLS-1$
-
-
- public static final String MSG_ENCODING_NOT_SUPPORTED = "RSEG1244"; //$NON-NLS-1$
-
-
- // --------------------------
- // UNIVERSAL FILE MESSAGES...
- // --------------------------
- /** @since 3.0 */
- public static final String FILEMSG_RENAME_INTERRUPTED = "RSEG1246"; //$NON-NLS-1$
- /** @since 3.0 */
- public static final String FILEMSG_DELETE_INTERRUPTED = "RSEG1247"; //$NON-NLS-1$
-
-
- // --------------------------
- // SYSTEM VIEW MESSAGES...
- // --------------------------
- //public static final String MSG_EXPAND_PREFIX = MSG_PREFIX + "Expand.";
- public static final String MSG_EXPAND_FAILED = "RSEG1098"; //MSG_EXPAND_PREFIX + "Failed"; //$NON-NLS-1$
- public static final String MSG_EXPAND_CANCELLED = "RSEG1067"; //MSG_EXPAND_PREFIX + "Cancelled"; //$NON-NLS-1$
- // Message vetoed by UCD
- //public static final String MSG_EXPAND_CANCELLED = "RSEG1099"; //MSG_EXPAND_PREFIX + "Cancelled";
- public static final String MSG_EXPAND_EMPTY = "RSEG1100"; //MSG_EXPAND_PREFIX + "Empty"; //$NON-NLS-1$
- public static final String MSG_EXPAND_FILTERCREATED = "RSEG1102"; //MSG_EXPAND_PREFIX + "FilterCreated"; //$NON-NLS-1$
- public static final String MSG_EXPAND_CONNECTIONCREATED = "RSEG1108"; //MSG_EXPAND_PREFIX + "ConnectionCreated"; //$NON-NLS-1$
-
- //public static final String MSG_LIST_PREFIX = MSG_PREFIX + "List.";
- public static final String MSG_LIST_CANCELLED = "RSEG1101"; //MSG_LIST_PREFIX + "Cancelled"; //$NON-NLS-1$
-
- // ----------------------------------
- // GENERIC ERROR CHECKING MESSAGES...
- // ----------------------------------
-
- public static final String MSG_ERROR_CONNECTION_NOTFOUND = "RSEG1103"; //$NON-NLS-1$
- public static final String MSG_ERROR_PROFILE_NOTFOUND = "RSEG1104"; //$NON-NLS-1$
- public static final String MSG_ERROR_FILE_NOTFOUND = "RSEG1106"; //$NON-NLS-1$
-
-
- // --------------------------
- // Generic messages, must substitute in values...
- // --------------------------
- public static final String MSG_GENERIC_I = "RSEO1010"; //$NON-NLS-1$
- public static final String MSG_GENERIC_W = "RSEO1011"; //$NON-NLS-1$
- public static final String MSG_GENERIC_E = "RSEO1012"; //$NON-NLS-1$
- public static final String MSG_GENERIC_U = "RSEO1013"; //$NON-NLS-1$
- public static final String MSG_GENERIC_Q = "RSEO1014"; //$NON-NLS-1$
- public static final String MSG_GENERIC_I_HELP = "RSEO1000"; //$NON-NLS-1$
- public static final String MSG_GENERIC_W_HELP = "RSEO1001"; //$NON-NLS-1$
- public static final String MSG_GENERIC_E_HELP = "RSEO1002"; //$NON-NLS-1$
- public static final String MSG_GENERIC_U_HELP = "RSEO1003"; //$NON-NLS-1$
- public static final String MSG_GENERIC_Q_HELP = "RSEO1004"; //$NON-NLS-1$
-
-
- // ----------------------------------
- // COMMUNICATIONS ERROR CHECKING MESSAGES...
- // ----------------------------------
-
- public static final String MSG_COMM_PWD_INVALID = "RSEC1004"; //$NON-NLS-1$
-
- public static final String MSG_COMM_PWD_EXISTS = "RSEC2101"; //$NON-NLS-1$
- public static final String MSG_COMM_PWD_MISMATCH = "RSEC2102"; //$NON-NLS-1$
- public static final String MSG_COMM_PWD_BLANKFIELD = "RSEC2103"; //$NON-NLS-1$
-
- public static final String MSG_COMM_ENVVAR_DUPLICATE = "RSEC2001"; //$NON-NLS-1$
- public static final String MSG_COMM_ENVVAR_NONAME = "RSEC2002"; //$NON-NLS-1$
- public static final String MSG_COMM_ENVVAR_INVALIDCHAR = "RSEC2004"; //$NON-NLS-1$
-
- public static final String MSG_COMM_PORT_WARNING = "RSEC2306"; //$NON-NLS-1$
-
-
- // Unexpected error message
- public static final String MSG_ERROR_UNEXPECTED = "RSEF8002"; //$NON-NLS-1$
-
- // file transfer message
- public static final String MSG_TRANSFER_INVALID = "RSEG1270"; //$NON-NLS-1$
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java
deleted file mode 100644
index 15055ba96..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPageCompleteListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-/**
- * This is used in forms that are used within dialogs and pages, and
- * specifically with {@link org.eclipse.rse.ui.SystemBaseForm}.
- * It allows the dialog or page to be called back when the form code calls
- * setPageComplete, a method within the form class. This way the diaog or
- * page can themselves call their own setPageComplete method.
- */
-public interface ISystemPageCompleteListener
-{
- /**
- * The callback method.
- * This is called whenever setPageComplete is called by the form code.
- * @param complete complete indicator as set by the caller
- * @see SystemBaseForm#addPageCompleteListener(ISystemPageCompleteListener)
- */
- public void setPageComplete(boolean complete);
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java
deleted file mode 100644
index e2d54eecf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-package org.eclipse.rse.ui;
-
-/**
- * Keys into preferences bundle.
- */
-public interface ISystemPreferencesConstants {
- /*
- * root
- */
- public static final String ROOT = "org.eclipse.rse.preferences."; //$NON-NLS-1$
- /*
- * uda preference keys
- */
- public static final String CASCADE_UDAS_BYPROFILE = ROOT + "uda.cascade"; //$NON-NLS-1$
- /*
- * uda preference default values
- */
- public static final boolean DEFAULT_CASCADE_UDAS_BYPROFILE = false;
- /*
- * ui preference keys
- */
- public static final String RESTORE_STATE_FROM_CACHE = ROOT + "restoreStateFromCache"; //$NON-NLS-1$
- public static final String SYSTEMTYPE_VALUES = ROOT + "systemtype.info"; //$NON-NLS-1$
- public static final String SHOWFILTERPOOLS = ROOT + "filterpools.show"; //$NON-NLS-1$
- public static final String QUALIFY_CONNECTION_NAMES = ROOT + "qualifyconnectionnames"; //$NON-NLS-1$
- public static final String ORDER_CONNECTIONS = ROOT + "order.connections"; //$NON-NLS-1$
- public static final String SHOWNEWCONNECTIONPROMPT = ROOT + "shownewconnection"; //$NON-NLS-1$
- public static final String VERIFY_CONNECTION = ROOT + "verify.connection"; //$NON-NLS-1$
- public static final String ALERT_SSL = ROOT + "alert.ssl"; //$NON-NLS-1$
- public static final String ALERT_NONSSL = ROOT + "alert.nonssl"; //$NON-NLS-1$
- public static final String HISTORY_FOLDER = ROOT + "history.folder"; //$NON-NLS-1$
- public static final String HISTORY_QUALIFIED_FOLDER = ROOT + "history.qualified.folder"; //$NON-NLS-1$
- public static final String REMEMBER_STATE = ROOT + "rememberState"; //$NON-NLS-1$
-
- /**
- * The SHOW_EMPTY_LISTS preference. Value is "SHOW_EMPTY_LISTS".
- * The default value is true.
- * This may be used in the product's plug-in initialization.
- * Example:
- * <code>
- * org.eclipse.rse.ui/SHOW_EMPTY_LISTS=false
- * </code>
- * To use this preference in code do the following:
- * <code>
- * Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- * boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS);
- * </code>
- */
- public static final String SHOW_EMPTY_LISTS = "SHOW_EMPTY_LISTS"; //$NON-NLS-1$
- /*
- * ui preference default values
- */
- public static final boolean DEFAULT_RESTORE_STATE_FROM_CACHE = true; // yantzi: artemis 6.0
- public static final boolean DEFAULT_SHOWFILTERPOOLS = false;
- public static final boolean DEFAULT_QUALIFY_CONNECTION_NAMES = false;
- public static final String DEFAULT_ORDER_CONNECTIONS = ""; //$NON-NLS-1$
- public static final boolean DEFAULT_SHOWNEWCONNECTIONPROMPT = false;
- public static final boolean DEFAULT_VERIFY_CONNECTION = true;
- public static final boolean DEFAULT_ALERT_SSL = true;
- public static final boolean DEFAULT_ALERT_NON_SSL = true;
- public static final String DEFAULT_HISTORY_FOLDER = ""; //$NON-NLS-1$
- public static final boolean DEFAULT_REMEMBER_STATE = true; // changed in R2. Phil
- public static final boolean DEFAULT_SHOW_EMPTY_LISTS = true;
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java
deleted file mode 100644
index f02c0eb56..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemRenameTarget.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-
-/**
- * Any UI part that supports the common rename action can implement
- * this to enable the rename popup menu action, supplied by the system explorer view.
- */
-public interface ISystemRenameTarget extends ISelectionProvider
-{
- /**
- * Return true if rename should even be shown in the popup menu
- */
- public boolean showRename();
- /**
- * Return true if rename should be enabled based on your current selection.
- */
- public boolean canRename();
- /**
- * Actually do the rename of currently selected items.
- * The array of new names matches the currently selected items.
- * Return true if it worked. Return false if it didn't (you display msg), or throw an exception (framework displays msg)
- */
- public boolean doRename(String[] newNames);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java
deleted file mode 100644
index 4137d6916..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemStringsInputAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-/**
- *
- */
-public interface ISystemStringsInputAction
-{
- /**
- * Set the list of existing filter strings to help with validation.
- * Called when launched from WorkWithList widget
- */
- public void setExistingStrings(String[] existingStrings, boolean caseSensitive);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java
deleted file mode 100644
index 5be818c8b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemThemeConstants.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-
-/**
- * This interface should be used to maintain all constants related to colors and fonts
- * that are settable by the user through preferences
- */
-public interface ISystemThemeConstants {
-
- // color constants used for messages
- public static final String MESSAGE_ERROR_COLOR = "MESSAGE_ERROR_COLOR"; //$NON-NLS-1$
- public static final String MESSAGE_WARNING_COLOR = "MESSAGE_WARNING_COLOR" ; //$NON-NLS-1$
- public static final String MESSAGE_INFORMATION_COLOR = "MESSAGE_INFORMATION_COLOR"; //$NON-NLS-1$
-
- // color constants used by Remote Shell view
- public static final String REMOTE_COMMANDS_VIEW_BG_COLOR = "REMOTE_COMMANDS_VIEW_BG_COLOR"; //$NON-NLS-1$
- public static final String REMOTE_COMMANDS_VIEW_FG_COLOR = "REMOTE_COMMANDS_VIEW_FG_COLOR"; //$NON-NLS-1$
- public static final String REMOTE_COMMANDS_VIEW_PROMPT_COLOR = "REMOTE_COMMANDS_VIEW_PROMPT_COLOR"; //$NON-NLS-1$
-
- // font constant used by Remote Shell view
- public static final String REMOTE_COMMANDS_VIEW_FONT = "REMOTE_COMMANDS_VIEW_FONT"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java
deleted file mode 100644
index 6e46f787f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemVerifyListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-/**
- * @author mjberger
- * This is used in forms that are used within dialogs and pages, and
- * specifically with {@link org.eclipse.rse.ui.RemoteBaseServerLauncherForm}.
- * It allows the dialog or page to be called back when the form code calls
- * verify, a method within the form class. This way the diaog or
- * page can update their error messages if there are any.
- */
-public interface ISystemVerifyListener
-{
- /**
- * The callback method.
- * This is called whenever verify is called by the form code.
- */
- public void handleVerifyComplete();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemViewSupplier.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemViewSupplier.java
deleted file mode 100644
index e05ab6c99..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemViewSupplier.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-
-/**
- * You own views launchable from the Remote System Explorer. You must register yourself
- * with RSEUIPlugin via the registerViewSupplier method.
- */
-public interface ISystemViewSupplier
-{
-
-
-
- /**
- * Close or reset views prior to full refresh after team synch
- */
- public void closeViews();
-
- /**
- * Restore views prior to full refresh after team synch
- */
- public void openViews();
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java
deleted file mode 100644
index 9c6df7561..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerAddQuotes.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-
-
-/**
- * This massager will take a string an add quotes to it by
- * wrapping the string in the quote character and doubling
- * any interior instances of the quote character.
- */
-public class MassagerAddQuotes implements ISystemMassager {
-
-
-
- private char quote = '\'';
-
- /**
- * Construct a new instance of the massager. This instance
- * assumes the quote character is the apostrophe '\''.
- */
- public MassagerAddQuotes() {
- super();
- }
-
- /**
- * Construct a new instance of the massager. This instance
- * uses the supplied character as the quoting character.
- *
- * @param quote the quote character to use in quoting strings
- */
- public MassagerAddQuotes(char quote) {
- this.quote = quote;
- }
-
- /**
- * Quotes the string by surround the original string with
- * the quote character and doubling any internal occurences of
- * the character.
- *
- * @param text the string to be quoted
- * @return the quoted string
- * @see org.eclipse.rse.ui.ISystemMassager#massage(String)
- */
- public String massage(String text) {
-
- char[] chars = text.toCharArray();
-
- /* determine the number of extra quotes needed */
- int n = 0;
- for (int i = 0; i < chars.length; i++) {
- if (chars[i] == quote) {
- n++;
- }
- }
- n += 2;
-
- /* Allocate and move the characters into the buffer */
- StringBuffer buf = new StringBuffer(chars.length + n);
- buf.append(quote);
- for (int i = 0; i < chars.length; i++) {
- if (chars[i] == quote) {
- buf.append(quote);
- }
- buf.append(chars[i]);
- }
- buf.append(quote);
-
- return buf.toString();
- }
-
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java
deleted file mode 100644
index 564d0051e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCase.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-
-
-/**
- * This massager folds the input text into either uppercase or lowercase,
- * depending on the value pass to the constructor or setter.
- * <p>
- * Note by default this also trims the
- */
-public class MassagerFoldCase implements ISystemMassager
-{
-
- private boolean uppercase;
- private boolean trim;
-
- /**
- * Constructor using uppercase as the case direction
- */
- public MassagerFoldCase()
- {
- this(true);
- }
- /**
- * Constructor using given case direction
- * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
- */
- public MassagerFoldCase(boolean foldToUpperCase)
- {
- super();
- setFoldToUpperCase(foldToUpperCase);
- setTrimBlanks(true);
- }
-
- /**
- * Toggle whether to fold to uppercase or lowercase
- * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
- */
- public void setFoldToUpperCase(boolean foldToUpperCase)
- {
- this.uppercase = foldToUpperCase;
- }
- /**
- * Toggle whether to trim blanks for not
- * @param trimBlanks - whether to trim blanks (true) or leave them (false).
- */
- public void setTrimBlanks(boolean trimBlanks)
- {
- this.trim = trimBlanks;
- }
-
- /**
- * Return property about whether to fold to uppercase or lowercase
- * @return true if folder to uppercase, false if folded to lowercaese
- */
- public boolean getFoldToUpperCase()
- {
- return uppercase;
- }
- /**
- * Return property about whether to trim blanks for not
- * @return true if blanks are trimmed
- */
- public boolean getTrimBlanks()
- {
- return trim;
- }
- /**
- * @see org.eclipse.rse.ui.ISystemMassager#massage(String)
- */
- public String massage(String text)
- {
- if (text == null)
- return null;
- if (trim)
- text = text.trim();
- if (uppercase)
- return toUpperCase(text);
- else
- return toLowerCase(text);
- }
-
- /**
- * Overrridable method that actually does the uppercasing
- */
- protected String toUpperCase(String input)
- {
- return input.toUpperCase();
- }
- /**
- * Overrridable method that actually does the lowercasing
- */
- protected String toLowerCase(String input)
- {
- return input.toLowerCase();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java
deleted file mode 100644
index 94e56760c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseOutsideQuotes.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-/**
- * This massager folds the input text into either uppercase or lowercase,
- * but ONLY for those portions of the string that are not inside delimiters.
- * <p>
- * The default delimiter characters checked for are single or double quote characters, but this
- * can be changed by a setter method. When any of the delimiter characters are
- * first found we enter delimited (non-folding) mode, until the same
- * non-escaped delimiter character is found.
- * <p>
- * This massager assumes an imbedded delimiter is denoted by a doubled up
- * delimiter. If this is not the case, a setter can be used for the escape
- * character.
- * <p>
- * This massager takes more time than the MassageFoldCaseUnlessQuoted massager,
- * as that one just checks if the entire string is delimited, while this one
- * attempts to check for ranges of delimiting.
- */
-public class MassagerFoldCaseOutsideQuotes extends MassagerFoldCase
-{
-
- private static final char[] DEFAULT_DELIMITERS = {'\"', '\''};
- private char[] delimiters;
- private char escape = ' ';
-
- /**
- * Constructor using uppercase and using single and double quotes as delimiters
- */
- public MassagerFoldCaseOutsideQuotes()
- {
- this(true, DEFAULT_DELIMITERS);
- }
- /**
- * Constructor using given case direction, using single and double quotes as delimiters
- * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
- */
- public MassagerFoldCaseOutsideQuotes(boolean foldToUpperCase)
- {
- this(foldToUpperCase, DEFAULT_DELIMITERS);
- }
- /**
- * Constructor using given case direction, using given delimiters
- * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
- * @param delimiters - chars to trigger delimited mode. Delimited sections are not folded.
- */
- public MassagerFoldCaseOutsideQuotes(boolean foldToUpperCase, char[] delimiters)
- {
- super(foldToUpperCase);
- setDelimiters(delimiters);
- }
-
- /**
- * Set the delimiter characters
- * @param delimiters - chars to trigger delimited mode. Delimited sections are not folded.
- */
- public void setDelimiters(char[] delimiters)
- {
- this.delimiters = delimiters;
- }
- /**
- * Set the escape character used for denoted an imbedded delimiter. By default, it is assumed
- * a doubled up delimiter is used for this.
- * @param escapeChar - char that escapes the delimiter. Eg '\'
- */
- public void setEscapeCharacter(char escapeChar)
- {
- this.escape = escapeChar;
- }
-
- /**
- * Get the delimiter characters
- */
- public char[] getDelimiters()
- {
- return delimiters;
- }
- /**
- * Get the escape character
- */
- public char getEscapeCharacter()
- {
- return escape;
- }
-
- /**
- * Overrridable method that actually does the uppercasing
- */
- protected String toUpperCase(String input)
- {
- if ((input==null) || (input.length() == 0))
- return input;
- else if (!hasAnyDelimiters(input)) // no delimit characters?
- return input.toUpperCase(); // fold it all!
- else
- return doFolding(input, true);
- }
- /**
- * Overrridable method that actually does the lowercasing
- */
- protected String toLowerCase(String input)
- {
- if ((input==null) || (input.length() == 0))
- return input;
- else if (!hasAnyDelimiters(input)) // no delimit characters?
- return input.toLowerCase(); // fold it all!
- else
- return doFolding(input, false);
- }
- /**
- * Check for existence of any delimiters
- */
- protected boolean hasAnyDelimiters(String input)
- {
- boolean hasAny = false;
- for (int idx=0; !hasAny && (idx<delimiters.length); idx++)
- if (input.indexOf(delimiters[idx]) != -1)
- hasAny = true;
- return hasAny;
- }
-
- /**
- * Method that actually walks the given string, character by character,
- * folding all those which are not inside delimiters
- */
- protected String doFolding(String input, boolean upperCase)
- {
- StringBuffer buffer = new StringBuffer(input.length());
- boolean insideDelimiters = false;
- boolean checkForEscape = (escape != ' ');
- char currDelimiter = ' ';
- char prevChar = ' ';
- char currChar = ' ';
- for (int idx=0; idx<input.length(); idx++)
- {
- prevChar = currChar;
- currChar = input.charAt(idx);
- // ------------------------
- // outside of delimiters...
- // ------------------------
- if (!insideDelimiters)
- {
- // append folded
- if (upperCase)
- buffer.append(Character.toUpperCase(currChar));
- else
- buffer.append(Character.toLowerCase(currChar));
- // check if this is the start of delimiting...
- if (isDelimiter(currChar))
- {
- currDelimiter = currChar;
- insideDelimiters = true; // enter delimited mode
- }
- }
- // -----------------------
- // inside of delimiters...
- // -----------------------
- else
- {
- buffer.append(currChar); // append as is
- // check if this is the end of delimiting...
- if (currChar == currDelimiter)
- {
- // ensure this isn't an escaped delimiter
- if (!checkForEscape || (prevChar != escape))
- insideDelimiters = false; // exit delimited mode
- }
- }
- }
- return buffer.toString();
- }
- /**
- * Check if given character is one of the delimiters
- */
- protected boolean isDelimiter(char currChar)
- {
- for (int idx=0; idx<delimiters.length; idx++)
- if (currChar == delimiters[idx])
- return true;
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseUnlessQuoted.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseUnlessQuoted.java
deleted file mode 100644
index ba4095e3c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerFoldCaseUnlessQuoted.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-/**
- * This massager folds the input text into either uppercase or lowercase,
- * but ONLY if the given input is not delimited. The default delimiter checked
- * for is the double quote character, but this can be changed by a setter method.
- */
-public class MassagerFoldCaseUnlessQuoted extends MassagerFoldCase
-{
-
- private char delimiter;
-
- /**
- * Constructor using uppercase and using a double quote as delimiter
- */
- public MassagerFoldCaseUnlessQuoted()
- {
- this(true, '\"');
- }
- /**
- * Constructor using given case direction, using a double quote as delimiter
- * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
- */
- public MassagerFoldCaseUnlessQuoted(boolean foldToUpperCase)
- {
- this(foldToUpperCase, '\"');
- }
- /**
- * Constructor using given case direction, using given delimiter
- * @param foldToUpperCase - whether to fold to uppercase (true) or lowercase (false).
- * @param delimiter - char to check if text is enclosed with. If it is, then no folding is done.
- */
- public MassagerFoldCaseUnlessQuoted(boolean foldToUpperCase, char delimiter)
- {
- super(foldToUpperCase);
- setDelimiter(delimiter);
- }
-
- /**
- * Set the delimiter character
- * @param delimiter - char to check if text is enclosed with. If it is, then no folding is done.
- */
- public void setDelimiter(char delimiter)
- {
- this.delimiter = delimiter;
- }
-
- /**
- * Get the delimiter character
- */
- public char getDelimiter()
- {
- return delimiter;
- }
-
- /**
- * Overrridable method that actually does the uppercasing
- */
- protected String toUpperCase(String input)
- {
- if ((input.length() >= 2) &&
- (input.charAt(0) == delimiter) && // start with delimiter?
- (input.charAt(input.length()-1) == delimiter)) // end with delimiter?
- return input; // do nothing
- else
- return input.toUpperCase(); // fold
- }
- /**
- * Overrridable method that actually does the lowercasing
- */
- protected String toLowerCase(String input)
- {
- if ((input.length() >= 2) &&
- (input.charAt(0) == delimiter) && // start with delimiter?
- (input.charAt(input.length()-1) == delimiter)) // end with delimiter?
- return input; // do nothing
- else
- return input.toLowerCase(); // fold
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerRemoveQuotes.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerRemoveQuotes.java
deleted file mode 100644
index 4113604a4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/MassagerRemoveQuotes.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-
-
-/**
- * Utility class used by UI widgets to format a srcpf or member Description string.<br>
- * It checks to see if the string is legally quoted, and if not, it returns it as is. A legally quoted
- * string is one which begins and ends with single quotes, and where all single quotes inside the
- * string are escaped with another single quote. If the string is legally quoted, it de-quotes it
- * (hence the name). Dequoting means remove the single quotes, and remove any escape quotes
- * from the inside of the string.
- * There is also a general constructor that takes in the quoting character, the character to escape,
- * and the character to use as an escape charcter. It also takes n a boolean flag that decides wether
- * or not the string has to be quoted before this massager actually does the job.
- */
-public class MassagerRemoveQuotes implements ISystemMassager {
-
-
-
- private String quoteChar;
- private String charToEscape;
- private String escapeChar;
- private boolean mustBeQuoted;
-
- /**
- * Default constructor for MassagerRemoveQuotes.<br>
- * Assumes that a legal string is one where the string is quoted with single quotes,
- * and all inner quotes are escaped with a single quote.
- */
- public MassagerRemoveQuotes() {
- this('\'', '\'', '\'', true);
- }
-
- /**
- * Generic constructor. A valid string is one where every charToEscape is actually
- * escaped with an escapeChar before it. If mustBeQuoted is true, then the string
- * is only valid if it is quoted with the quoteChar, and the characters inside the
- * string itself are properly escaped. If the string is determined to be a valid string,
- * this massager returns the string with the quotes and escape characters stripped out.
- * if not, the string is returned as is.
- */
- public MassagerRemoveQuotes(
- char quoteChar,
- char charToEscape,
- char escapeChar,
- boolean mustBeQuoted) {
-
- this.quoteChar = String.valueOf(quoteChar);
- this.charToEscape = String.valueOf(charToEscape);
- this.escapeChar = String.valueOf(escapeChar);
- this.mustBeQuoted = mustBeQuoted;
- }
-
- public String massage(String text) {
- String strippedText = text;
-
- if (mustBeQuoted) {
- if (!isQuoted(text))
- // String is not quoted, when it should be, return it as is.
- // No need to de-quote since it is not a legal string.
- return text;
- else
- strippedText = stripQuotes(text);
- }
-
- // check to see if string is a legal string, and if it is, de-quote it.
- boolean islegal = isLegalString(strippedText);
- if (islegal)
- return deQuote(strippedText);
- else
- return text;
- }
-
- /**
- * Returns true if string is single quoted.
- */
- protected boolean isQuoted(String text) {
- if (text.startsWith(quoteChar) && text.endsWith(quoteChar))
- return true;
- else
- return false;
- }
-
- /**
- * Checks to see if we have a valid string. A valid string is one where all
- * quotes are escaped with another quote.
- */
- protected boolean isLegalString(String text) {
- if (charToEscape.equals(escapeChar))
- return doForwardChecking(text);
- else
- return doBackwardChecking(text);
- }
-
- private boolean doForwardChecking(String text) {
- int index = text.indexOf(charToEscape);
- while (index != -1) {
- // check the char AFTER the escape char since they are both the
- // same. . Be careful if it is the last char.
- if ((index == text.length() - 1)
- || (text.charAt(index + 1) != escapeChar.charAt(0)))
- // we have a quote that is not escaped => not a legal string.
- return false;
-
- // search for another quote *after* the escaped one.
- index = text.indexOf(charToEscape, index + 2);
- }
-
- // all quotes are escaped, legal string.
- return true;
-
- }
-
- private boolean doBackwardChecking(String text) {
- int index = text.indexOf(charToEscape);
- while (index != -1) {
- // check the char before the character to escape. Be careful if it is the first char.
- if ((index == 0)
- || (text.charAt(index - 1) != escapeChar.charAt(0)))
- // we have a quote that is not escaped => not a legal string.
- return false;
-
- // search for another quote *after* the escaped one.
- index = text.indexOf(charToEscape, index + 1);
- }
-
- // all quotes are escaped, legal string.
- return true;
-
- }
-
- /**
- * Removes first and last chars if they are single quotes, otherwise
- * returns the string as is.
- */
- private String stripQuotes(String text) {
- if (isQuoted(text)) {
- text = text.substring(1, text.length() - 1);
- }
- return text;
- }
-
- /**
- * This method assumes that the passed string is a legal string, and it does
- * the qe-quoting.
- */
- private String deQuote(String text) {
- if (charToEscape.equals(escapeChar))
- return doForwardDeQuote(text);
- else
- return doBackwardDeQuote(text);
- }
-
- private String doForwardDeQuote(String text) {
- int index = text.indexOf(charToEscape);
- while (index != -1) {
- // strip the escape char.
- text = text.substring(0, index) + text.substring(index + 1);
-
- // search for another quote *after* the escaped one.
- index = text.indexOf(charToEscape, index + 2);
- }
- return text;
- }
-
- private String doBackwardDeQuote(String text) {
- int index = text.indexOf(charToEscape);
- while (index != -1) {
- // strip the escape char.
- text = text.substring(0, index - 1) + text.substring(index);
-
- // search for another quote *after* the escaped one.
- index = text.indexOf(charToEscape, index + 1);
- }
- return text;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java
deleted file mode 100644
index a6b2fc670..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/Mnemonics.java
+++ /dev/null
@@ -1,670 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [187860] review for adding foreign lang support
- * David Dykstal (IBM) - [226561] Add API markup for noextend / noimplement where needed
- * Kevin Doyle (IBM) - [242250] Using Mnemonics twice as fast as we should be
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.rse.ui.widgets.InheritableEntryField;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Text;
-
-import com.ibm.icu.lang.UCharacter;
-import com.ibm.icu.lang.UCharacter.UnicodeBlock;
-import com.ibm.icu.util.ULocale;
-
-/**
- * Instances of this class may be used to supply mnemonics to the
- * text for controls.
- * There are preferences which can be set by products to control how
- * these mnemonics are generated and applied.
- * <p>
- * There are two types of mnemonics which can be added to a label:
- * embedded mnemonics and appended mnemonics. An embedded mnemonic uses
- * an existing letter in the label for the mnemonic. An appended mnemonic
- * is added to the end of the label (but prior to any punctuation or accelerators)
- * and is of the form (X).
- * <p>
- * The org.eclipse.rse.ui/MNEMONICS_POLICY preference establishes the
- * desire to generated embedded mnemonics using letters that already
- * exist in the text of the controls and/or to generate appended mnemonics
- * if an embedded mnemonic cannot be found or is not desired.
- * The policy is composed of bit flags.
- * See {@link #EMBED_MNEMONICS} and {@link #APPEND_MNEMONICS} for the flag values.
- * See {@link #POLICY_DEFAULT} for the default policy value.
- * A policy value of 0 will disable the generation of all mnemonics.
- * <p>
- * The org.eclipse.rse.ui/APPEND_MNEMONICS_PATTERN preference is used to
- * further qualify the appending behavior by the current locale. If the
- * current locale name matches this pattern then appending can be performed.
- * See {@link #APPEND_MNEMONICS_PATTERN_DEFAULT} for the default pattern.
- * <p>
- * Mnemonics on menus are allowed to have duplicates. Attempts are made to find the
- * least used mnemonic when finding a duplicate.
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class Mnemonics {
-
- /**
- * An option bit mask - value 1.
- * If on, specifies whether or not to insert mnemonic indications into
- * the current text of a label.
- * If off, all other options are ignored.
- */
- public static final int EMBED_MNEMONICS = 1;
-
- /**
- * An option bit mask - value 2.
- * If on, specifies to generate mnemonics of the form (X) at the end of labels for
- * those languages matching the locale pattern.
- * If off, then only characters from the label will be used as mnemonics.
- */
- public static final int APPEND_MNEMONICS = 2;
-
- /**
- * The simple name of the preference that holds the pattern to be used for matching
- * against the locale to determine if APPEND_MNEMONICS option applies.
- */
- public static final String APPEND_MNEMONICS_PATTERN_PREFERENCE = "APPEND_MNEMONICS_PATTERN"; //$NON-NLS-1$
-
- /**
- * Some products will to append mnemonics only for certain locales.
- * The following provides the default pattern for matching the locale.
- * The default pattern matches Chinese, Japanese, and Korean.
- */
- public static final String APPEND_MNEMONICS_PATTERN_DEFAULT = "zh.*|ja.*|ko.*"; //$NON-NLS-1$
-
- /**
- * The simple name of the preference that determines the policy to be used when applying mnemonics to menus and composites.
- */
- public static final String POLICY_PREFERENCE = "MNEMONICS_POLICY"; //$NON-NLS-1$
-
- /**
- * The default mnemonics policy. If no policy is specified in a call to generate
- * mnemonics this policy will be used. Can be overridden by the
- * org.eclipse.rse.ui/MNEMONICS_POLICY preference.
- */
- public static final int POLICY_DEFAULT = EMBED_MNEMONICS | APPEND_MNEMONICS;
-
- private static final char MNEMONIC_CHAR = '&';
-
- /*
- * Interesting ISO 639-1 language codes.
- */
- private static final String LC_GREEK = "el"; //$NON-NLS-1$
- private static final String LC_RUSSIAN = "ru"; //$NON-NLS-1$
-
- /*
- * Known valid mnemonic candidates
- */
- private static final String GREEK_MNEMONICS = "\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"; //$NON-NLS-1$
- private static final String RUSSIAN_MNEMONICS = "\u0410\u0411\u0412\u0413\u0414\u0145\u0401\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f"; //$NON-NLS-1$
- private static final String LATIN_MNEMONICS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //$NON-NLS-1$
-
- private final static Pattern TRANSPARENT_ENDING_PATTERN = Pattern.compile("(\\s|\\.\\.\\.|>|<|:|\uff0e\uff0e\uff0e|\uff1e|\uff1c|\uff1a|\\t.*)+$"); //$NON-NLS-1$
- private boolean applyMnemonicsToPrecedingLabels = true;
-
- private Map usedCharacters = new HashMap();
-
- /**
- * Helper method to return the mnemonic from a string.
- * Helpful when it is necessary to know the mnemonic assigned so it can be reassigned,
- * such as is necessary for buttons which toggle their text.
- * @param text the label from which to extract the mnemonic
- * @return the mnemonic if assigned, else a blank character.
- */
- public static char getMnemonic(String text) {
- int idx = text.indexOf(MNEMONIC_CHAR);
- if (idx >= 0 && idx < (text.length() - 1))
- return text.charAt(idx + 1);
- else
- return ' ';
- }
-
- /**
- * Given a label and mnemonic, this applies that mnemonic to the label.
- * Not normally called from other classes, but rather by the setUniqueMnemonic
- * methods in this class.
- * @param label String to which to apply the mnemonic
- * @param mnemonicChar the character that is to be the mnemonic character
- * @return input String with '&' inserted in front of the given character,
- * or with "(c)" appended to the label at a proper position in case the
- * character c is not part of the label.
- */
- public static String applyMnemonic(String label, char mnemonicChar) {
- int labelLen = label.length();
- if (labelLen == 0) return label;
- StringBuffer newLabel = new StringBuffer(label);
- int mcharPos = label.indexOf(mnemonicChar);
- if (mcharPos != -1)
- newLabel.insert(mcharPos, MNEMONIC_CHAR);
- else {
- String addedMnemonic = new String("(" + MNEMONIC_CHAR + mnemonicChar + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- int p = getEndingPosition(label);
- newLabel.insert(p, addedMnemonic);
- }
- return newLabel.toString();
- }
-
- /**
- * Helper method to strip the mnemonic from a string.
- * Useful if using Eclipse supplied labels.
- * @param text the label from which to strip the mnemonic
- * @return the label with the mnemonic stripped
- */
- public static String removeMnemonic(String text) {
- String[] parts = text.split("\\(\\&.\\)", 2); //$NON-NLS-1$
- if (parts.length == 1) {
- parts = text.split("\\&", 2); //$NON-NLS-1$
- }
- if (parts.length == 2) {
- text = parts[0] + parts[1];
- }
- return text;
- }
-
- /**
- * Finds the point at which to insert a mnemonic of the form (&X).
- * Checks for transparent endings.
- * @param label the label to check
- * @return the position at which a mnemonic of the form (&X) can be inserted.
- */
- private static int getEndingPosition(String label) {
- Matcher m = TRANSPARENT_ENDING_PATTERN.matcher(label);
- int result = m.find() ? m.start() : label.length();
- return result;
- }
-
- /**
- * Clear the list of used mnemonic characters
- */
- public void clear() {
- usedCharacters.clear();
- }
-
- /**
- * Resets the list of used mnemonic characters to those in the string.
- *
- * @param usedMnemonics A String listing the characters to mark used as
- * mnemonics. Each character will be considered in a case
- * insensitive manner.
- */
- public void clear(String usedMnemonics) {
- clear();
- makeUsed(usedMnemonics);
- }
-
- /**
- * Sets a mnemonic in the given string and returns the result.
- * Functions according to the default policy as specified in
- * Sets the mnemonic according to the org.eclipse.rse.ui/MNEMONICS_POLICY preference.
- * Not normally called from other classes, but rather by the setMnemonic
- * methods in this class.
- * @param label The string to which to apply the mnemonic
- * @return the result string with the mnemonic embedded or appended
- */
- public String setUniqueMnemonic(String label) {
- Plugin plugin = RSEUIPlugin.getDefault();
- Preferences preferences = plugin.getPluginPreferences();
- int flags = preferences.getInt(POLICY_PREFERENCE);
- String localePattern = preferences.getString(APPEND_MNEMONICS_PATTERN_PREFERENCE);
- String result = setUniqueMnemonic(label, flags, localePattern, false);
- return result;
- }
-
- /**
- * Given a string, this starts at the first character and iterates until
- * it finds a character not already used as a mnemonic.
- * Not normally called from other classes, but rather by the setMnemonic
- * methods in this class.
- * If the label already has a mnemonic it is not touched.
- * @param label String to which to apply a mnemonic
- * @param flags The policy bit field composed of the following options
- * EMBED_MNEMONICS and APPEND_MNEMONICS
- * @param allowDuplicates true if duplicates can be allowed. Typically used only
- * when assigning mnemonics to menu items. If true, it will attempt to assign the
- * least used duplicate mnemonic for the string from the context established so far.
- * @return input String with '&' inserted in front of the mnemonic character
- */
- private String setUniqueMnemonic(String label, int flags, String localePattern, boolean allowDuplicates) {
- // determine the cases where the label does not need a mnemonic
- if (flags == 0 || label == null || label.trim().length() == 0 || label.equals("?")) { //$NON-NLS-1$
- return label;
- }
- StringBuffer buffer = new StringBuffer(label);
- char mn = getMnemonic(label);
- if (mn == ' ' && ((flags & EMBED_MNEMONICS) > 0)) { // no mnemonic exists, try embedding
- int p = findUniqueMnemonic(label);
- if (p >= 0) { // a character in the label can be used as the mnemonic
- mn = label.charAt(p);
- buffer.insert(p, MNEMONIC_CHAR);
- }
- }
- if (mn == ' ' && allowDuplicates) { // no mnemonic exists, try a duplicate
- int n = getEndingPosition(label);
- int m = 999;
- int p = -1;
- for (int i = 0; i < n; i++) {
- char ch = label.charAt(i);
- if (isAcceptable(ch) && timesUsed(ch) < m) {
- m = timesUsed(ch);
- p = i;
- }
- }
- if (p >= 0) {
- mn = label.charAt(p);
- buffer.insert(p, MNEMONIC_CHAR);
- }
- }
- if (mn == ' ' && ((flags & APPEND_MNEMONICS) > 0)) { // no mnemonic exists, try appending a mnemonic
- String localeName = ULocale.getDefault().getName();
- if (localeName.matches(localePattern)) {
- String candidates = getCandidates();
- int p = findUniqueMnemonic(candidates);
- if (p >= 0) {
- mn = candidates.charAt(p);
- String mnemonicString = "(" + MNEMONIC_CHAR + mn + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- p = getEndingPosition(label);
- buffer.insert(p, mnemonicString);
- }
- }
- }
- makeUsed(mn);
- return buffer.toString();
- }
-
- /**
- * Determine if given char is a unique mnemonic.
- * @param ch the character to test.
- * @return true if the character has not yet been used.
- */
- public boolean isUniqueMnemonic(char ch) {
- return timesUsed(ch) == 0;
- }
-
- private Preferences getPreferences() {
- return RSEUIPlugin.getDefault().getPluginPreferences();
- }
-
- private String getLocalePattern() {
- return getPreferences().getString(APPEND_MNEMONICS_PATTERN_PREFERENCE);
- }
-
- private int getPolicy() {
- return getPreferences().getInt(POLICY_PREFERENCE);
- }
-
- private boolean isEmbedding() {
- return (getPolicy() & EMBED_MNEMONICS) > 0;
- }
-
- private boolean isAppending() {
- return (getPolicy() & APPEND_MNEMONICS) > 0;
- }
-
- /**
- * @return a string of acceptable mnemonic candidates for the language
- * of the current locale.
- */
- private String getCandidates() {
- /*
- * This is a coarse-grained approach and uses the 2-letter language codes from ISO 639-1.
- * This should be quite sufficient for mnemonic generation.
- */
- String language = ULocale.getDefault().getLanguage();
- if (language.equals(LC_GREEK)) return GREEK_MNEMONICS;
- if (language.equals(LC_RUSSIAN)) return RUSSIAN_MNEMONICS;
- return LATIN_MNEMONICS;
- }
-
- /**
- * Find a unique mnemonic char in given string.
- * @param label the string in which to search for the best mnemonic character
- * @return index position of unique character in input string, or -1 if none found.
- */
- private int findUniqueMnemonic(String label) {
- int uniqueIndex = -1;
- char ch = label.charAt(0);
- for (int i = 0; (i < label.length()) && (uniqueIndex == -1); i++) {
- ch = label.charAt(i);
- if (ch == '\t') { // stop at accelerators too
- break;
- }
- if (timesUsed(ch) == 0 && isAcceptable(ch)) {
- uniqueIndex = i;
- }
- }
- return uniqueIndex;
- }
-
- private boolean isAcceptable(char ch) {
- UnicodeBlock block = UnicodeBlock.of(ch);
- boolean result = (isAcceptable(block) && UCharacter.isLetter(ch)); // the character is a letter
- return result;
- }
-
- private boolean isAcceptable(UnicodeBlock block) {
- if (block == UnicodeBlock.BASIC_LATIN) return true;
- if (block == UnicodeBlock.LATIN_1_SUPPLEMENT) return true;
- if (block == UnicodeBlock.LATIN_EXTENDED_A) return true;
- if (block == UnicodeBlock.LATIN_EXTENDED_B) return true;
- if (block == UnicodeBlock.LATIN_EXTENDED_C) return true;
- if (block == UnicodeBlock.LATIN_EXTENDED_D) return true;
- if (block == UnicodeBlock.GREEK) return true;
- if (block == UnicodeBlock.CYRILLIC) return true;
- if (block == UnicodeBlock.HEBREW) return true;
- if (block == UnicodeBlock.ARABIC) return true;
- return false;
- }
-
- /**
- * Returns the number of times a given character is used as a mnemonic in this
- * context.
- * @param ch the character to examine
- * @return the number of times it has been reported as being used.
- */
- private int timesUsed(char ch) {
- // TODO if we are guaranteed java 1.5 we can use Character.valueOf(ch)
- int result = 0;
- Integer count = (Integer) usedCharacters.get(new Character(ch));
- if (count != null) {
- result = count.intValue();
- }
- return result;
- }
-
- private void makeUsed(char ch) {
- // TODO if we are guaranteed java 1.5 we can use Character.valueOf(ch)
- if (ch != ' ') {
- makeUsed(new Character(Character.toLowerCase(ch)));
- makeUsed(new Character(Character.toUpperCase(ch)));
- }
- }
-
- private void makeUsed(Character ch) {
- Integer count = (Integer) usedCharacters.get(ch);
- if (count == null) {
- count = new Integer(1);
- }
- usedCharacters.put(ch, count);
- }
-
- private void makeUsed(String s) {
- for (int i = 0; i < s.length(); i++) {
- makeUsed(s.charAt(i));
- }
- }
-
- /**
- * Returns a string with the mnemonics for a given array of strings.
- * @param strings the array of strings.
- * @return a string containing the mnemonics.
- */
- private String getMnemonicsFromStrings(String[] strings) {
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < strings.length; i++) {
- int idx = strings[i].indexOf(MNEMONIC_CHAR);
- if (idx != -1) {
- result.append(strings[i].charAt(idx + 1));
- }
- }
- return result.toString();
- }
-
- /**
- * Set whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
- * This is for consistency with Eclipse. Only set to <code>false</code> if it does not work
- * in your dialog, wizard, preference or property page, i.e. you have labels preceding these
- * widgets that do not necessarily refer to them.
- * @param apply <code>true</code> to apply mnemonic to preceding labels, <code>false</code> otherwise.
- * @return this instance, for convenience
- */
- public Mnemonics setApplyMnemonicsToPrecedingLabels(boolean apply) {
- this.applyMnemonicsToPrecedingLabels = apply;
- return this;
- }
-
- /**
- * Adds a mnemonic to an SWT Button such that the user can select it via Ctrl/Alt+mnemonic.
- * Note a mnemonic unique to this window is chosen.
- * @param button the button to equip with a mnemonic
- * @return <code>true</code> if the button was actually changed
- */
- public boolean setMnemonic(Button button) {
- boolean changed = false;
- String text = button.getText();
- if ((text != null) && (text.trim().length() > 0)) {
- String newText = setUniqueMnemonic(text);
- if (!text.equals(newText)) {
- button.setText(newText);
- changed = true;
- }
- }
- return changed;
- }
-
- /**
- * Given a menu, this method walks all the items and assigns each a mnemonic.
- * Note that menu item mnemonics do not have to be unique.
- * The mnemonics used on cascaded menus are independent of those of the parent.
- * Handles cascading menus.
- * Call this after populating the menu.
- * @param menu the menu to examine
- */
- public void setMnemonics(Menu menu) {
- // this set will contain menu items without mnemonics in order of length of their text
- Collection embeddingItems = new TreeSet(new Comparator() {
- public int compare(Object o1, Object o2) {
- String t1 = ((MenuItem) o1).getText();
- String t2 = ((MenuItem) o2).getText();
- int l1 = getEndingPosition(t1);
- int l2 = getEndingPosition(t2);
- if (l1 < l2) return -1;
- if (l1 > l2) return 1;
- return t1.compareTo(t2);
- }
- });
- Collection appendingItems = new ArrayList(10);
- // handle cascades, populate the set, record existing mnemonics
- MenuItem[] menuItems = menu.getItems();
- for (int i = 0; i < menuItems.length; i++) {
- MenuItem menuItem = menuItems[i];
- Menu cascade = menuItem.getMenu();
- if (cascade != null) {
- Mnemonics context = new Mnemonics();
- context.setMnemonics(cascade);
- }
- String text = menuItem.getText();
- if (text.length() > 0) {
- char ch = getMnemonic(text);
- if (ch == ' ') {
- embeddingItems.add(menuItem);
- appendingItems.add(menuItem);
- } else {
- makeUsed(ch);
- }
- }
- }
- // assign mnemonics to the items of the set
- String localePattern = getLocalePattern();
- if (isEmbedding()) {
- processMenuItems(embeddingItems, EMBED_MNEMONICS, localePattern);
- }
- if (isAppending()) {
- processMenuItems(appendingItems, APPEND_MNEMONICS, localePattern);
- }
- }
-
- private void processMenuItems(Collection collection, int flags, String localePattern) {
- for (Iterator z = collection.iterator(); z.hasNext();) {
- MenuItem menuItem = (MenuItem) z.next();
- String text = menuItem.getText();
- String newText = setUniqueMnemonic(text, flags, localePattern, true);
- if (!text.equals(newText)) {
- Image image = menuItem.getImage();
- menuItem.setText(newText);
- if (image != null) {
- menuItem.setImage(image);
- }
- }
- }
- }
-
- /**
- * Given a Composite, this method walks all the children recursively and
- * and sets the mnemonics uniquely for each child control where a
- * mnemonic makes sense (eg, buttons).
- * The letter/digit chosen for the mnemonic is unique for this Composite,
- * so you should call this on as high a level of a composite as possible
- * per window.
- * Call this after populating your controls.
- * @param parent the parent control to examine.
- */
- public void setMnemonics(Composite parent) {
- setMnemonics(parent, new HashSet());
- }
-
- /**
- * Given a Composite, this method walks all the children recursively and
- * and sets the mnemonics uniquely for each child control where a
- * mnemonic makes sense (for example, buttons).
- * The letter/digit chosen for the mnemonic is unique for this Composite,
- * so you should call this on as high a level of a composite as possible
- * per window.
- * Call this after populating your controls.
- * @param parent the parent control to examine.
- * @param ignoredControls the set of controls in which to not set mnemonics.
- * If the controls are composites, their children are also not examined.
- */
- public void setMnemonics(Composite parent, Set ignoredControls) {
- gatherCompositeMnemonics(parent);
- boolean mustLayout = setCompositeMnemonics(parent, ignoredControls);
- if (mustLayout) {
- parent.layout(true);
- }
- }
-
- private boolean setCompositeMnemonics(Composite parent, Set ignoredControls) {
- Control children[] = parent.getChildren();
- Control currentChild = null;
- boolean mustLayout = false;
- for (int i = 0; i < children.length; i++) {
- Control previousChild = currentChild;
- currentChild = children[i];
- if (!ignoredControls.contains(currentChild)) {
- if (currentChild instanceof Combo || currentChild instanceof InheritableEntryField) {
- if (applyMnemonicsToPrecedingLabels && previousChild instanceof Label) {
- Label label = (Label) previousChild;
- String text = label.getText();
- if ((text != null) && (text.trim().length() > 0)) {
- String newText = setUniqueMnemonic(text);
- if (!text.equals(newText)) {
- label.setText(newText);
- mustLayout = true;
- }
- }
- }
- } else if (currentChild instanceof Button) {
- mustLayout |= setMnemonic((Button)currentChild);
- } else if (currentChild instanceof Composite) {
- /*
- * d54732: (KM) we test Composites last since we don't want to recurse if it is a Combo.
- * For a combo, we want to check if there is a preceding label.
- * It's meaningless for a combo to have children.
- */
- mustLayout |= setCompositeMnemonics((Composite) currentChild, ignoredControls);
- } // ignore other controls
- }
- }
- return mustLayout;
- }
-
- private void gatherCompositeMnemonics(Composite parent) {
- Control children[] = parent.getChildren();
- Control currentChild = null;
- for (int i = 0; i < children.length; i++) {
- Control previousChild = currentChild;
- currentChild = children[i];
- String childText = null;
- if (currentChild instanceof Combo || currentChild instanceof InheritableEntryField || currentChild instanceof Text) {
- if (applyMnemonicsToPrecedingLabels && previousChild instanceof Label) {
- Label label = (Label) previousChild;
- childText = label.getText();
- }
- } else if (currentChild instanceof Button) {
- childText = ((Button)currentChild).getText();
- } else if (currentChild instanceof Composite) {
- gatherCompositeMnemonics((Composite) currentChild);
- } // ignore other controls
- if (childText != null) {
- char ch = getMnemonic(childText);
- makeUsed(ch);
- }
- }
- }
-
- /**
- * Set if the mnemonics are for a preference page
- * Preference pages already have a few buttons with mnemonics set by Eclipse
- * We have to make sure we do not use the ones they use
- */
- public Mnemonics setOnPreferencePage(boolean page) {
- if (page) {
- String[] labels = JFaceResources.getStrings(new String[] { "defaults", "apply" }); //$NON-NLS-1$ //$NON-NLS-2$
- String used = getMnemonicsFromStrings(labels).toUpperCase();
- makeUsed(used);
- }
- return this;
- }
-
- /**
- * Set if the mnemonics are for a wizard page
- * Wizard pages already have a few buttons with mnemonics set by Eclipse
- * We have to make sure we do not use the ones they use
- */
- public Mnemonics setOnWizardPage(boolean page) {
- if (page) {
- String[] labels = new String[] { IDialogConstants.BACK_LABEL, IDialogConstants.NEXT_LABEL, IDialogConstants.FINISH_LABEL };
- String used = getMnemonicsFromStrings(labels).toUpperCase();
- makeUsed(used);
- }
- return this;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEAdapter.java
deleted file mode 100644
index 8f9c31289..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEAdapter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [225506][api] make RSEAdapter API
- *******************************************************************************/
-package org.eclipse.rse.ui;
-
-import org.eclipse.ui.model.WorkbenchAdapter;
-
-/**
- * Abstract base class with basic implementations of the
- * <code>IRSEAdapter</code> interface. Intended to be subclassed.
- *
- * @since org.eclipse.rse.ui 3.0
- */
-public abstract class RSEAdapter extends WorkbenchAdapter implements IRSEAdapter {
-
- /**
- * Constructor.
- */
- public RSEAdapter() {
- super();
- }
-
- /**
- * The default implementation of this <code>IRSEAdapter<code> method returns the empty string.
- * Subclasses may override.
- * @see org.eclipse.rse.ui.IRSEAdapter#getDescription(java.lang.Object)
- */
- public String getDescription(Object object) {
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java
deleted file mode 100644
index 0aa6dc1d1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * - created and used RSEPreferencesManager
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [181939] avoid subsystem plugin activation just for enablement checking
- * Uwe Stieber (Wind River) - [199032] [api] Remove method acceptContextMenuActionContribution(...) from RSESystemTypeAdapter
- * Martin Oberhuber (Wind River) - [218655][api] Provide SystemType enablement info in non-UI
- ********************************************************************************/
-package org.eclipse.rse.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.IRSESystemTypeConstants;
-import org.eclipse.rse.core.RSEPreferencesManager;
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardDescriptor;
-import org.eclipse.ui.IViewPart;
-import org.osgi.framework.Bundle;
-
-/**
- * Adapter for RSE system types.
- */
-public class RSESystemTypeAdapter extends RSEAdapter {
-
- public RSESystemTypeAdapter() {
- super();
- }
-
- /**
- * Returns the image descriptor for the icon of this system type.
- * Returns the default live connection image descriptor if no icon has been configured.
- * @see org.eclipse.ui.model.WorkbenchAdapter#getImageDescriptor(java.lang.Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- ImageDescriptor img = getImage(object, IRSESystemTypeConstants.ICON);
- if (img==null) img = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CONNECTION_ID);
- return img;
- }
-
- /**
- * Returns the "live" image descriptor for this system type.
- *
- * If no "live" icon is found, but a non-live icon was specified,
- * the non-live icon is returned instead. If a non-live icon also
- * was not specified, the default live connection image descriptor
- * is returned.
- *
- * @param object The object to get an image descriptor for.
- * @return ImageDescriptor
- */
- public ImageDescriptor getLiveImageDescriptor(Object object) {
- ImageDescriptor img = getImage(object, IRSESystemTypeConstants.ICON_LIVE);
- if (img==null) img = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CONNECTIONLIVE_ID);
- return img;
- }
-
- private ImageDescriptor getImage(Object object, String propertyKey) {
-
- if ((object != null) && (object instanceof IRSESystemType)) {
- IRSESystemType sysType = (IRSESystemType)object;
-
- String property = sysType.getProperty(propertyKey);
-
- if (property != null) {
- return getImage(property, sysType.getDefiningBundle());
- }
- else {
- return null;
- }
- }
- else {
- return null;
- }
- }
-
- /**
- * Create a descriptor from the argument absolute or relative path to an
- * image file. bundle parameter is used as the base for relative paths and
- * is allowed to be null.
- *
- * @param value the absolute or relative path
- * @param definingBundle bundle to be used for relative paths (may be null)
- * @return ImageDescriptor
- */
- public static ImageDescriptor getImage(String value, Bundle definingBundle) {
- URL url = getUrl(value, definingBundle);
- return url == null ? null : ImageDescriptor.createFromURL(url);
- }
-
- /**
- * Create a URL from the argument absolute or relative path. The bundle parameter is
- * used as the base for relative paths and may be null.
- *
- * @param value the absolute or relative path
- * @param definingBundle bundle to be used for relative paths (may be null)
- * @return the URL to the resource
- */
- public static URL getUrl(String value, Bundle definingBundle) {
- URL result = null;
- try {
- if (value != null) {
- result = new URL(value);
- }
- } catch (MalformedURLException e) {
- if (definingBundle != null) {
- IPath path = new Path(value);
- result = FileLocator.find(definingBundle, path, null);
- }
- }
- return result;
- }
-
- /**
- * Returns the name of the system type if the object passed in is of type <code>IRSESystemType</code>. Otherwise, returns the value of the parent implementation.
- *
- * @see org.eclipse.ui.model.WorkbenchAdapter#getLabel(java.lang.Object)
- */
- public String getLabel(Object object) {
-
- if ((object != null) && (object instanceof IRSESystemType)) {
- return ((IRSESystemType)object).getLabel();
- }
- else {
- return super.getLabel(object);
- }
- }
-
- /**
- * Returns the description of the system type if the object passed in is of type <code>IRSESystemType</code>.
- * Otherwise, returns the value of the parent implementation.
- * @see org.eclipse.rse.ui.RSEAdapter#getDescription(java.lang.Object)
- */
- public String getDescription(Object object) {
-
- if ((object != null) && (object instanceof IRSESystemType)) {
- return ((IRSESystemType)object).getDescription();
- }
- else {
- return super.getDescription(object);
- }
- }
-
- public boolean isEnableOffline(Object object) {
- if (object instanceof IRSESystemType) {
- String property = ((IRSESystemType)object).getProperty(IRSESystemTypeConstants.ENABLE_OFFLINE);
- if (property != null) {
- return Boolean.valueOf(property).booleanValue();
- }
- else {
- return false;
- }
- }
- else {
- return false;
- }
- }
-
- /**
- * Returns the enabled state of a particular system type.
- * @param object the object being adapted, usually a system type.
- * @return true if that system type is enabled. false if the object is
- * not a system type or if it is not enabled.
- * @deprecated Clients should use {@link IRSESystemType#isEnabled()}, which is
- * available without UI dependencies, in order to guarantee consistent
- * availability of system types.
- * Providers of custom RSESystemTypeAdapter implementations, which override
- * this method, should move their code to their IRSESystemType implementations.
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=218655#c1 for details.
- */
- public final boolean isEnabled(Object object) {
- IRSESystemType systemType = getSystemType(object);
- if (systemType != null) {
- return systemType.isEnabled();
- }
- return false;
- }
-
- /**
- * Sets the enabled state of a particular system type.
- * <p>
- * Note that system types which are provided by extenders via the dynamic
- * sytemTypeProviders extension point may have their own logic to determine
- * whether they are enabled or not, so changing the enabled setting may not
- * work for them.
- *
- * @param object The system type being adapted.
- * @param isEnabled true if the system type is enabled. false if it is not.
- * @deprecated Use
- * {@link RSEPreferencesManager#setIsSystemTypeEnabled(IRSESystemType, boolean)}
- */
- public void setIsEnabled(Object object, boolean isEnabled) {
- IRSESystemType systemType = getSystemType(object);
- if ( systemType != null) {
- RSEPreferencesManager.setIsSystemTypeEnabled(systemType, isEnabled);
- }
- }
-
- /**
- * Return the default user id for a particular system type. If none
- * is defined then the "user.name" system property is used.
- * @param object The system type being adapted.
- * @return The default user id. Will be null if the object is not a system type
- */
- public String getDefaultUserId(Object object) {
- String result = null;
- IRSESystemType systemType = getSystemType(object);
- if ( systemType != null) {
- result = RSEPreferencesManager.getDefaultUserId(systemType);
- }
- return result;
- }
-
- /**
- * Set the default user id for this system type. Stored in the RSE core
- * preferences.
- *
- * @param object the system type that we are adapting
- * @param defaultUserId the id to set for this system type
- * @deprecated Use
- * {@link RSEPreferencesManager#setDefaultUserId(IRSESystemType, String)}
- */
- public void setDefaultUserId(Object object, String defaultUserId) {
- IRSESystemType systemType = getSystemType(object);
- if ( systemType != null) {
- RSEPreferencesManager.setDefaultUserId(systemType, defaultUserId);
- }
- }
-
- private static IRSESystemType getSystemType(Object systemTypeCandidate) {
- IRSESystemType result = null;
- if (systemTypeCandidate instanceof IRSESystemType) {
- result = (IRSESystemType) systemTypeCandidate;
- }
- return result;
- }
-
- /**
- * Called from <code>SystemViewPart#fillLocalToolBar(boolean)</code> to allow dynamic system
- * type providers to customize the RSE standard toolbar structure regarding their needs.
- * <p>
- * <b>Note:</b> This method is called for each system type. If a single system type adapter
- * is associated with multiple system types, this method is called multiple times.
- * Overriders must check if the required groups are added to the toolbar already
- * and must avoid to add them multiple times!
- *
- * @param view The view to customize. Must be not <code>null</code>.
- */
- public void addCustomToolbarGroups(IViewPart view) {
- // The static standard RSE system types have no custom toolbar groups.
- }
-
- /**
- * Called from {@link org.eclipse.rse.internal.ui.view.SystemView#createStandardGroups(IMenuManager)} to allow dynamic system
- * type providers to customize the RSE standard menu structure regarding their needs.
- * <p>
- * <b>Note:</b> This method is called for each system type. If a single system type adapter
- * is associated with multiple system types, this method is called multiple times.
- * Overriders must check if the required groups are added to the menu already
- * and must avoid to add them multiple times!
- *
- * @param menu The menu manager. Must be not <code>null</code>.
- */
- public void addCustomMenuGroups(IMenuManager menu) {
- // The static standard RSE system types have no custom menu groups.
- }
-
- /**
- * Checks if the given wizard descriptor is accepted for the system types the
- * adapter is covering.
- *
- * @param wizardConfigurationElementName The wizard configuration element name. Must be not <code>null</code>.
- * @param descriptor The wizard descriptor. Must be not <code>null</code>.
- *
- * @return <code>True</code> is accepted, <code>false</code> otherwise.
- */
- public boolean acceptWizardDescriptor(String wizardConfigurationElementName, IRSEWizardDescriptor descriptor) {
- assert wizardConfigurationElementName != null && descriptor != null;
-
- // We always accept the default RSE new connection wizard
- if ("org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard".equals(descriptor.getId())) { //$NON-NLS-1$
- return true;
- }
-
- return false;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
deleted file mode 100644
index a56349bd0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
+++ /dev/null
@@ -1,723 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved methods to SystemPreferencesManager.
- * Uwe Stieber (Wind River) - bugfixing.
- * David Dykstal (IBM) - 168870: move core function from UI to core
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [185554] Remove dynamicPopupMenuExtensions extension point
- * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
- * Martin Oberhuber (Wind River) - [186525] Move keystoreProviders to core
- * Martin Oberhuber (Wind River) - [186523] Move subsystemConfigurations from UI to core
- * Martin Oberhuber (Wind River) - [185552] Remove remoteSystemsViewPreferencesActions extension point
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- * David Dykstal (IBM) - [189858] Delay the creation of the remote systems project
- * David Dykstal (IBM) - [186589] move user types, user actions, and compile commands
- * API to the user actions plugin
- * David Dykstal (IBM) - [191038] initialize SystemRegistryUI without a log file, it was not used
- * David McKnight (IBM) - [196838] Don't recreate local after it has been deleted
- * David Dykstal (IBM) - [197036] formatted the initialize job to be able to read it
- * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
- * David Dykstal (IBM) - [197167] adding notification and waiting for RSE model
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [236505] Remote systems dialog not working
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-
-import java.net.URL;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemResourceManager;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.internal.core.model.SystemProfileManager;
-import org.eclipse.rse.internal.core.model.SystemRegistry;
-import org.eclipse.rse.internal.ui.RSEImageMap;
-import org.eclipse.rse.internal.ui.RSESystemTypeAdapterFactory;
-import org.eclipse.rse.internal.ui.RSEUIInitJob;
-import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapterFactory;
-import org.eclipse.rse.internal.ui.view.SubSystemConfigurationAdapterFactory;
-import org.eclipse.rse.internal.ui.view.SystemViewAdapterFactory;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewResourceAdapterFactory;
-import org.eclipse.rse.persistence.IRSEPersistenceManager;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
-import org.eclipse.rse.ui.internal.model.SystemRegistryUI;
-import org.eclipse.rse.ui.model.ISystemRegistryUI;
-import org.osgi.framework.BundleContext;
-
-
-/**
- * Plugin for the core remote systems support.
- */
-public class RSEUIPlugin extends SystemBasePlugin
-{
-
- public static final String PLUGIN_ID = "org.eclipse.rse.ui"; //$NON-NLS-1$
- public static final String HELPPREFIX = "org.eclipse.rse.ui."; //$NON-NLS-1$
-
- public static final boolean INCLUDE_LOCAL_YES = true;
- public static final boolean INCLUDE_LOCAL_NO = false;
- private static RSEUIPlugin inst = null;
-
- private static SystemMessageFile messageFile = null;
- private static SystemMessageFile defaultMessageFile = null;
-
- private Vector viewSuppliers = new Vector();
- private SystemViewAdapterFactory svaf; // for fastpath access
- private SystemTeamViewResourceAdapterFactory svraf; // for fastpath
- private boolean loggingSystemMessageLine = false;
-
- /**
- * Constructor for SystemsPlugin
- */
- public RSEUIPlugin()
- {
- super();
-
- if (inst == null)
- {
- inst = this;
- }
- }
-
- /**
- * Return singleton. Same as inherited getBaseDefault but returned object
- * is typed as RSEUIPlugin versus SystemBasePlugin.
- */
- public static RSEUIPlugin getDefault()
- {
- return inst;
- }
-
- /**
- * Initializes preferences.
- */
- public void initializeDefaultPreferences() {
- SystemPreferencesManager.initDefaults();
- }
-
- /**
- * Set whether or not to log the messages shown on the system message line for dialogs
- * and wizards. These message are typically validation messages for fields.
- * These are logged using the RSE logging settings. The default is to not log
- * these messages.
- * @param flag true if logging of these messages is desired, false otherwise.
- */
- public void setLoggingSystemMessageLine(boolean flag) {
- loggingSystemMessageLine = flag;
- }
-
- /**
- * @return true if we are logging messages displayed on the system message line.
- */
- public boolean getLoggingSystemMessageLine() {
- return loggingSystemMessageLine;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.SystemBasePlugin#initializeImageRegistry()
- */
- protected void initializeImageRegistry()
- {
- //SystemElapsedTimer timer = new SystemElapsedTimer();
- //timer.setStartTime();
- String path = getIconPath();
- // Wizards...
- /*
- putImageInRegistry(ISystemConstants.ICON_SYSTEM_NEWWIZARD_ID,
- path+ISystemConstants.ICON_SYSTEM_NEWWIZARD);
- */
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWPROFILEWIZARD_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWPROFILEWIZARD);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTIONWIZARD_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWCONNECTIONWIZARD);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLWIZARD_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLWIZARD);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILTERWIZARD_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFILTERWIZARD);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_NEWFILTERSTRINGWIZARD_ID,
- // path+ISystemConstants.ICON_SYSTEM_NEWFILTERSTRINGWIZARD);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILEWIZARD_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFILEWIZARD);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFOLDERWIZARD_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFOLDERWIZARD);
-
- // Things...
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_PROFILE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_PROFILE_ACTIVE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CONNECTION_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CONNECTION);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CONNECTIONLIVE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CONNECTIONLIVE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID,
- path+ISystemIconConstants.ICON_SYSTEM_FILTERPOOL);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_FILTER_ID,
- path+ISystemIconConstants.ICON_SYSTEM_FILTER);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_FILTERSTRING_ID,
- path+ISystemIconConstants.ICON_SYSTEM_FILTERSTRING);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_FILE_ID,
- // path+ISystemConstants.ICON_SYSTEM_FILE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID,
- path+ISystemIconConstants.ICON_SYSTEM_FOLDER);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_FOLDEROPEN_ID,
- // path+ISystemConstants.ICON_SYSTEM_FOLDEROPEN);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_ROOTDRIVE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_ROOTDRIVE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_ROOTDRIVEOPEN_ID,
- path+ISystemIconConstants.ICON_SYSTEM_ROOTDRIVEOPEN);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_PROCESS_ID,
- path+ISystemIconConstants.ICON_SYSTEM_PROCESS);
-
-// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_TARGET_ID,
- // path+ISystemIconConstants.ICON_SYSTEM_TARGET);
-
- // Message icons: REDUNDANT
- /*
- putImageInRegistry(ISystemConstants.ICON_SYSTEM_SMALLERROR_ID,
- path+ISystemConstants.ICON_SYSTEM_SMALLERROR);
- putImageInRegistry(ISystemConstants.ICON_SYSTEM_SMALLWARNING_ID,
- path+ISystemConstants.ICON_SYSTEM_SMALLWARNING);
- putImageInRegistry(ISystemConstants.ICON_SYSTEM_SMALLINFO_ID,
- path+ISystemConstants.ICON_SYSTEM_SMALLINFO);
- */
-
- // New Actions...
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEW_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEW);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWPROFILE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWPROFILE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTION_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWCONNECTION);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOL_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOL);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLREF_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFILTERPOOLREF);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILTER_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFILTER);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_NEWFILTERSTRING_ID,
- // path+ISystemConstants.ICON_SYSTEM_NEWFILTERSTRING);
-
- // Other Actions...
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_PULLDOWN_ID,
- // path+ISystemConstants.ICON_SYSTEM_PULLDOWN);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_LOCK_ID,
- path+ISystemIconConstants.ICON_SYSTEM_LOCK);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID,
- path+ISystemIconConstants.ICON_SYSTEM_MOVEUP);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID,
- path+ISystemIconConstants.ICON_SYSTEM_MOVEDOWN);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_COPY_ID,
- // path+ISystemConstants.ICON_SYSTEM_COPY);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_PASTE_ID,
- // path+ISystemConstants.ICON_SYSTEM_PASTE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_MOVE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_MOVE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CLEAR_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CLEAR);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CLEAR_ALL_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CLEAR_ALL);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CLEAR_SELECTED_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CLEAR_SELECTED);
-
-
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_DELETE_ID,
- // path+ISystemConstants.ICON_SYSTEM_DELETE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_DELETEREF_ID,
- path+ISystemIconConstants.ICON_SYSTEM_DELETEREF);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_RENAME_ID,
- path+ISystemIconConstants.ICON_SYSTEM_RENAME);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_RUN_ID,
- path+ISystemIconConstants.ICON_SYSTEM_RUN);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_STOP_ID,
- path+ISystemIconConstants.ICON_SYSTEM_STOP);
-// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_COMPILE_ID,
-// path+ISystemIconConstants.ICON_SYSTEM_COMPILE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEACTIVE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEACTIVE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEINACTIVE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_MAKEPROFILEINACTIVE);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_CHANGEFILTERSTRING_ID,
- // path+ISystemConstants.ICON_SYSTEM_CHANGEFILTERSTRING);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SELECTPROFILE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_SELECTPROFILE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SELECTFILTERPOOLS_ID,
- path+ISystemIconConstants.ICON_SYSTEM_SELECTFILTERPOOLS);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS_ID,
- path+ISystemIconConstants.ICON_SYSTEM_WORKWITHFILTERPOOLS);
-// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS_ID,
-// path+ISystemIconConstants.ICON_SYSTEM_WORKWITHUSERACTIONS);
-// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHNAMEDTYPES_ID,
-// path+ISystemIconConstants.ICON_SYSTEM_WORKWITHNAMEDTYPES);
-// putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS_ID,
-// path+ISystemIconConstants.ICON_SYSTEM_WORKWITHCOMPILECMDS);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID,
- path+ISystemIconConstants.ICON_SYSTEM_REFRESH);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFILE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFILE);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_NEWFOLDER_ID,
- path+ISystemIconConstants.ICON_SYSTEM_NEWFOLDER);
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_COLLAPSEALL_ID,
- // path+ISystemConstants.ICON_SYSTEM_COLLAPSEALL); // defect 41203 D54577
-
-
-
-
-
-
-
- // System view icons...
- //putImageInRegistry(ISystemConstants.ICON_SYSTEM_VIEW_ID, // only needed from plugin.xml
- // path+ISystemConstants.ICON_SYSTEM_VIEW);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_ERROR_ID,
- path+ISystemIconConstants.ICON_SYSTEM_ERROR);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_INFO_ID,
- path+ISystemIconConstants.ICON_SYSTEM_INFO);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_INFO_TREE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_INFO_TREE);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CANCEL_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CANCEL);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_HELP_ID,
- path+ISystemIconConstants.ICON_SYSTEM_HELP);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_EMPTY_ID,
- path+ISystemIconConstants.ICON_SYSTEM_EMPTY);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_OK_ID,
- path+ISystemIconConstants.ICON_SYSTEM_OK);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_WARNING_ID,
- path+ISystemIconConstants.ICON_SYSTEM_WARNING);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_BLANK_ID,
- path+ISystemIconConstants.ICON_SYSTEM_BLANK);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SEARCH_ID,
- path+ISystemIconConstants.ICON_SYSTEM_SEARCH);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SEARCH_RESULT_ID,
- path+ISystemIconConstants.ICON_SYSTEM_SEARCH_RESULT);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SHOW_TABLE_ID,
- path + ISystemIconConstants.ICON_SYSTEM_SHOW_TABLE);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SHOW_MONITOR_ID,
- path + ISystemIconConstants.ICON_SYSTEM_SHOW_MONITOR);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_PERSPECTIVE_ID,
- path + ISystemIconConstants.ICON_SYSTEM_PERSPECTIVE);
-
- putImageInRegistry(ISystemIconConstants.ICON_SEARCH_REMOVE_SELECTED_MATCHES_ID,
- path + ISystemIconConstants.ICON_SEARCH_REMOVE_SELECTED_MATCHES);
-
- putImageInRegistry(ISystemIconConstants.ICON_SEARCH_REMOVE_ALL_MATCHES_ID,
- path + ISystemIconConstants.ICON_SEARCH_REMOVE_ALL_MATCHES);
-
- /**
- putImageInRegistry(ISystemConstants.ICON_INHERITWIDGET_LOCAL_ID,
- path+ISystemConstants.ICON_INHERITWIDGET_LOCAL);
- putImageInRegistry(ISystemConstants.ICON_INHERITWIDGET_INHERIT_ID,
- path+ISystemConstants.ICON_INHERITWIDGET_INHERIT);
- putImageInRegistry(ISystemConstants.ICON_INHERITWIDGET_INTERIM_ID,
- path+ISystemConstants.ICON_INHERITWIDGET_INTERIM);
- */
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_ARROW_UP_ID,
- path+ISystemIconConstants.ICON_SYSTEM_ARROW_UP);
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN_ID,
- path+ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_CONNECTOR_SERVICE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_CONNECTOR_SERVICE);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_SERVICE_ID,
- path+ISystemIconConstants.ICON_SYSTEM_SERVICE);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_LAUNCHER_CONFIGURATION_ID,
- path+ISystemIconConstants.ICON_SYSTEM_LAUNCHER_CONFIGURATION);
-
- putImageInRegistry(ISystemIconConstants.ICON_SYSTEM_PROPERTIES_ID,
- path+ISystemIconConstants.ICON_SYSTEM_PROPERTIES);
-
- // close to 1 second...
- //timer.setEndTime();
- //System.out.println("Time to load images: "+timer);
- }
-
-
-
- /**
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception
- {
- super.start(context);
-
- messageFile = getMessageFile("systemmessages.xml"); //$NON-NLS-1$
- defaultMessageFile = getDefaultMessageFile("systemmessages.xml"); //$NON-NLS-1$
-
- //Force load the SystemRegistry - TODO Is this really necessary?
- RSECorePlugin.getTheSystemRegistry();
-
- IAdapterManager manager = Platform.getAdapterManager();
-
- // DKM
- // for subsystem factories
- SubSystemConfigurationAdapterFactory ssfaf = new SubSystemConfigurationAdapterFactory();
- ssfaf.registerWithManager(manager);
-
- RSESystemTypeAdapterFactory rseSysTypeFactory = new RSESystemTypeAdapterFactory();
- rseSysTypeFactory.registerWithManager(manager);
-
- manager.registerAdapters(new SubSystemConfigurationProxyAdapterFactory(), ISubSystemConfigurationProxy.class);
-
- svaf = new SystemViewAdapterFactory();
- svaf.registerWithManager(manager);
-
- svraf = new SystemTeamViewResourceAdapterFactory();
- svraf.registerWithManager(manager);
-
- Job initJob = new RSEUIInitJob();
- initJob.schedule();
- }
-
- /**
- * For fastpath access to our adapters for non-local objects in our model.
- * Exploits the knowledge we use singleton adapters.
- *
- * @since 3.0 returning IAdapterFactory rather than SystemViewAdapterFactory
- */
- public IAdapterFactory getSystemViewAdapterFactory()
- {
- return svaf;
- }
-
- /**
- * Restart the whole thing after a team synchronization
- */
- public void restart()
- {
- if (RSECorePlugin.isTheSystemRegistryActive()) {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- // disconnect all active connections
- disconnectAll(false); // don't save ?
- // collapse and flush all nodes in all views
- sr.fireEvent(new SystemResourceChangeEvent("dummy", ISystemResourceChangeEvents.EVENT_COLLAPSE_ALL, null)); //$NON-NLS-1$
-
- // allow child classes to override
- closeViews();
-
- // clear in-memory settings for all filter pools and subsystems
- ISubSystemConfigurationProxy[] proxies = sr.getSubSystemConfigurationProxies();
- if (proxies != null) {
- for (int idx=0; idx < proxies.length; idx++)
- proxies[idx].reset();
- }
- // clear in-memory settings for all profiles
- SystemProfileManager.clearDefault();
-
- // rebuild profiles
- RSECorePlugin.getTheSystemProfileManager(); // create folders per profile
- // clear in-memory settings for all connections, then restore from disk
- ((SystemRegistry)sr).reset();
- // restore in-memory settings for all filter pools and subsystems
- if (proxies != null) {
- for (int idx=0; idx < proxies.length; idx++)
- proxies[idx].restore();
- }
-
- // refresh GUIs
- sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH, null));
-
- // allow child classes to override
- openViews();
- }
- }
-
- /**
- * Close or reset views prior to full refresh after team synch
- */
- public void closeViews()
- {
- for (int idx=0; idx<viewSuppliers.size(); idx++)
- {
- try {
- ((ISystemViewSupplier)viewSuppliers.elementAt(idx)).closeViews();
- } catch (Exception exc)
- {
- }
- }
- }
-
- /**
- * Restore views prior to full refresh after team synch
- */
- public void openViews()
- {
- for (int idx=0; idx<viewSuppliers.size(); idx++)
- {
- try {
- ((ISystemViewSupplier)viewSuppliers.elementAt(idx)).openViews();
- } catch (Exception exc)
- {
- }
- }
- }
-
- /**
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- RSEImageMap.shutdown();
-
- // disconnect all active connections
- disconnectAll(true);
-
- // remove workspace listener for our project
- SystemResourceManager.endResourceEventListening();
-
- // call this last
- super.stop(context);
- }
-
- /**
- * Disconnect all subsystems
- */
- protected void disconnectAll(boolean doSave)
- {
- if (RSECorePlugin.isTheSystemRegistryActive())
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISubSystemConfigurationProxy[] proxies = sr.getSubSystemConfigurationProxies();
- if (proxies != null)
- {
- for (int idx=0; idx < proxies.length; idx++)
- {
- //System.out.println("In shutdown. proxy " + proxies[idx].getId() + " active? " + proxies[idx].isSubSystemConfigurationActive());
- if (proxies[idx].isSubSystemConfigurationActive())
- {
- ISubSystemConfiguration ssf = proxies[idx].getSubSystemConfiguration();
- try
- {
- ssf.disconnectAllSubSystems();
- } catch(Exception exc)
- {
- logError("Error disconnecting for "+ssf.getId(),exc); //$NON-NLS-1$
- }
- if (doSave)
- {
- try
- {
- // TODO on shutdown classloader might not be able to do this properly
- // ssf.commit();
- } catch(Exception exc)
- {
- logError("Error saving subsystems for "+ssf.getId(),exc); //$NON-NLS-1$
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Test if the SystemRegistry has been instantiated already.
- * Use this when you don't want to start the system registry as a side effect of retrieving it.
- * @return <code>true</code> if the System Registry has been instantiated already.
- * @deprecated use {@link RSECorePlugin#isTheSystemRegistryActive()}
- */
- public boolean isSystemRegistryActive()
- {
- return RSECorePlugin.isTheSystemRegistryActive();
- }
-
- /**
- * Return the persistence manager used for persisting RSE profiles.
- * @return the persistence manager used for persisting RSE profiles
- * @deprecated use {@link RSECorePlugin#getThePersistenceManager()}
- */
- public IRSEPersistenceManager getPersistenceManager()
- {
- return RSECorePlugin.getThePersistenceManager();
- }
-
- /**
- * Return the SystemRegistryUI singleton.
- * @return the SystemRegistryUI singleton.
- */
- public static ISystemRegistryUI getTheSystemRegistryUI()
- {
- return SystemRegistryUI.getInstance();
- }
-
- /**
- * Return the master profile manager singleton.
- * @return the RSE Profile Manager Singleton.
- * @deprecated use {@link RSECorePlugin#getTheSystemProfileManager()}
- */
- public static ISystemProfileManager getTheSystemProfileManager()
- {
- return RSECorePlugin.getTheSystemProfileManager();
- }
-
- /**
- * Check if the SystemRegistry has been instantiated already.
- * Use this when you don't want to start the system registry as a side effect
- * of retrieving it.
- * @return <code>true</code> if the System Registry has been instantiated already.
- * @deprecated use {@link RSECorePlugin#isTheSystemRegistryActive()}
- */
- public static boolean isTheSystemRegistryActive() {
- return RSECorePlugin.isTheSystemRegistryActive();
- }
-
- /**
- * @return The URL to the message file DTD. Null if it is not found.
- */
- public URL getMessageFileDTD() {
- URL result = getBundle().getEntry("/messageFile.dtd"); //$NON-NLS-1$
- return result;
- }
-
- /**
- * Load a message file for this plugin.
- * @param messageFileName - the name of the message xml file. Will look for it in this plugin's install folder.
- * @return a message file object containing the parsed contents of the message file, or null if not found.
- */
- public SystemMessageFile getMessageFile(String messageFileName)
- {
- return loadMessageFile(getBundle(), messageFileName);
- }
-
- /**
- * Load a default message file for this plugin for cases where messages haven't been translated.
- * @param messageFileName - the name of the message xml file. Will look for it in this plugin's install folder.
- * @return a message file object containing the parsed contents of the message file, or null if not found.
- */
- public SystemMessageFile getDefaultMessageFile(String messageFileName)
- {
- return loadDefaultMessageFile(getBundle(), messageFileName);
- }
-
- /**
- * Return this plugin's message file. Assumes it has already been loaded via a call to getMessageFile.
- */
- public static SystemMessageFile getPluginMessageFile()
- {
- return messageFile;
- }
-
- public SystemMessage getMessage(String msgId)
- {
- return getPluginMessage(msgId);
- }
-
- /**
- * Retrieve a message from this plugin's message file
- * @param msgId - the ID of the message to retrieve. This is the concatenation of the
- * message's component abbreviation, subcomponent abbreviation, and message ID as declared
- * in the message xml file.
- */
- public static SystemMessage getPluginMessage(String msgId)
- {
- SystemMessage msg = getMessage(messageFile, msgId);
- if (msg == null)
- {
- msg = getMessage(defaultMessageFile, msgId);
- }
- return msg;
- }
- /**
- * Retrieve a message from this plugin's message file and do multiple substitution on it.
- * @param msgId - the ID of the message to retrieve. This is the concatenation of the
- * message's component abbreviation, subcomponent abbreviation, and message ID as declared
- * in the message xml file.
- * @param subsVars - an array of objects to substitute in for %1, %2, etc
- */
- public static SystemMessage getPluginMessage(String msgId, Object[] subsVars)
- {
- SystemMessage msg = getMessage(messageFile, msgId);
- if (msg == null)
- {
- msg = getMessage(defaultMessageFile, msgId);
- }
- if ((msg != null) && (subsVars!=null) && (subsVars.length>0) && (msg.getNumSubstitutionVariables()>0))
- {
- msg.makeSubstitution(subsVars);
- }
- return msg;
- }
- /**
- * Retrieve a message from this plugin's message file and do single substitution on it.
- * @param msgId - the ID of the message to retrieve. This is the concatenation of the
- * message's component abbreviation, subcomponent abbreviation, and message ID as declared
- * in the message xml file.
- * @param subsVar - an array of objects to substitute in for %1, %2, etc.
- * @return the message.
- */
- public static SystemMessage getPluginMessage(String msgId, Object subsVar)
- {
- SystemMessage msg = getMessage(messageFile, msgId);
- if (msg == null)
- {
- msg = getMessage(defaultMessageFile, msgId);
- }
- if ((msg != null) && (subsVar!=null) && (msg.getNumSubstitutionVariables()>0))
- {
- msg.makeSubstitution(subsVar);
- }
- return msg;
- }
-
- /**
- * Register a view supplier so we can ask them to participate in team synchs
- */
- public void registerViewSupplier(ISystemViewSupplier vs)
- {
- viewSuppliers.add(vs);
- }
- /**
- * UnRegister a previously registered view supplier
- */
- public void unRegisterViewSupplier(ISystemViewSupplier vs)
- {
- if (viewSuppliers.contains(vs))
- viewSuppliers.remove(vs);
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemActionViewerFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemActionViewerFilter.java
deleted file mode 100644
index 38aa50464..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemActionViewerFilter.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [190442] Moved from org.eclipse.rse.internal.ui.view
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-
-/**
- * This class is a viewer filter that tests attributes of thise
- */
-public class SystemActionViewerFilter extends ViewerFilter {
-
- /**
- * Inner class representing a filter criterion.
- */
- private class FilterCriterion {
-
- private String name;
- private String value;
-
- /**
- * Constructor.
- * @param name the name.
- * @param value the value.
- */
- private FilterCriterion(String name, String value) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Returns the name.
- * @return the name.
- */
- private String getName() {
- return name;
- }
-
- /**
- * Returns the value.
- * @return the value.
- */
- private String getValue() {
- return value;
- }
- }
-
- // list to hold filter criteria for each object type
- private HashMap map;
-
- /**
- * Constructor.
- */
- public SystemActionViewerFilter() {
- super();
- map = new HashMap();
- }
-
- /**
- * Adds a filter criterion.
- * @param objectTypes object types that the filter criterion applies to.
- * @param name the name.
- * @param value the value.
- */
- public void addFilterCriterion(Class[] objectTypes, String name, String value) {
- FilterCriterion criterion = new FilterCriterion(name, value);
-
- // go through each object type
- for (int i = 0; i < objectTypes.length; i++) {
- Class type = objectTypes[i];
-
- List criteria = null;
-
- // we do not have object type, so add it
- if (!map.containsKey(type)) {
- criteria = new ArrayList();
- }
- // we already have object type, so get its list of criteria
- else {
- criteria = (List)(map.get(type));
- }
-
- // add criterion to list
- criteria.add(criterion);
-
- // put type and list of criteria in map
- map.put(type, criteria);
- }
- }
-
- /**
- * Removes all criteria.
- */
- public void removeAllCriterion() {
- map.clear();
- }
-
- /**
- * Checks if the object is an instance of any of the types in our list, and returns the
- * type for which the object is an instance.
- * @param obj the object.
- * @return the type for which the object is an instance, or <code>null</code> if no type was
- * found.
- */
- private Class isInstance(Object obj) {
-
- // get set of types
- Set keySet = map.keySet();
-
- // get the iterator
- Iterator iter = keySet.iterator();
-
- // go through iterator
- while (iter.hasNext()) {
- Class objType = (Class)(iter.next());
-
- // check if object is an instance of the object type
- if (objType.isInstance(obj)) {
- return objType;
- }
- }
-
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public boolean select(Viewer viewer, Object parentElement, Object element) {
-
-
-
- // check if the object is an instance of one of the object types we want to filter
- Class objType = isInstance(element);
-
- // no object type found, so let it through
- if (objType == null) {
- return true;
- }
-
- ISystemViewElementAdapter adapter = null;
-
- // get adapter
- if (element instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable)element;
-
- adapter = (ISystemViewElementAdapter)(adaptable.getAdapter(ISystemViewElementAdapter.class));
- if (adapter == null)
- {
- // might be deferred stuff
- return true;
- }
-
-
- // get list of criteria
- List criteria = (List)(map.get(objType));
-
- // get iterator
- Iterator iter = criteria.iterator();
-
- // go through list of criterion, make sure one of them matches
- while (iter.hasNext()) {
- FilterCriterion criterion = (FilterCriterion)(iter.next());
-
- boolean testResult = adapter.testAttribute(element, criterion.getName(), criterion.getValue());
-
- if (testResult) {
- return true;
- }
- }
-
- return false;
- }
-
- return true;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java
deleted file mode 100644
index a8382152c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBaseForm.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-
-import java.util.Vector;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardErrorUpdater;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * A reusable base form.
- * <p>
- * May be used to populate a dialog or a wizard page or properties page.
- * Often we need to support multiple ways to edit the same thing, and we need to
- * abstract out the client area. This base class puts some structure around these
- * abstractions. Note we don't extend Composite. Rather the subclass will create
- * and return the composite in createContents(). This offers us more flexibility
- * in how/where this is used.
- * <p>
- * For error checking, subclasses should simply call setPageComplete whenever they
- * do error checking (such as in response to an event). This will then call any
- * interested listeners who have registered via {@link #addPageCompleteListener(ISystemPageCompleteListener)}.
- * Error messages should be set via {@link #showErrorMessage(SystemMessage)}.
- */
-
-public abstract class SystemBaseForm
- implements Listener, ISystemConnectionWizardErrorUpdater //
-{
-
- private ISystemMessageLine msgLine;
- private Shell shell;
- private Object inputObject, outputObject;
- private Vector pageCompleteListeners;
- private boolean complete;
- protected Vector verifyListeners;
- protected boolean alreadyNotified;
-
- /**
- * Constructor.
- * @deprecated You should now use the constructor that takes a shell.
- * @param msgLine A GUI widget capable of writing error messages to.
- */
- public SystemBaseForm(ISystemMessageLine msgLine)
- {
- this.msgLine = msgLine;
- }
- /**
- * Constructor.
- * @param shell The parent shell.
- * @param msgLine A GUI widget capable of writing error messages to.
- */
- public SystemBaseForm(Shell shell, ISystemMessageLine msgLine)
- {
- this.msgLine = msgLine;
- this.shell = shell;
- }
-
- /**
- * Often the message line is null at the time of instantiation, so we have to call this after
- * it is created.
- */
- public void setMessageLine(ISystemMessageLine msgLine)
- {
- this.msgLine = msgLine;
- }
- /**
- * Return the message line as set via setMessageLine
- */
- public ISystemMessageLine getMessageLine()
- {
- return msgLine;
- }
- /**
- * Occassionally we don't know the shell at constructor time, so we need to be able to set it later
- */
- public void setShell(Shell shell)
- {
- this.shell = shell;
- }
- /**
- * Return the shell as set via setShell(Shell)
- */
- public Shell getShell()
- {
- return shell;
- }
- /**
- * Set the input object. This is usually set to the current selection, from where
- * the dialog/page is launched. This matches similar inputObject support in the
- * RSE classes for dialogs and wizards.<br>
- * This is usually set by the using dialog/pane, and queried by this object.
- */
- public void setInputObject(Object inputObject)
- {
- this.inputObject = inputObject;
- }
- /**
- * Return the input object as set by {@link #setInputObject(Object)}.
- */
- protected Object getInputObject()
- {
- return inputObject;
- }
- /**
- * Set the output object. This is usually set by this object, and is subsequently
- * queried by the using dialog/page.
- */
- protected void setOutputObject(Object outputObject)
- {
- this.outputObject = outputObject;
- }
- /**
- * Return the output object as set by {@link #setOutputObject(Object)}.
- */
- public Object getOutputObject()
- {
- return outputObject;
- }
-
- /**
- * Default implementation to satisfy Listener interface. Does nothing.
- */
- public void handleEvent(Event evt) {}
-
- /**
- * Register an interest in knowing whenever {@link #setPageComplete(boolean)} is
- * called by subclass code.
- */
- public void addPageCompleteListener(ISystemPageCompleteListener l)
- {
- if (pageCompleteListeners == null)
- pageCompleteListeners = new Vector();
- pageCompleteListeners.add(l);
- }
- /**
- * De-register a page complete listener.
- */
- public void removePageCompleteListener(ISystemPageCompleteListener l)
- {
- if (pageCompleteListeners != null)
- pageCompleteListeners.remove(l);
- }
-
- /**
- * The completeness of the page has changed.
- * We direct it to the Apply button versus just the OK button
- * @see #addPageCompleteListener(ISystemPageCompleteListener)
- */
- protected void setPageComplete(boolean complete)
- {
- this.complete = complete;
- if (pageCompleteListeners != null)
- {
- for (int idx=0; idx<pageCompleteListeners.size(); idx++)
- {
- ISystemPageCompleteListener l = (ISystemPageCompleteListener)pageCompleteListeners.elementAt(idx);
- l.setPageComplete(complete);
- }
- }
- }
- /**
- * Return the current completeness value, as last set by {@link #setPageComplete(boolean)}.
- */
- public boolean isPageComplete()
- {
- return complete;
- }
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- * @param parent The parent composite
- */
- public abstract Control createContents(Composite parent);
-
-
-
- // -----------------
- // HELPER METHODS...
- // -----------------
-
- /**
- * Display error message or clear error message (if passed null)
- */
- protected void showErrorMessage(SystemMessage msg)
- {
- if (msgLine != null)
- {
- if (msg != null)
- msgLine.setErrorMessage(msg);
- else
- msgLine.clearErrorMessage();
- }
- }
-
- /**
- * Add a separator line. This is a physically visible line.
- */
- protected Label addSeparatorLine(Composite parent, int nbrColumns)
- {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(data);
- return separator;
- }
- /**
- * Add a spacer line
- */
- protected Label addFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- filler.setLayoutData(data);
- return filler;
- }
- /**
- * Add a spacer line that grows in height to absorb extra space
- */
- protected Label addGrowableFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.grabExcessVerticalSpace = true;
- filler.setLayoutData(data);
- return filler;
- }
-
- /**
- * Register an interest in knowing whenever the form is
- * verified and error messages are updated.
- */
- public void addVerifyListener(ISystemVerifyListener l)
- {
- if (verifyListeners == null)
- verifyListeners = new Vector();
- verifyListeners.add(l);
- }
-
- protected void notifyVerifyListeners()
- {
- if (alreadyNotified == true)
- return; // prevent recursion
- if (verifyListeners == null) return;
- alreadyNotified = true;
- for (int i = 0; i < verifyListeners.size(); i++)
- {
- ((ISystemVerifyListener)verifyListeners.get(i)).handleVerifyComplete();
- }
- alreadyNotified = false;
- }
-
-
- /**
- * De-register a verify listener.
- */
- public void removePageCompleteListener(ISystemVerifyListener l)
- {
- if (verifyListeners != null)
- verifyListeners.remove(l);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.propertypages.ISystemConnectionWizardErrorUpdatingPropertyPage#getTheErrorMessage()
- */
- public String getTheErrorMessage()
- {
- return null;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBasePlugin.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBasePlugin.java
deleted file mode 100644
index 8d03e47d6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemBasePlugin.java
+++ /dev/null
@@ -1,810 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [243263] NPE on expanding a filter
- * David McKnight (IBM) - [244454] SystemBasePlugin.getWorkBench() incorrectly returns null when called during Eclipse startup
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.Stack;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.rse.logging.Logger;
-import org.eclipse.rse.logging.LoggerFactory;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
-import org.eclipse.rse.ui.messages.SystemUIMessageFile;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchListener;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * A base plugin class offering common operations.
- */
-public abstract class SystemBasePlugin extends AbstractUIPlugin
-{
-
- // static variables
- private static SystemBasePlugin baseInst = null;
-
- /**
- * Logger object for logging messages for servicing purposes.
- */
- protected static Logger log = null;
-
- /**
- * Active workbench window
- */
- private static volatile IWorkbenchWindow activeWindow = null;
- private static volatile IWorkbenchWindow previousActiveWindow = null;
- private static IWindowListener windowListener = null;
- private static IWorkbenchListener workbenchListener = null;
-
- // instance variables
- private Hashtable imageDescriptorRegistry = null;
-
- /**
- * Returns the singleton object representing the base plugin.
- * @return the singleton object.
- */
- public static SystemBasePlugin getBaseDefault() {
- return baseInst;
- }
-
- /**
- * Returns the active workbench shell.
- * @return the active workbench shell.
- */
- public static Shell getActiveWorkbenchShell() {
-
- IWorkbenchWindow window = getActiveWorkbenchWindow();
- if (window != null) {
- return window.getShell();
- }
- Display d = Display.getCurrent();
- if (d!=null) return d.getActiveShell();
- d = Display.getDefault();
- if (d!=null) return d.getActiveShell();
- return null;
- }
-
- /**
- * Returns the active workbench window.
- * @return the active workbench window.
- */
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
-
- IWorkbench wb = null;
-
- try {
- wb = getBaseDefault().getWorkbench();
- }
- catch (Exception exc) {
- // in headless mode
- wb = null;
- }
-
- // if we are not in headless mode
- if (wb != null) {
-
- // if in user interface thread, return the workbench active window
- if (Display.getCurrent() != null) {
- return wb.getActiveWorkbenchWindow();
- }
- // otherwise, get a list of all the windows, and try to guess which one is right
- // KM: why do we need this??
- else {
- // for bug 244454, this ends up returning the wrong window
- // the correct solution involves:
- // - returning null when called from a non-UI thread
- // - making sure that callers handle and understand that
- // - null may be returned
- //
- // but for now (in 3.0.1) we're leaving this because
- // there are several callers that don't expect null and
- // will fail if we make the change now
- //
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- if (windows != null && windows.length > 0) {
- if (windows.length == 1) {
- return windows[0];
- } else {
- IWorkbenchWindow bestCandidate = windows[0];
- int candidateRank = 0;
- for (int i = 0; i < windows.length; i++) {
- if (windows[i] == activeWindow) {
- return activeWindow;
- } else if (windows[i] == previousActiveWindow) {
- //Windows get deactivated when a sub-dialog is opened or user switches
- //to another application. Such action still makes the previous window
- //the best candidate for the active one.
- bestCandidate = previousActiveWindow;
- candidateRank=10;
- } else if (windows[i].getActivePage()!= null && candidateRank==0) {
- bestCandidate = windows[i];
- candidateRank = 1;
- }
- }
- return bestCandidate;
- }
- }
- }
- }
- return null;
- }
-
- private static class WindowListener implements IWindowListener {
- public void windowActivated(IWorkbenchWindow window) {
- activeWindow = window;
- previousActiveWindow = null; // not needed any more, allow gc
- }
-
- public void windowDeactivated(IWorkbenchWindow window) {
- if (window == activeWindow) {
- previousActiveWindow = activeWindow;
- activeWindow = null;
- }
- }
-
- public void windowClosed(IWorkbenchWindow window) {
- windowDeactivated(window);
- }
-
- public void windowOpened(IWorkbenchWindow window) {
- }
- }
-
- private static class WorkbenchListener implements IWorkbenchListener {
- public boolean preShutdown(IWorkbench workbench, boolean forced) {
- return true;
- }
-
- public void postShutdown(IWorkbench workbench) {
- synchronized (WindowListener.class) {
- assert windowListener != null;
- workbench.removeWindowListener(windowListener);
- workbench.removeWorkbenchListener(workbenchListener);
- workbenchListener = null;
- windowListener = null;
- }
- }
- }
-
- private static void addWindowListener() {
- synchronized (WindowListener.class) {
- if (windowListener == null) {
- try {
- IWorkbench wb = PlatformUI.getWorkbench();
- windowListener = new WindowListener();
- wb.addWindowListener(windowListener);
- workbenchListener = new WorkbenchListener();
- wb.addWorkbenchListener(workbenchListener);
- } catch (IllegalStateException e) {
- /* will try again later when workbench becomes available */
- System.out.println("Workbench not yet available"); //$NON-NLS-1$
- }
- }
- }
- }
-
- /**
- * Returns the workspace root.
- * @return the workspace root.
- */
- public static IWorkspaceRoot getWorkspaceRoot() {
- return getWorkspace().getRoot();
- }
-
- /**
- * Returns the workspace.
- * @return the workspace.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * @return the prefix of the path for icons, i.e. "icons/".
- */
- public static String getIconPath() {
- return "icons/"; //$NON-NLS-1$
- }
-
- /**
- * Retrieve image in any plugin's directory tree, given its file name.
- * The file name should be qualified relative to this plugin's bundle. Eg "icons/myicon.gif"
- */
- public static ImageDescriptor getPluginImage(Bundle bundle, String fileName)
- {
- URL path = bundle.getEntry("/" + fileName); //$NON-NLS-1$
- ImageDescriptor descriptor = ImageDescriptor.createFromURL(path);
- return descriptor;
- }
-
- // ------------------
- // MESSAGE METHODS...
- // ------------------
-
- /**
- * Resolves the bundle relative name to its URL inside a bundle if the resource
- * named by that name exists. Returns null if the resources does not exist.
- * Looks for the resource in NL directories as well.
- * @param bundle The bundle in which to look for the resource
- * @param name The name of the resource
- * @return The resource URL or null.
- */
- public static final URL resolveBundleNameNL(Bundle bundle, String name) {
- URL result = null;
- Stack candidates = new Stack();
- Locale locale = Locale.getDefault();
- String language = locale.getLanguage();
- String country = locale.getCountry();
- candidates.push("/" + name); //$NON-NLS-1$
- if (language.length() > 0) {
- candidates.push("/nl/" + language + "/" + name); //$NON-NLS-1$ //$NON-NLS-2$
- if (country.length() > 0) {
- candidates.push("/nl/" + language + "/" + country + "/" + name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- while (!candidates.isEmpty() && result == null) {
- String candidate = (String) candidates.pop();
- result = bundle.getResource(candidate);
- }
- return result;
- }
-
- /**
- * Parse the given message file into memory, into a SystemMessageFile
- * object.
- *
- * @param bundle -
- * the descriptor for this plugin
- * @param fileName -
- * unqualified name of the .xml message file, inluding the .xml
- * extension.
- * @return SystemMessageFile (null if unable to load the file)
- */
- public static final SystemMessageFile loadMessageFile(Bundle bundle,
- String fileName) {
- SystemMessageFile mf = null;
- boolean ok = false;
- try {
- URL url = resolveBundleNameNL(bundle, fileName);
- if (url != null) {
- InputStream messageFileStream = url.openStream();
- mf = SystemUIMessageFile.getMessageFile(fileName, messageFileStream);
- messageFileStream.close();
- ok = true;
- }
- } catch (Throwable t) {
- logError("Error loading message file " //$NON-NLS-1$
- + fileName
- + " in " //$NON-NLS-1$
- + bundle.getHeaders().get(
- org.osgi.framework.Constants.BUNDLE_NAME), t);
- ok = false; // DY
- }
- if (!ok) {
- MessageBox mb = new MessageBox(getActiveWorkbenchShell());
- mb.setText("Unexpected Error"); //$NON-NLS-1$
- mb.setMessage("Unable to load message file " //$NON-NLS-1$
- + fileName
- + " in " //$NON-NLS-1$
- + bundle.getHeaders().get(
- org.osgi.framework.Constants.BUNDLE_NAME));
- mb.open();
- }
- return mf;
- }
-
- /**
- * Parse the given message file into memory, into a SystemMessageFile
- * object.
- *
- * @param bundle -
- * the descriptor for this plugin
- * @param fileName -
- * unqualified name of the .xml message file, inluding the .xml
- * extension.
- * @return SystemMessageFile (null if unable to load the file)
- */
- public static final SystemMessageFile loadDefaultMessageFile(Bundle bundle,
- String fileName) {
- SystemMessageFile mf = null;
- boolean ok = false;
- try {
- URL url = bundle.getEntry("/"+fileName); //$NON-NLS-1$
- if (url != null) {
- InputStream messageFileStream = url.openStream();
- mf = SystemUIMessageFile.getMessageFile(fileName, messageFileStream);
- messageFileStream.close();
- ok = true;
- }
- } catch (Throwable t) {
- logError("Error loading message file " //$NON-NLS-1$
- + fileName
- + " in " //$NON-NLS-1$
- + bundle.getHeaders().get(
- org.osgi.framework.Constants.BUNDLE_NAME), t);
- ok = false; // DY
- }
-
- if (!ok) {
- Shell s = getActiveWorkbenchShell();
- if (s == null) {
- Display d = Display.getCurrent();
- if (d != null) {
- s = d.getActiveShell();
- } else {
- d = Display.getDefault();
- if (d != null) {
- s = d.getActiveShell();
- }
- }
- }
- if (s != null) {
- MessageBox mb = new MessageBox(s);
- mb.setText("Unexpected Error"); //$NON-NLS-1$
- mb.setMessage("Unable to load message file " //$NON-NLS-1$
- + fileName
- + " in " //$NON-NLS-1$
- + bundle.getHeaders().get(
- org.osgi.framework.Constants.BUNDLE_NAME));
- mb.open();
- }
- }
-
- return mf;
- }
-
- /**
- * Retrieve a message from a message file.
- *
- * @param msgFile -
- * the system message file containing the message.
- * @param msgId -
- * the ID of the message to retrieve. This is the concatenation
- * of the message's component abbreviation, subcomponent
- * abbreviation, and message ID as declared in the message xml
- * file.
- */
- public static SystemMessage getMessage(SystemMessageFile msgFile, String msgId)
- {
- SystemMessage msg = null;
- if ( msgFile != null )
- msg = msgFile.getMessage(msgId);
- else
- logWarning("No message file set."); //$NON-NLS-1$
-
- if ( msg == null )
- logWarning("Unable to find message ID: " + msgId); //$NON-NLS-1$
- return msg;
- }
-
- /**
- * Scan this plugin's message file for duplicates. This just calls the {@link SystemMessageFile#scanForDuplicates()}
- * method on the SystemMessageFile object.
- * @param msgFile - the message file to scan
- * @return true if duplicates found. The duplicates are written to standard out and the system core log file.
- */
- public static boolean scanForDuplicateMessages(SystemMessageFile msgFile)
- {
- return msgFile.scanForDuplicates();
- }
-
- /**
- * Generate HTML from this plugin's message file. This is handy for documentation purposes.
- * This just calls the {@link SystemMessageFile#printHTML(String)}
- * method on the SystemMessageFile object.
- * @param msgFile - the message file to print
- * @return true if all went well, false if it failed for some reason.
- */
- public static boolean printMessages(SystemMessageFile msgFile, String fullyQualifiedTargetFile)
- {
- return msgFile.printHTML(fullyQualifiedTargetFile);
- }
-
- // -----------------
- // LOGGER METHODS...
- // -----------------
-
- /**
- * Helper method for logging information to the RSE-style logging file.
- * This file is located in the .metadata subfolder for this plugin.
- *
- * @param message - System message to be written to the log file
- */
- public static void logMessage(SystemMessage message)
- {
- logMessage(message, null);
- }
-
- /**
- * Helper method for logging information to the RSE-style logging file.
- * This file is located in the .metadata subfolder for this plugin.
- *
- * @param message - System message to be written to the log file
- * @param ex - Exception to log. If not applicable, this can be null.
- */
- public static void logMessage(SystemMessage message, Throwable ex)
- {
- char type = message.getIndicator();
- switch (type)
- {
- case SystemMessage.ERROR:
- log.logError(message.toString(), ex);
- break;
- case SystemMessage.WARNING:
- log.logWarning(message.toString(), ex);
- break;
- case SystemMessage.INFORMATION:
- case SystemMessage.COMPLETION:
- log.logInfo(message.toString(), ex);
- break;
- case SystemMessage.INQUIRY:
- case SystemMessage.UNEXPECTED:
- default:
- log.logInfo(message.toString(), ex);
- break;
- }
- }
-
- /**
- * Helper method for logging information to the RSE-style logging file.
- * This file is located in the .metadata subfolder for this plugin.
- * <p>
- * Because this is an information message, it will only actually be logged if the
- * user has enabled logging of information messages via the Logging preferences page
- * within the Remote Systems preference pages tree.
- *
- * @param message - Message to be written to the log file
- */
- public static void logInfo(String message)
- {
- log.logInfo(message);
- }
-
- // -----------------
- // LOGGER METHODS...
- // -----------------
-
- /**
- * Helper method for logging warnings to the RSE-style logging file.
- * This file is located in the .metadata subfolder for this plugin.
- * <p>
- * Because this is a warning message, it will only actually be logged if the
- * user has enabled logging of warning messages via the Logging preferences page
- * within the Remote Systems preference pages tree.
- *
- * @param message - Message to be written to the log file
- * Because these messages are only used for servicing purposes, the message typically is not translated.
- */
- public static void logWarning(String message)
- {
- log.logWarning(message);
- }
-
- /**
- * Helper method for logging errors (but not exceptions) to the RSE-style logging file.
- * This file is located in the .metadata subfolder for this plugin.
- * <p>
- * Because this is an error message, it is always logged, no matter what the preferences settings for
- * the logger.
- *
- * @param message - Message to be written to the log file
- * Because these messages are only used for servicing purposes, the message typically is not translated.
- */
- public static void logError(String message)
- {
- log.logError(message, null);
- }
-
- /**
- * Helper method for logging errors (exceptions) to the RSE-style logging file.
- * This file is located in the .metadata subfolder for this plugin.
- * <p>
- * Because this is an error message, it is always logged, no matter what the preferences settings for
- * the logger.
- *
- * @param message - Message to be written to the log file.
- * Because these messages are only used for servicing purposes, the message typically is not translated.
- *
- * @param exception - Any exception that generated the error condition. Used to print a stack trace in the log file.
- * If you pass null, it is the same as calling {@link #logError(String)}
- */
- public static void logError(String message, Throwable exception)
- {
- log.logError(message, exception);
- }
-
- /**
- * Helper method for logging debug messages to the RSE-style logging file.
- * This file is located in the .metadata subfolder for this plugin.
- * <p>
- * Debug messages are only logged when running this plugin in the workbench,
- * and when Logger.DEBUG has been set to true.
- *
- * @param prefix - Class issuing the debug message. Typically you pass getClass().getName()
- * @param message - Message to be written to the log file
- */
- public static void logDebugMessage(String prefix, String message)
- {
- log.logDebugMessage(prefix, message);
- }
-
- /**
- * Constructor.
- */
- public SystemBasePlugin() {
- super();
-
- if (baseInst == null) {
- baseInst = this;
- }
- }
-
- // ------------------------
- // STATIC HELPER METHODS...
- // ------------------------
-
- /**
- * Returns the symbolic name of the bundle.
- * @return the symbolic name of the bundle.
- */
- public String getSymbolicName() {
- return getBundle().getSymbolicName();
- }
-
- /**
- * Return the fully qualified install directory for this plugin.
- */
-// protected IPath getInstallLocation() {
-// IPath prefix = null;
-// try
-// {
-// String filePath = Platform.resolve(getBundle().getEntry("/")).getPath();
-// prefix = new Path(filePath);
-// }
-// catch (Exception e)
-// {
-// prefix = new Path(getBundle().getEntry("/").getFile());
-// }
-// return prefix;
-// }
-
- // -------------------------------------
- // ABSTRACTUIPLUGIN LIFECYCLE METHODS...
- // -------------------------------------
- /**
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
-
- super.start(context);
-
- // logger
- if (log == null) {
- log = LoggerFactory.getLogger(this);
- log.logInfo("Loading " + this.getClass()); //$NON-NLS-1$
- }
-
- addWindowListener();
- }
-
- /**
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- logDebugMessage(this.getClass().getName(), "SHUTDOWN"); //$NON-NLS-1$
- LoggerFactory.freeLogger(this);
- super.stop(context);
- }
-
- /**
- * Returns the Platform UI workbench.
- * <p>
- * This method exists as a convenience for plugin implementors. The
- * workbench can also be accessed by invoking <code>PlatformUI.getWorkbench()</code>.
- * </p>
- * <p>
- * This is an intercept of the AbstractUIPlugin method, so we can do a try/catch around
- * it, as it will throw an exception if we are running headless, in which case the
- * workbench has not even been started.
- * </p>
- */
- public IWorkbench getWorkbench()
- {
- IWorkbench wb = null;
- try {
- wb = PlatformUI.getWorkbench();
- if (windowListener == null)
- addWindowListener();
- }
- catch (Exception exc)
- {
- // workbench not created yet
- }
- return wb;
- }
-
- /**
- * Initialize the image registry by declaring all of the required graphics.
- * Typically this is a series of calls to putImageInRegistry. Use
- * getIconPath() to qualify the file name of the icons with their relative
- * path.
- */
- protected abstract void initializeImageRegistry();
-
- /**
- * Construct an image descriptor from a file name and place it in the
- * image descriptor registry. Actual image construction is delayed until first use.
- * @param id - an arbitrary ID to assign to this image. Used later when retrieving it.
- * @param fileName - the name of the icon file, with extension, relative to this plugin's folder.
- * @return the image descriptor for this particular id.
- */
- protected ImageDescriptor putImageInRegistry(String id, String fileName)
- {
- ImageDescriptor fid = getPluginImage(fileName);
- Hashtable t = getImageDescriptorRegistry();
- t.put(id, fid);
- return fid;
- }
-
- /**
- * Retrieve an image descriptor in this plugin's directory tree given its file name. The
- * file name should be qualified relative to this plugin's bundle.
- * For example "icons/myicon.gif"
- * @param imagePath the path name to the image relative to this bundle
- * @return the image descriptor
- */
- public ImageDescriptor getPluginImage(String imagePath) {
- return getPluginImage(getBundle(), imagePath);
- }
-
- /**
- * Retrieves or creates an image based on its id. The image is then stored
- * in the image registry if it is created so that it may be retrieved again.
- * Thus, image resources retrieved in this way need not be disposed by the
- * caller.
- *
- * @param key the id of the image to retrieve.
- * @return the Image resource for this id.
- */
- public Image getImage(String key)
- {
- // First check the image registry
- ImageRegistry imageRegistry = getImageRegistry();
- Image image = imageRegistry.get(key);
- if (image == null) { // check the image descriptor registry
- ImageDescriptor descriptor = getImageDescriptor(key);
- if (descriptor != null) {
- imageRegistry.put(key, descriptor);
- image = imageRegistry.get(key);
- } else {
- logError("...error retrieving image for key: " + key); //$NON-NLS-1$
- }
- }
- return image;
- }
-
- /**
- * Returns the image descriptor that has been registered to this id.
- * @param key the id of the image descriptor to retrieve
- * @return an ImageDescriptor
- */
- public ImageDescriptor getImageDescriptor(String key) {
- Hashtable t = getImageDescriptorRegistry();
- ImageDescriptor descriptor = (ImageDescriptor) t.get(key);
- return descriptor;
- }
-
- /**
- * Gets the hashtable that is the image descriptor registry. Creates and populates
- * it if necessary.
- * @return The image descriptor registry hashtable.
- */
- private Hashtable getImageDescriptorRegistry() {
- if (imageDescriptorRegistry == null) {
- imageDescriptorRegistry = new Hashtable();
- initializeImageRegistry();
- }
- return imageDescriptorRegistry;
- }
-
- /**
- * Returns an image descriptor from the base IDE. Looks only in the "icons/full/" directories.
- *
- * @see org.eclipse.ui.views.navigator.ResourceNavigatorActionGroup#getImageDescriptor(java.lang.String)
- */
- public ImageDescriptor getImageDescriptorFromIDE(String relativePath)
- {
- Hashtable registry = getImageDescriptorRegistry();
- ImageDescriptor descriptor = (ImageDescriptor)registry.get(relativePath);
- if (descriptor == null) {
- String iconPath = "icons/full/"; //$NON-NLS-1$
- String key = iconPath + relativePath;
- String[] bundleNames = new String[] {"org.eclipse.ui", "org.eclipse.ui.ide"}; //$NON-NLS-1$ //$NON-NLS-2$
- for (int i = 0; (i < bundleNames.length) && (descriptor == null); i++) {
- String bundleName = bundleNames[i];
- Bundle bundle = Platform.getBundle(bundleName);
- URL url = bundle.getResource(key);
- if (url != null) {
- descriptor = ImageDescriptor.createFromURL(url);
- }
- }
- if (descriptor == null) {
- descriptor = ImageDescriptor.getMissingImageDescriptor();
- }
- registry.put(relativePath, descriptor);
- }
- return descriptor;
- }
-
- // -----------------
- // LOGGER METHODS...
- // -----------------
-
- /**
- * Get the logger for this plugin. You should not have to directly access
- * the logger, since helper methods are already provided in this class.
- * Use with care.
- */
- public Logger getLogger()
- {
- return log;
- }
-
- // -------------------------
- // MISCELLANEOUS METHODS...
- // -------------------------
-
- /**
- * Return true if we are running in a headless environment. We equate this
- * to mean that the workbench is not running.
- *
- * @deprecated this method is useless right now because SystemBasePlugin is part of
- * the rse.ui plugin which depends on workbench and therefore we can never load this
- * class while actually being in headless mode. Normally this should return false
- * however, because the javadoc says we "equate this to mean that the workbench is not running",
- * it's possible early on that the method may return true if the workbench has not
- * yet been instantiated - although it will later return false.
- */
- public boolean isHeadless()
- {
- if (getWorkbench() == null){
- return true;
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
deleted file mode 100644
index 9a366e755..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
+++ /dev/null
@@ -1,1543 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * - created and used RSEPreferencesManager
- * Uwe Stieber (Wind River) - bugfixing and reworked new connection wizard
- * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
- * David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
- * David McKnight (IBM) - [238314] Default user ID on host properties page not disabled
- *******************************************************************************/
-
-package org.eclipse.rse.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.InetAddress;
-import java.nio.charset.Charset;
-import java.nio.charset.IllegalCharsetNameException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.IRSEUserIdConstants;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.RSEPreferencesManager;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.dialogs.ISystemPromptDialog;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorConnectionName;
-import org.eclipse.rse.ui.validators.ValidatorUserId;
-import org.eclipse.rse.ui.widgets.InheritableEntryField;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.rse.ui.wizards.newconnection.RSEAbstractNewConnectionWizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-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.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.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.ide.IDEEncoding;
-
-/**
- * A reusable form for prompting for connection information,
- * in new or update mode.
- * May be used to populate a dialog or a wizard page.
- * <p>
- * You may subclass this to refine the form. In this case you can
- * override the getForm method of SystemNewConnectionWizardDefaultMainPage
- * and SystemUpdateConnection to return your subclass.
- * </p>
- */
-
-public class SystemConnectionForm implements Listener, SelectionListener, Runnable, IRunnableWithProgress {
-
- public static final boolean CREATE_MODE = false;
- public static final boolean UPDATE_MODE = true;
- public static IRSESystemType lastSystemType = null;
- protected IHost conn;
- protected IRSESystemType defaultSystemType;
- protected IRSESystemType[] validSystemTypes;
-
- // GUI widgets
- protected Label labelType, labelConnectionName, labelHostName, labelUserId, labelDescription, labelProfile;
- protected Label labelTypeValue, labelSystemTypeValue, labelProfileValue;
- protected Combo textSystemType, textHostName, profileCombo;
- protected Text textConnectionName, textDescription;
- protected Button verifyHostNameCB;
- protected Group encodingGroup;
- protected Button remoteEncodingButton, otherEncodingButton;
- protected Combo otherEncodingCombo;
-
- // yantzi:artemis 6.0, work offline support
- protected Button workOfflineCB;
-
- protected InheritableEntryField textUserId;
- protected Label textSystemTypeReadOnly; // for update mode
-
- // validators
- protected ISystemValidator[] nameValidators;
- protected ISystemValidator hostValidator;
- protected ISystemValidator userIdValidator;
-
- // other inputs
- protected ISystemMessageLine msgLine;
- protected ISystemConnectionFormCaller caller;
- protected String defaultConnectionName, defaultHostName;
- protected String defaultUserId, defaultDescription, defaultProfile; // update mode initial values
- protected String[] defaultProfileNames;
- protected boolean defaultWorkOffline;
-
- protected boolean userPickedVerifyHostnameCB = false;
-
- // max lengths
- protected int hostNameLength = 100;
- protected int connectionNameLength = ValidatorConnectionName.MAX_CONNECTIONNAME_LENGTH;
- protected int userIdLength = 100;
- protected int descriptionLength = 100;
-
- // state/output
- protected int userIdLocation = IRSEUserIdConstants.USERID_LOCATION_HOST;
- protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog, callerInstanceOfPropertyPage;
- protected boolean userIdFromSystemTypeDefault;
- protected boolean updateMode = false;
- protected boolean contentsCreated = false;
- protected boolean connectionNameEmpty = false;
- protected boolean connectionNameListen = true;
- protected boolean singleTypeMode = false;
- protected String originalHostName = null;
- protected String currentHostName = null;
- protected SystemMessage errorMessage = null;
- protected SystemMessage verifyingHostName;
-
- // encoding fields
- protected boolean addEncodingFields = false;
- protected String defaultEncoding = null;
- protected boolean isRemoteEncoding = false;
- protected boolean isValidBefore = true;
-
- /**
- * Constructor.
- * @param msgLine A GUI widget capable of writing error messages to.
- * @param caller The wizardpage or dialog hosting this form.
- */
- public SystemConnectionForm(ISystemMessageLine msgLine, ISystemConnectionFormCaller caller) {
- this.msgLine = msgLine;
- this.caller = caller;
- this.defaultProfileNames = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getActiveSystemProfileNames();
- callerInstanceOfWizardPage = caller instanceof IWizardPage;
- callerInstanceOfSystemPromptDialog = caller instanceof ISystemPromptDialog;
- callerInstanceOfPropertyPage = caller instanceof IWorkbenchPropertyPage;
-
- userIdValidator = new ValidatorUserId(true); // false => allow empty? Yes.
- defaultUserId = ""; //$NON-NLS-1$
- }
-
- // -------------------------------------------------------------
- // INPUT METHODS CALLABLE BY CALLER TO INITIALIZE INPUT OR STATE
- // -------------------------------------------------------------
-
- /**
- * Often the message line is null at the time of instantiation, so we have to call this after
- * it is created.
- */
- public void setMessageLine(ISystemMessageLine msgLine) {
- this.msgLine = msgLine;
- }
-
- /**
- * Call this to specify a validator for the connection name. It will be called per keystroke.
- * You must supply one per active profile, as connections must be unique per profile.
- * The order must be the same as the order of profiles given by getActiveSystemProfiles() in
- * the system registry.
- */
- public void setConnectionNameValidators(ISystemValidator[] v) {
- nameValidators = v;
- }
-
- /**
- * Call this to specify a validator for the hostname. It will be called per keystroke.
- */
- public void setHostNameValidator(ISystemValidator v) {
- hostValidator = v;
- }
-
- /**
- * Call this to specify a validator for the userId. It will be called per keystroke.
- */
- public void setUserIdValidator(ISystemValidator v) {
- userIdValidator = v;
- }
-
- /**
- * Set the profile names to show in the combo
- */
- public void setProfileNames(String[] names) {
- this.defaultProfileNames = names;
- if (profileCombo != null)
- profileCombo.setItems(names);
- }
-
- /**
- * Set the profile name to preselect
- */
- public void setProfileNamePreSelection(String selection) {
- this.defaultProfile = selection;
- if ((profileCombo != null) && (selection != null)) {
- int selIdx = profileCombo.indexOf(selection);
- if (selIdx >= 0)
- profileCombo.select(selIdx);
- else
- profileCombo.select(0);
- }
- }
-
- /**
- * For "new" mode, allows setting of the initial user Id. Sometimes subsystems
- * like to have their own default userId preference page option. If so, query
- * it and set it here by calling this.
- */
- public void setUserId(String userId) {
- defaultUserId = userId;
- }
-
- /**
- * Set the currently selected connection so as to better initialize input fields
- */
- public void setCurrentlySelectedConnection(IHost connection) {
- if (connection != null) {
- initializeInputFields(connection, false);
- }
- }
-
- /**
- * Call this to restrict the system type that the user is allowed to choose.
- * Must be called before the widgets are created in
- * {@link #createContents(Composite, boolean, String)}.
- *
- * @param systemType the only IRSESystemType allowed, or
- * <code>null</code> to show all allowed system types.
- */
- public void restrictSystemType(IRSESystemType systemType) {
- if (systemType==null) {
- restrictSystemTypes(null);
- } else {
- IRSESystemType[] types = new IRSESystemType[] { systemType };
- restrictSystemTypes (types);
- }
- }
-
- /**
- * Call this to restrict the system types that the user is allowed to choose.
- *
- * @param systemTypes the list of allowed system types, or
- * <code>null</code> to not restrict the allowed system types.
- */
- public void restrictSystemTypes(IRSESystemType[] systemTypes) {
- //Remember the old selection before changing the data
- IRSESystemType oldSelection = getSystemType();
-
- //Update the known list of valid system types
- if (systemTypes == null) {
- validSystemTypes = SystemWidgetHelpers.getValidSystemTypes(null);
- } else {
- validSystemTypes = new IRSESystemType[systemTypes.length];
- System.arraycopy(systemTypes, 0, validSystemTypes, 0, systemTypes.length);
- SystemWidgetHelpers.sortSystemTypesByLabel(validSystemTypes);
- }
-
- //Restore the default system type based on the new list
- List systemTypesAsList = Arrays.asList(validSystemTypes);
- if (defaultSystemType == null || !systemTypesAsList.contains(defaultSystemType)) {
- defaultSystemType = validSystemTypes[0];
- }
-
- //Set items in Combo and restore the previous selection
- if (textSystemType!=null) {
- textSystemType.setItems(SystemWidgetHelpers.getSystemTypeLabels(validSystemTypes));
- if (oldSelection!=null && Arrays.asList(validSystemTypes).contains(oldSelection)) {
- textSystemType.select(systemTypesAsList.indexOf(oldSelection));
- } else {
- textSystemType.select(0);
- }
- }
- }
-
- /**
- * Initialize input fields to current values in update mode.
- * Note in update mode we do NOT allow users to change the system type.
- * <b>This must be called <i>after</i> calling getContents!
- * You must also be sure to pass true in createContents in order to call this method.
- * @param conn The SystemConnection object that is being modified.
- */
- public void initializeInputFields(IHost conn) {
- initializeInputFields(conn, true);
- }
-
- /**
- * Initialize input fields to current values in update mode.
- * Note in update mode we do NOT allow users to change the system type.
- * <b>This must be called <i>after</i> calling getContents!
- * You must also be sure to pass true in createContents in order to call this method.
- * @param conn The SystemConnection object that is being modified.
- */
- public void initializeInputFields(IHost conn, boolean updateMode) {
- this.updateMode = updateMode;
- this.conn = conn;
- defaultSystemType = conn.getSystemType();
- defaultConnectionName = conn.getAliasName();
- defaultHostName = conn.getHostName();
- defaultUserId = conn.getLocalDefaultUserId();
- defaultDescription = conn.getDescription();
- defaultProfile = conn.getSystemProfile().getName();
- defaultWorkOffline = conn.isOffline();
- defaultEncoding = conn.getDefaultEncoding(false);
-
- if (defaultEncoding == null) {
- defaultEncoding = conn.getDefaultEncoding(true);
- isRemoteEncoding = true;
- }
- else {
- isRemoteEncoding = false;
- }
-
- if (updateMode) {
- defaultProfileNames = new String[1];
- defaultProfileNames[0] = defaultProfile;
- }
-
- if (contentsCreated) doInitializeFields();
- }
-
- /**
- * Preset the connection name
- */
- public void setConnectionName(String name) {
- defaultConnectionName = name;
- if (contentsCreated) {
- textConnectionName.setText(name != null ? name : ""); //$NON-NLS-1$
- verify(false);
- }
- }
-
- /**
- * Preset the host name
- */
- public void setHostName(String name) {
- defaultHostName = name;
- if (contentsCreated) {
- textHostName.setText(name != null ? name : ""); //$NON-NLS-1$
- verify(false);
- }
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete() {
- boolean pageComplete = false;
-
- if (errorMessage == null) {
- pageComplete = ((getConnectionName().length() > 0) && (getHostName().length() > 0) && (getProfileName().length() > 0));
- }
-
- return pageComplete;
- }
-
- /**
- * @return whether the connection name is unique or not
- */
- public boolean isConnectionUnique() {
- // DKM - d53587 - used to check connection name uniqueness without displaying the error
- // TODO - need to display a directive for the user to specify a unique connection name
- // when it's invalid to be consistent with the rest of eclipse rather than
- // an error message
- int selectedProfile = 0;
- if (profileCombo != null) {
- selectedProfile = profileCombo.getSelectionIndex();
- }
- if (selectedProfile < 0)
- selectedProfile = 0;
-
- ISystemValidator nameValidator = null;
- if ((nameValidators != null) && (nameValidators.length > 0))
- nameValidator = nameValidators[selectedProfile];
- String connName = textConnectionName.getText().trim();
- if (nameValidator != null)
- errorMessage = nameValidator.validate(connName);
-
- if (errorMessage != null) {
- return false;
- } else {
- return true;
- }
-
- }
-
- // ---------------------------------------------
- // OUTPUT METHODS FOR EXTRACTING USER DATA ...
- // ---------------------------------------------
- /**
- * Verifies all input. Call this when user presses OK or Finish your dialog or wizard.
- * @param okPressed true if this verify is being done when OK is pressed. If so, we position
- * cursor on error checking, else we do not.
- * @return true if there are no errors in the user input
- */
- public boolean verify(boolean okPressed) {
- boolean ok = true;
-
- //SystemMessage errMsg = null;
- Control controlInError = null;
- if (msgLine != null)
- msgLine.clearErrorMessage();
-
- // validate connection name...
- errorMessage = validateConnectionNameInput(false);
- if (errorMessage != null)
- controlInError = textConnectionName;
-
- // validate host name...
- if ((errorMessage == null) && (textHostName != null)) {
- errorMessage = validateHostNameInput();
- if (errorMessage != null)
- controlInError = textHostName;
- }
- // validate user Id...
- if ((errorMessage == null) && (textUserId != null)) {
- errorMessage = validateUserIdInput();
- if (errorMessage != null)
- controlInError = textUserId;
- }
- // verify host name...
- if ((errorMessage == null) && okPressed && (textHostName != null) && verifyHostNameCB.getSelection()) {
- currentHostName = textHostName.getText().trim();
- if (currentHostName.length() > 0) {
- if (verifyingHostName == null) {
- verifyingHostName = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_HOSTNAME_VERIFYING);
- }
-
- try {
- getRunnableContext().run(true, true, this);
- } catch (InterruptedException e) {
- // user cancelled
- ok = false;
- controlInError = textHostName;
- } catch (InvocationTargetException e) {
- // error found
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_HOSTNAME_NOTFOUND);
- errorMessage.makeSubstitution(currentHostName);
- controlInError = textHostName;
- }
- }
- }
-
- // validate host name...
- if ((errorMessage == null) && addEncodingFields) {
- errorMessage = validateEncoding();
-
- if (errorMessage != null) {
- controlInError = otherEncodingCombo;
- }
- }
-
- // if ok pressed, test for warning situation that connection name is in use in another profile...
- if (ok && (errorMessage == null) && okPressed) {
- String connectionName = textConnectionName.getText().trim();
- if (!connectionName.equals(defaultConnectionName)) {
- ok = ValidatorConnectionName.validateNameNotInUse(connectionName, caller.getShell());
- }
- controlInError = textConnectionName;
- }
-
- // ...end of validation...
-
- if (!ok || (errorMessage != null)) {
- ok = false;
- if (okPressed && controlInError != null)
- controlInError.setFocus();
- showErrorMessage(errorMessage);
- }
- // DETERMINE DEFAULT USER ID AND WHERE IT IS TO BE SET...
- // Possibly prompt for where to set user Id...
- else {
- boolean isLocal = false;
- if (textUserId != null) {
- isLocal = textUserId.isLocal();
- if (isLocal)
- userIdLocation = IRSEUserIdConstants.USERID_LOCATION_HOST; // edit this connection's local value
- else
- userIdLocation = IRSEUserIdConstants.USERID_LOCATION_DEFAULT_SYSTEMTYPE; // edit the preference value
- } else
- userIdLocation = IRSEUserIdConstants.USERID_LOCATION_NOTSET;
- SystemPreferencesManager.setVerifyConnection(verifyHostNameCB.getSelection());
- }
-
- return ok;
- }
-
- /**
- * Return the runnable context from the hosting dialog or wizard, if
- * applicable
- */
- protected IRunnableContext getRunnableContext() {
- if (callerInstanceOfWizardPage) {
- return ((WizardPage)caller).getWizard().getContainer();
- } else if (callerInstanceOfSystemPromptDialog) {
- return ((SystemPromptDialog)caller);
- } else {
- return new ProgressMonitorDialog(caller.getShell());
- }
- }
-
- /**
- * Check if this system type is enabled for offline support
- */
- private boolean enableOfflineCB() {
- // disabled offline checkbox for new connections
- if (!updateMode) {
- return false;
- }
- RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)(defaultSystemType.getAdapter(RSESystemTypeAdapter.class));
- return sysTypeAdapter.isEnableOffline(defaultSystemType);
- }
-
- /**
- * Return user-entered System Type.
- * Call this after finish ends successfully.
- */
- public IRSESystemType getSystemType() {
- if (textSystemType != null) {
- int idx = textSystemType.getSelectionIndex();
- if (idx >= 0) {
- return validSystemTypes[idx];
- }
- }
- return defaultSystemType;
- }
-
- /**
- * Return user-entered Connection Name.
- * Call this after finish ends successfully.
- */
- public String getConnectionName() {
- return textConnectionName.getText().trim();
- }
-
- /**
- * Return user-entered Host Name.
- * Call this after finish ends successfully.
- */
- public String getHostName() {
- return textHostName.getText().trim();
- }
-
- /**
- * Return user-entered Default User Id.
- * Call this after finish ends successfully.
- */
- public String getDefaultUserId() {
- if (textUserId != null)
- return textUserId.getText().trim();
- else
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Return the user-entered value for work offline.
- * Call this after finish ends successfully.
- */
- public boolean isWorkOffline() {
- if (workOfflineCB != null) {
- return workOfflineCB.getSelection();
- } else {
- return false;
- }
- }
-
- /**
- * Return user-entered Description.
- * Call this after finish ends successfully.
- */
- public String getConnectionDescription() {
- return textDescription.getText().trim();
- }
-
- /**
- * Return user-selected profile to contain this connection
- * Call this after finish ends successfully, and only in update mode.
- */
- public String getProfileName() {
- return (labelProfileValue != null) ? labelProfileValue.getText() : profileCombo.getText();
- }
-
- /**
- * If a default userId was specified, the user may have been queried
- * where to put the userId. This returns one of the constants from
- * IRSEUserIdConstants.
- * @return the user id location
- * @see IRSEUserIdConstants
- */
- public int getUserIdLocation() {
- if ((textUserId != null) && (textUserId.getText().trim().length() > 0))
- return userIdLocation;
- else
- return IRSEUserIdConstants.USERID_LOCATION_NOTSET;
- }
-
- // --------------------
- // INTERNAL METHODS...
- // --------------------
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- * @param parent The parent composite
- * @param updateMode true if we are in update mode versus create mode.
- */
- public Control createContents(Composite parent, boolean updateMode, String parentHelpId) {
- Label labelSystemType = null;
- String temp = null;
-
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
- SystemWidgetHelpers.setCompositeHelp(composite_prompts, parentHelpId);
-
- // Type display
- if (updateMode) {
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_TYPE_LABEL);
- labelType = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelTypeValue = SystemWidgetHelpers.createLabel(composite_prompts, SystemResources.RESID_CONNECTION_TYPE_VALUE);
- }
-
- // PROFILE SELECTION
- if (updateMode) {
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_PROFILE_LABEL);
- labelProfile = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelProfile.setToolTipText(SystemResources.RESID_CONNECTION_PROFILE_READONLY_TIP);
- labelProfileValue = SystemWidgetHelpers.createLabel(composite_prompts, ""); //$NON-NLS-1$
- labelProfileValue.setToolTipText(SystemResources.RESID_CONNECTION_PROFILE_READONLY_TIP);
- } else // if (!updateMode)
- {
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_PROFILE_LABEL);
- labelProfile = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelProfile.setToolTipText(SystemResources.RESID_CONNECTION_PROFILE_TIP);
- if (!updateMode) {
- profileCombo = SystemWidgetHelpers.createReadonlyCombo(composite_prompts, null, SystemResources.RESID_CONNECTION_PROFILE_TIP);
- SystemWidgetHelpers.setHelp(profileCombo, RSEUIPlugin.HELPPREFIX + "ccon0001"); //$NON-NLS-1$
- }
- }
-
- if (!updateMode)
- SystemWidgetHelpers.createLabel(composite_prompts, " ", 2); // filler //$NON-NLS-1$
-
- // SYSTEMTYPE PROMPT IN UPDATE MODE OR RESTRICTED MODE
- if (updateMode || ((validSystemTypes != null) && (validSystemTypes.length == 1))) {
- if (updateMode) {
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_SYSTEMTYPE_LABEL);
- labelSystemType = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_READONLY_TIP);
- textSystemTypeReadOnly = SystemWidgetHelpers.createLabel(composite_prompts, ""); //$NON-NLS-1$
- textSystemTypeReadOnly.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_READONLY_TIP);
- } else
- singleTypeMode = true;
- }
-
- if (updateMode)
- SystemWidgetHelpers.createLabel(composite_prompts, " ", nbrColumns); // filler //$NON-NLS-1$
-
- // HOSTNAME PROMPT
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_HOSTNAME_LABEL);
- labelHostName = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelHostName.setToolTipText(SystemResources.RESID_CONNECTION_HOSTNAME_TIP);
-
- if (!updateMode && (defaultSystemType == null)) {
- defaultSystemType = lastSystemType;
- if (defaultSystemType == null) {
- defaultSystemType = validSystemTypes[0];
- }
- }
-
- textHostName = SystemWidgetHelpers.createHostNameCombo(composite_prompts, null, defaultSystemType);
- textHostName.setToolTipText(SystemResources.RESID_CONNECTION_HOSTNAME_TIP);
- SystemWidgetHelpers.setHelp(textHostName, RSEUIPlugin.HELPPREFIX + "ccon0004"); //$NON-NLS-1$
-
- // CONNECTION NAME PROMPT
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_CONNECTIONNAME_LABEL);
- labelConnectionName = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelConnectionName.setToolTipText(SystemResources.RESID_CONNECTION_CONNECTIONNAME_TIP);
- textConnectionName = SystemWidgetHelpers.createTextField(composite_prompts, null, SystemResources.RESID_CONNECTION_CONNECTIONNAME_TIP);
- SystemWidgetHelpers.setHelp(textConnectionName, RSEUIPlugin.HELPPREFIX + "ccon0002"); //$NON-NLS-1$
-
- // SYSTEMTYPE PROMPT IN CREATE MODE
- // if (!updateMode)
- if ((labelSystemType == null) && !singleTypeMode) {
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_SYSTEMTYPE_LABEL);
- labelSystemType = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
- if (validSystemTypes==null) {
- validSystemTypes = SystemWidgetHelpers.getValidSystemTypes(null);
- } else {
- SystemWidgetHelpers.sortSystemTypesByLabel(validSystemTypes);
- }
- textSystemType = SystemWidgetHelpers.createSystemTypeCombo(composite_prompts, null, validSystemTypes);
- textSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
- SystemWidgetHelpers.setHelp(textSystemType, RSEUIPlugin.HELPPREFIX + "ccon0003"); //$NON-NLS-1$
- }
-
- // USERID PROMPT
- /*
- * We are testing the usability of not prompting for the user ID, so that the user has less to think about when
- * creating a new connection. Phil.
- */
- if (updateMode) // added for this experiment
- {
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_DEFAULTUSERID_LABEL);
- labelUserId = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelUserId.setToolTipText(SystemResources.RESID_CONNECTION_DEFAULTUSERID_TIP);
- textUserId = SystemWidgetHelpers.createInheritableTextField(composite_prompts, SystemResources.RESID_CONNECTION_DEFAULTUSERID_INHERITBUTTON_TIP,
- SystemResources.RESID_CONNECTION_DEFAULTUSERID_TIP);
- SystemWidgetHelpers.setHelp(textUserId, RSEUIPlugin.HELPPREFIX + "ccon0005"); //$NON-NLS-1$
- }
-
- // DESCRIPTION PROMPT
- temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_DESCRIPTION_LABEL);
- labelDescription = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- labelDescription.setToolTipText(SystemResources.RESID_CONNECTION_DESCRIPTION_TIP);
- textDescription = SystemWidgetHelpers.createTextField(composite_prompts, null, SystemResources.RESID_CONNECTION_DESCRIPTION_TIP);
- SystemWidgetHelpers.setHelp(textDescription, RSEUIPlugin.HELPPREFIX + "ccon0006"); //$NON-NLS-1$
-
- // VERIFY HOST NAME CHECKBOX
- SystemWidgetHelpers.createLabel(composite_prompts, " ", nbrColumns); // filler //$NON-NLS-1$
- verifyHostNameCB = SystemWidgetHelpers.createCheckBox(composite_prompts, nbrColumns, null, SystemResources.RESID_CONNECTION_VERIFYHOSTNAME_LABEL,
- SystemResources.RESID_CONNECTION_VERIFYHOSTNAME_TOOLTIP);
- if (updateMode)
- verifyHostNameCB.setSelection(false);
- else
- verifyHostNameCB.setSelection(SystemPreferencesManager.getVerifyConnection());
-
- // yantzi: artemis 6.0, work offline
- if (enableOfflineCB()) {
- workOfflineCB = SystemWidgetHelpers.createCheckBox(composite_prompts, nbrColumns, null, SystemResources.RESID_OFFLINE_WORKOFFLINE_LABEL,
- SystemResources.RESID_OFFLINE_WORKOFFLINE_TOOLTIP);
- SystemWidgetHelpers.setHelp(workOfflineCB, RSEUIPlugin.HELPPREFIX + "wofp0000"); //$NON-NLS-1$
- }
-
- connectionNameEmpty = (textConnectionName.getText().trim().length() == 0); // d43191
-
- textConnectionName.setFocus();
-
- // add keystroke listeners...
- textConnectionName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateConnectionNameInput(true);
- }
- });
- textHostName.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateHostNameInput();
- validateConnectionNameInput(false);
- }
- });
- if (textUserId != null)
- textUserId.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateUserIdInput();
- }
- });
-
- if (profileCombo != null) {
- profileCombo.addSelectionListener(this);
- }
-
- if (textSystemType != null) {
- originalHostName = textHostName.getText();
- textSystemType.addSelectionListener(this);
- }
-
- if (verifyHostNameCB != null) {
- verifyHostNameCB.addSelectionListener(this);
- }
-
- if ((textSystemType != null) && (textSystemType.getSelectionIndex()>=0))
- caller.systemTypeSelected(validSystemTypes[textSystemType.getSelectionIndex()], true);
- else if ((validSystemTypes != null) && (validSystemTypes.length == 1))
- caller.systemTypeSelected(validSystemTypes[0], true);
-
- if (textUserId == null)
- userIdLocation = IRSEUserIdConstants.USERID_LOCATION_NOTSET;
-
- // check if an encodings field should be added
- if (addEncodingFields) {
-
- SystemWidgetHelpers.createLabel(composite_prompts, "", 2); //$NON-NLS-1$
-
- // encoding field
- encodingGroup = SystemWidgetHelpers.createGroupComposite(composite_prompts, 2, SystemResources.RESID_HOST_ENCODING_GROUP_LABEL);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = SWT.FILL;
- data.grabExcessHorizontalSpace = true;
- data.verticalAlignment = SWT.BEGINNING;
- data.grabExcessVerticalSpace = false;
- encodingGroup.setLayoutData(data);
-
- Composite messageComposite = new Composite(encodingGroup, SWT.NONE);
- GridLayout messageLayout = new GridLayout();
- messageLayout.numColumns = 2;
- messageLayout.marginWidth = 0;
- messageLayout.marginHeight = 0;
- messageComposite.setLayout(messageLayout);
- messageComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- Label noteLabel = new Label(messageComposite, SWT.BOLD);
- noteLabel.setText(SystemResources.RESID_HOST_ENCODING_SETTING_NOTE);
- noteLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
- data = new GridData();
- data.grabExcessHorizontalSpace = false;
- noteLabel.setLayoutData(data);
-
- Label messageLabel = new Label(messageComposite, SWT.NULL);
- messageLabel.setText(SystemResources.RESID_HOST_ENCODING_SETTING_MSG);
- data = new GridData();
- data.horizontalAlignment = SWT.BEGINNING;
- data.grabExcessHorizontalSpace = true;
- data.horizontalIndent = 0;
- messageLabel.setLayoutData(data);
-
- SystemWidgetHelpers.createLabel(encodingGroup, ""); //$NON-NLS-1$
-
- // remote encoding field
- String defaultEncodingLabel = SystemResources.RESID_HOST_ENCODING_REMOTE_LABEL;
-
- // check if user set encoding
- // if so, we leave default encoding label as is
- // if not, we check if remote encoding is set, and if it is, include the encoding in the label
- if (conn.getDefaultEncoding(false) == null) {
-
- String remoteEncoding = conn.getDefaultEncoding(true);
-
- if (remoteEncoding != null) {
- defaultEncodingLabel = SystemResources.RESID_HOST_ENCODING_REMOTE_ENCODING_LABEL;
-
- int idx = defaultEncodingLabel.indexOf('%');
-
- if (idx != -1) {
- defaultEncodingLabel = defaultEncodingLabel.substring(0, idx) + remoteEncoding + defaultEncodingLabel.substring(idx+2);
- }
- }
- }
-
- remoteEncodingButton = SystemWidgetHelpers.createRadioButton(encodingGroup, null, defaultEncodingLabel, SystemResources.RESID_HOST_ENCODING_REMOTE_TOOLTIP);
- data = new GridData();
- data.horizontalSpan = 2;
- data.grabExcessHorizontalSpace = true;
- remoteEncodingButton.setLayoutData(data);
-
- SelectionAdapter remoteButtonSelectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEncodingGroupState(remoteEncodingButton.getSelection());
- validateEncoding();
- }
- };
-
- remoteEncodingButton.addSelectionListener(remoteButtonSelectionListener);
-
- Composite otherComposite = new Composite(encodingGroup, SWT.NONE);
- GridLayout otherLayout = new GridLayout();
- otherLayout.numColumns = 2;
- otherLayout.marginWidth = 0;
- otherLayout.marginHeight = 0;
- otherComposite.setLayout(otherLayout);
- otherComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- // other encoding field
- otherEncodingButton = SystemWidgetHelpers.createRadioButton(otherComposite, null, SystemResources.RESID_HOST_ENCODING_OTHER_LABEL, SystemResources.RESID_HOST_ENCODING_OTHER_TOOLTIP);
- data = new GridData();
- data.grabExcessHorizontalSpace = false;
- otherEncodingButton.setLayoutData(data);
-
- SelectionAdapter otherButtonSelectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEncodingGroupState(!otherEncodingButton.getSelection());
- validateEncoding();
- }
- };
-
- otherEncodingButton.addSelectionListener(otherButtonSelectionListener);
-
- // other encoding combo
- otherEncodingCombo = SystemWidgetHelpers.createCombo(otherComposite, null, SystemResources.RESID_HOST_ENCODING_ENTER_TOOLTIP);
- data = new GridData();
- data.horizontalAlignment = SWT.BEGINNING;
- data.grabExcessHorizontalSpace = true;
- data.horizontalIndent = 0;
- otherEncodingCombo.setLayoutData(data);
-
- otherEncodingCombo.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- validateEncoding();
- }
- });
-
- otherEncodingCombo.addKeyListener(new KeyAdapter(){
- public void keyReleased(KeyEvent e) {
- validateEncoding();
- }
- });
-
- SystemWidgetHelpers.createLabel(encodingGroup, ""); //$NON-NLS-1$
-
- SystemWidgetHelpers.createLabel(composite_prompts, "", 2); //$NON-NLS-1$
- }
-
- doInitializeFields();
-
- contentsCreated = true;
-
- return composite_prompts; // composite;
- }
-
- /**
- * Update the encoding group state.
- * @param useDefault whether to update the state with default option on. <code>true</code> if the default option
- * should be on, <code>false</code> if it should be off.
- */
- private void updateEncodingGroupState(boolean useDefault) {
- remoteEncodingButton.setSelection(useDefault);
- otherEncodingButton.setSelection(!useDefault);
-
- if (useDefault) {
-
- if (defaultEncoding != null) {
- otherEncodingCombo.setText(defaultEncoding);
- }
- else {
- String workspaceDefault = SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
- otherEncodingCombo.setText(workspaceDefault); //$NON-NLS-1$
- }
- }
-
- validateEncoding();
- }
-
- /**
- * Updates the valid state of the encoding group.
- */
- private SystemMessage validateEncoding() {
- boolean isValid = isEncodingValid();
-
- errorMessage = null;
-
- if (!isValid) {
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ENCODING_NOT_SUPPORTED);
- }
-
- showErrorMessage(errorMessage);
- setPageComplete();
- return errorMessage;
- }
-
- /**
- * Returns whether the encoding is valid.
- * @return <code>true</code> if the encoding is valid, <code>false</code> otherwise.
- */
- private boolean isEncodingValid() {
- return remoteEncodingButton.getSelection() || isEncodingValid(otherEncodingCombo.getText());
- }
-
- /**
- * Returns whether or not the given encoding is valid.
- * @param encoding the encoding.
- * @return <code>true</code> if the encoding is valid, <code>false</code> otherwise.
- */
- private boolean isEncodingValid(String encoding) {
- try {
- return Charset.isSupported(encoding);
- }
- catch (IllegalCharsetNameException e) {
- return false;
- }
- }
-
- /**
- * Return control to recieve initial focus
- */
- public Control getInitialFocusControl() {
- if (updateMode || !singleTypeMode)
- return textConnectionName;
- else
- return textHostName; // create mode and restricted to one system type
- }
-
- /**
- * Default implementation to satisfy Listener interface. Does nothing.
- */
- public void handleEvent(Event evt) {
- }
-
- /**
- * Combo selection listener method
- */
- public void widgetDefaultSelected(SelectionEvent event) {
- }
-
- /**
- * Combo selection listener method
- */
- public void widgetSelected(SelectionEvent event) {
- Object src = event.getSource();
-
- if (src == profileCombo) {
- profileCombo.getDisplay().asyncExec(this);
- } else if (src == textSystemType) // can only happen in create mode
- {
- String currHostName = textHostName.getText().trim();
- boolean hostNameChanged = !currHostName.equals(originalHostName);
- IRSESystemType currSystemType = getSystemType();
- textHostName.setItems(RSECorePlugin.getTheSystemRegistry().getHostNames(currSystemType));
- if (hostNameChanged) {
- textHostName.setText(currHostName);
- } else if (textHostName.getItemCount() > 0) {
- textHostName.setText(textHostName.getItem(0));
- originalHostName = textHostName.getText();
- } else {
- String connName = textConnectionName.getText().trim();
- if (connName.indexOf(' ') == -1)
- textHostName.setText(connName);
- else
- textHostName.setText(""); //$NON-NLS-1$
- originalHostName = textHostName.getText();
- }
-
- initializeUserIdField(currSystemType, null);
-
- verify(false); // re-check all fields in top-down order
-
- caller.systemTypeSelected(currSystemType, false);
- }
- // if verify host name checkbox event
- else if (src == verifyHostNameCB) {
-
- userPickedVerifyHostnameCB = true;
- // if the check box was unselected
- if (!verifyHostNameCB.getSelection()) {
-
- // clear host name not valid or not found error message so that wizard next page is enabled
- if (errorMessage != null && errorMessage == RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_HOSTNAME_NOTFOUND)) {
- errorMessage = null;
-
- if (msgLine != null) {
- msgLine.clearErrorMessage();
- }
-
- // set this page to complete so we can go to next page
- setPageComplete();
-
- // now go through each page and clear error message if there is one
- if (callerInstanceOfWizardPage) {
- IWizard wizard = ((WizardPage)caller).getWizard();
-
- IWizardPage[] pages = null;
-
- if (wizard instanceof RSEAbstractNewConnectionWizard) {
- RSEAbstractNewConnectionWizard connWizard = (RSEAbstractNewConnectionWizard)wizard;
- AbstractSystemWizardPage mainPage = (AbstractSystemWizardPage)(connWizard.getStartingPage());
-
- Vector pageList = new Vector();
-
- IWizardPage page = mainPage;
-
- while (page != null) {
-
- if (page != mainPage) {
- pageList.add(page);
- }
-
- page = connWizard.getNextPage(page);
- }
-
- pages = new IWizardPage[pageList.size()];
-
- for (int j = 0; j < pageList.size(); j++) {
- pages[j] = (IWizardPage)(pageList.get(j));
- }
- } else {
- pages = wizard.getPages();
- }
-
- for (int i = 0; i < pages.length; i++) {
-
- IWizardPage page = pages[i];
-
- if (page instanceof AbstractSystemWizardPage) {
- ((AbstractSystemWizardPage)page).clearErrorMessage();
- } else if (page instanceof WizardPage) {
- ((WizardPage)page).setErrorMessage(null);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Initialize values of input fields based on input
- */
- private void doInitializeFields() {
- // -------
- // profile
- // -------
- // ...output-only:
- if (labelProfileValue != null) {
- if (defaultProfile != null)
- labelProfileValue.setText(defaultProfile);
- }
- // ...selectable:
- else {
- if (defaultProfileNames != null)
- profileCombo.setItems(defaultProfileNames);
-
- if (defaultProfile != null) {
- int selIdx = profileCombo.indexOf(defaultProfile);
- if (selIdx >= 0)
- profileCombo.select(selIdx);
- else
- profileCombo.select(0);
- }
- }
-
- // -----------
- // system type
- // -----------
- // ...output-only:
- if ((textSystemTypeReadOnly != null) || singleTypeMode) {
- if (validSystemTypes != null) {
- if (textSystemTypeReadOnly != null)
- textSystemTypeReadOnly.setText(validSystemTypes[0].getLabel());
- if (defaultSystemType == null)
- defaultSystemType = validSystemTypes[0];
- } else if (defaultSystemType != null) {
- if (textSystemTypeReadOnly != null)
- textSystemTypeReadOnly.setText(defaultSystemType.getLabel());
- }
- }
- // ...selectable:
- else {
- if (defaultSystemType == null) {
- defaultSystemType = lastSystemType;
- }
- if (defaultSystemType != null) {
- int selIdx = Arrays.asList(validSystemTypes).indexOf(defaultSystemType);
- if (selIdx >= 0) {
- textSystemType.select(selIdx);
- } else {
- textSystemType.select(0);
- }
- } else {
- textSystemType.select(0);
- }
- defaultSystemType = getSystemType();
- }
-
- // ---------------------------------------------------
- // connection name
- // ---------------------------------------------------
- if (defaultConnectionName != null)
- textConnectionName.setText(defaultConnectionName);
- textConnectionName.setTextLimit(connectionNameLength);
-
- // -----------
- // host name (address)
- // -----------
- if (defaultHostName != null) {
- textHostName.setText(defaultHostName);
- } else if (textHostName.getItemCount() > 0) {
- textHostName.select(0);
- }
- textHostName.setTextLimit(hostNameLength);
- textHostName.clearSelection(); // should unselect the text, but it does not!
-
- // ---------------
- // default user id
- // ---------------
- initializeUserIdField(defaultSystemType, defaultUserId);
- if (textUserId != null)
- textUserId.setTextLimit(userIdLength);
- // description
- if (defaultDescription != null)
- textDescription.setText(defaultDescription);
- textDescription.setTextLimit(descriptionLength);
-
- // ---------------
- // Work offline
- // ---------------
- if (workOfflineCB != null) {
- workOfflineCB.setSelection(defaultWorkOffline);
- }
-
- // the file encoding group
- if (addEncodingFields) {
- List encodings = IDEEncoding.getIDEEncodings();
- String[] encodingStrings = new String[encodings.size()];
- encodings.toArray(encodingStrings);
- otherEncodingCombo.setItems(encodingStrings);
-
- // if the encoding is the same as the default encoding, then we want to choose the default encoding option
- if (isRemoteEncoding) {
- updateEncodingGroupState(true);
- }
- // otherwise choose the other encoding option
- else {
- otherEncodingCombo.setText(defaultEncoding);
- updateEncodingGroupState(false);
- }
-
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- // disable if any subsystem is connected
- if (!conn.getSystemType().getId().equalsIgnoreCase(IRSESystemType.SYSTEMTYPE_LOCAL_ID) && sr.isAnySubSystemConnected(conn)) {
- encodingGroup.setEnabled(false);
- remoteEncodingButton.setEnabled(false);
- otherEncodingButton.setEnabled(false);
- otherEncodingCombo.setEnabled(false);
- }
- }
-
- verify(false);
- }
-
- /**
- * Initialize userId values.
- * We have to reset after user changes the system type
- */
- private void initializeUserIdField(IRSESystemType systemType, String currentUserId) {
- // ---------------
- // default user id
- // ---------------
- String parentUserId = RSEPreferencesManager.getDefaultUserId(systemType);
- if (textUserId != null) {
- textUserId.setInheritedText(parentUserId);
- boolean allowEditingOfInherited = ((parentUserId == null) || (parentUserId.length() == 0));
- textUserId.setAllowEditingOfInheritedText(allowEditingOfInherited); // if not set yet, let user set it!
- }
- // ----------------------------
- // default user id: update-mode
- // ----------------------------
- if ((currentUserId != null) && (currentUserId.length() > 0)) {
- if (textUserId != null) {
- textUserId.setLocalText(currentUserId);
- textUserId.setLocal(true);
- }
- }
- // ----------------------------
- // default user id: create-mode
- // ----------------------------
- else {
- if (textUserId != null)
- textUserId.setLocalText(""); //$NON-NLS-1$
- if ((parentUserId != null) && (parentUserId.length() > 0)) {
- userIdFromSystemTypeDefault = true;
- defaultUserId = parentUserId;
- if (textUserId != null)
- textUserId.setLocal(false);
- }
- // there is no local override, and no inherited value. Default to setting inherited value.
- else {
- if (textUserId != null)
- textUserId.setLocal(false);
- }
- }
- }
-
- // ------------------------------------------------------
- // INTERNAL METHODS FOR VERIFYING INPUT PER KEYSTROKE ...
- // ------------------------------------------------------
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setConnectionNameValidators(ISystemValidator[])
- */
- protected SystemMessage validateConnectionNameInput(boolean userTyped) {
- if (!connectionNameListen)
- return null;
- errorMessage = null;
- int selectedProfile = 0;
- if (profileCombo != null) {
- selectedProfile = profileCombo.getSelectionIndex();
- }
- if (selectedProfile < 0)
- selectedProfile = 0;
- ISystemValidator nameValidator = null;
- if ((nameValidators != null) && (nameValidators.length > 0))
- nameValidator = nameValidators[selectedProfile];
- String connName = textConnectionName.getText().trim();
- if (nameValidator != null) {
- errorMessage = nameValidator.validate(connName);
- }
- showErrorMessage(errorMessage);
- setPageComplete();
- if (userTyped)
- connectionNameEmpty = (connName.length() == 0); // d43191
- return errorMessage;
- }
-
- /**
- * Set the connection name internally without validation
- */
- protected void internalSetConnectionName(String name) {
- SystemMessage currErrorMessage = errorMessage;
- connectionNameListen = false;
- textConnectionName.setText(name);
- connectionNameListen = true;
- errorMessage = currErrorMessage;
- }
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setHostNameValidator(ISystemValidator)
- */
- protected SystemMessage validateHostNameInput() {
- final String hostName = textHostName.getText().trim();
-
- // d43191
- if (connectionNameEmpty && contentsCreated) internalSetConnectionName(hostName);
-
- errorMessage = null;
-
- if (hostValidator != null)
- errorMessage = hostValidator.validate(hostName);
- else if (getHostName().length() == 0)
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_HOSTNAME_EMPTY);
-
- if (updateMode && !userPickedVerifyHostnameCB) {
- boolean hostNameChanged = !hostName.equals(defaultHostName);
- verifyHostNameCB.setSelection(hostNameChanged);
- }
-
- showErrorMessage(errorMessage);
- setPageComplete();
- return errorMessage;
- }
-
- /**
- * This hook method is called whenever the text changes in the input field. The default implementation delegates the
- * request to an <code>ISystemValidator</code> object. If the <code>ISystemValidator</code> reports an error the
- * error message is displayed in the Dialog's message line.
- * @see #setUserIdValidator(ISystemValidator)
- */
- protected SystemMessage validateUserIdInput() {
- errorMessage = null;
- if (textUserId != null) {
- if (userIdValidator != null)
- errorMessage = userIdValidator.validate(textUserId.getText());
- else if (getDefaultUserId().length() == 0)
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
- }
- showErrorMessage(errorMessage);
- setPageComplete();
- return errorMessage;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete() {
- boolean complete = isPageComplete();
- if (complete && (textSystemType != null))
- lastSystemType = getSystemType();
- if (callerInstanceOfWizardPage) {
- ((WizardPage)caller).setPageComplete(complete);
- } else if (callerInstanceOfSystemPromptDialog) {
- ((SystemPromptDialog)caller).setPageComplete(complete);
- } else if (callerInstanceOfPropertyPage) {
- ((PropertyPage)caller).setValid(complete);
- }
- }
-
- /**
- * Display error message or clear error message
- */
- private void showErrorMessage(SystemMessage msg) {
- if (msgLine != null)
- if (msg != null)
- msgLine.setErrorMessage(msg);
- else
- msgLine.clearErrorMessage();
- else
- SystemBasePlugin.logDebugMessage(this.getClass().getName(), "MSGLINE NULL. TRYING TO WRITE MSG " + msg); //$NON-NLS-1$
- }
-
- // ---------------------------------------------------------------
- // STATIC METHODS FOR GETTING A CONNECTION NAME VALIDATOR...
- // ---------------------------------------------------------------
-
- /**
- * Reusable method to return a name validator for renaming a connection.
- * @param conn the current connection object on updates. Can be null for new names. Used
- * to remove from the existing name list the current connection.
- */
- public static ISystemValidator getConnectionNameValidator(IHost conn) {
- ISystemProfile profile = conn.getSystemProfile();
- Vector v = RSECorePlugin.getTheSystemRegistry().getHostAliasNames(profile);
- v.removeElement(conn.getAliasName());
- ValidatorConnectionName connNameValidator = new ValidatorConnectionName(v);
- return connNameValidator;
- }
-
- /**
- * Reusable method to return a name validator for renaming a connection.
- * @param profile the current connection object's profile from which to get the existing names.
- * Can be null for syntax checking only, versus name-in-use.
- */
- public static ISystemValidator getConnectionNameValidator(ISystemProfile profile) {
- Vector v = RSECorePlugin.getTheSystemRegistry().getHostAliasNames(profile);
- ValidatorConnectionName connNameValidator = new ValidatorConnectionName(v);
- return connNameValidator;
- }
-
- /**
- * Reusable method to return name validators for creating a connection.
- * There is one validator per active system profile.
- */
- public static ISystemValidator[] getConnectionNameValidators() {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISystemProfile[] profiles = sr.getSystemProfileManager().getActiveSystemProfiles();
- ISystemValidator[] connNameValidators = new ISystemValidator[profiles.length];
- for (int idx = 0; idx < profiles.length; idx++) {
- Vector v = sr.getHostAliasNames(profiles[idx]);
- connNameValidators[idx] = new ValidatorConnectionName(v);
- }
- return connNameValidators;
- }
-
- // -------------------------------------------------------
- // METHOD REQUIRED BY RUNNABLE, USED IN CALL TO ASYNCEXEC
- // -------------------------------------------------------
-
- public void run() {
- verify(false);
- }
-
- /**
- * METHOD REQUIRED BY IRunnableWithProgress, USED TO SHOW PROGRESS WHILE
- * VERIFYING HOSTNAME
- */
- public void run(IProgressMonitor pm) throws InvocationTargetException, InterruptedException {
- pm.beginTask(verifyingHostName.getLevelOneText(), IProgressMonitor.UNKNOWN);
- try {
- InetAddress.getByName(currentHostName);
- } catch (java.net.UnknownHostException exc) {
- pm.done();
- throw new InvocationTargetException(exc);
- }
- pm.done();
- }
-
- /**
- * Add fields to enable encoding for the host to be set. This form will not have any encoding fields unless this is called.
- */
- public void addDefaultEncodingFields() {
- addEncodingFields = true;
- }
-
- /**
- * Returns the encoding that was specified. Only applies if encoding fields were added to this form.
- * @return the encoding that was specified. This will return <code>null</code> if the selection is to use the encoding from the remote system
- * but that encoding has not been obtained yet.
- * @see #addDefaultEncodingFields()
- */
- public String getDefaultEncoding() {
-
- if (addEncodingFields) {
- return getSelectedEncoding();
- }
- else {
- return null;
- }
- }
-
- /**
- * Returns the currently selected encoding.
- * @return the currently selected encoding.
- */
- private String getSelectedEncoding() {
- if (remoteEncodingButton.getSelection()) {
- return defaultEncoding;
- }
-
- return otherEncodingCombo.getText();
- }
-
- /**
- * Returns whether the encoding option is to use the encoding of the remote system. Only applies if encoding fields were added to this form.
- * @return <code>true</code> if the encoding option is to use the encoding of the remote system, <code>false</code> if the user specified the encoding.
- * @see #addDefaultEncodingFields()
- */
- public boolean isEncodingRemoteDefault() {
-
- if (addEncodingFields) {
- return remoteEncodingButton.getSelection();
- }
- else {
- return false;
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemMenuManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemMenuManager.java
deleted file mode 100644
index 0b271adc7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemMenuManager.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Tobias Schwarz (Wind River) - [187312] Fix duplicate submenus contributed through plugin.xml
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingBrowseWithAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingCompareWithAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingExpandToAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingNewAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingOpenWithAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingRemoteServersAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingReplaceWithAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingViewAction;
-import org.eclipse.rse.internal.ui.actions.SystemCascadingWorkWithAction;
-import org.eclipse.rse.internal.ui.actions.SystemSeparatorAction;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemBaseSubMenuAction;
-
-/**
- * Override/wrapper of JFace MenuManager so we can redirect any
- * menu additions to specific menu groups to go into
- * predefined submenus.
- * <p>
- * Only exposes core set of MenuManager methods. Rest can be
- * accessed by calling getMenuManger().
- */
-public class SystemMenuManager
-{
- private IMenuManager mgr;
- private IMenuManager newSubMenu, expandtoSubMenu, openwithSubMenu, browsewithSubMenu, comparewithSubMenu, replacewithSubMenu, workwithSubMenu, viewSubMenu, serverSubMenu;
- private boolean menuCreated = false;
-
- /**
- * Constructor for SystemMenuManager
- * @param menuManager existing JFace menu manager
- */
- public SystemMenuManager(IMenuManager menuManager)
- {
- super();
- mgr = menuManager;
- }
-
- /**
- * Get the wrapped IMenuManager manager
- */
- public IMenuManager getMenuManager()
- {
- return mgr;
- }
-
- /**
- * Method declared on IContributionManager.
- * Add an action to this menu.
- * COMMENTED OUT TO PREVENT CALLING IT. YOU SHOULD EXPLICITLY
- * DECIDE WHAT ISystemContextMenuConstants.GROUP EACH ACTION SHOULD BE ADDED TO, SO WE FORCE
- * YOU TO CALL APPENDTOISystemContextMenuConstants.GROUP!
- *
- public void add(IAction action)
- {
- mgr.add(action);
- }*/
-
- /**
- * Method declared on IContributionManager.
- * Append an action to the menu.
- * <p>
- * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
- * <p>
- * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
- * @param action action to append.
- */
- public void appendToGroup(String groupName, IAction action)
- {
- if (!checkForSpecialGroup(groupName, action, true))
- if (groupName != null)
- mgr.appendToGroup(groupName, action);
- else
- mgr.add(action);
- }
- /**
- * Method declared on IContributionManager.
- * Append a submenu to the menu.
- * <p>
- * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
- * <p>
- * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
- * @param menuOrSeparator menu or separator to append.
- */
- public void appendToGroup(String groupName, IContributionItem menuOrSeparator)
- {
- if (!checkForSpecialGroup(groupName, menuOrSeparator, true))
- if (groupName != null)
- mgr.appendToGroup(groupName, menuOrSeparator);
- else
- mgr.add(menuOrSeparator);
- }
-
- /**
- * Method declared on IContributionManager.
- * Prepend an action to the menu.
- * <p>
- * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
- * <p>
- * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
- * @param action action to prepend.
- */
- public void prependToGroup(String groupName, IAction action)
- {
- if (!checkForSpecialGroup(groupName, action, false))
- mgr.prependToGroup(groupName, action);
- }
- /**
- * Method declared on IContributionManager.
- * Prepend a submenu to the menu.
- * <p>
- * Intercepted so we can direct appends to certain groups into appropriate cascading submenus.
- * <p>
- * @param groupName group to append to. See {@link org.eclipse.rse.ui.ISystemContextMenuConstants}.
- * @param subMenu submenu to append.
- */
- public void prependToGroup(String groupName, IContributionItem subMenu)
- {
- if (!checkForSpecialGroup(groupName, subMenu, true))
- mgr.prependToGroup(groupName, subMenu);
- }
-
- /**
- * Add a separator.
- * HOPEFULLY THIS IS NEVER CALLED. RATHER, BY USING ISystemContextMenuConstants.GROUPS AND DECIDING PER ISystemContextMenuConstants.GROUP IF THERE
- * SHOULD BE SEPARATORS, WE AVOID HARDCODING SEPARATORS LIKE THIS.
- */
- public void addSeparator()
- {
- mgr.add(new Separator());
- }
-
- /**
- * Special helper that intelligently adds system framework actions
- * @param menuGroup default menuGroup to add to, if action doesn't contain an explicit location
- * @param action action to add to the menu
- */
- public void add(String menuGroup, IAction action)
- {
- if (action instanceof SystemBaseSubMenuAction)
- appendToGroup(getMenuGroup(action,menuGroup),
- ((SystemBaseSubMenuAction)action).getSubMenu());
- else if (!(action instanceof SystemSeparatorAction))
- appendToGroup(getMenuGroup(action,menuGroup),action);
- else // hopefully we don't have these!
- appendToGroup(menuGroup, new Separator()); // add a separator, which is an IContributionItem
- }
-
- private String getMenuGroup(IAction action, String defaultGroup)
- {
- if ( (action instanceof ISystemAction) &&
- (((ISystemAction)action).getContextMenuGroup()!=null) )
- return ((ISystemAction)action).getContextMenuGroup();
- else
- return defaultGroup;
- }
-
- private boolean checkForSpecialGroup(String groupName, IAction action, boolean add)
- {
- boolean takenCareOf = false;
- IMenuManager subMenu = getSpecialSubMenu(groupName);
- if (subMenu != null)
- {
- takenCareOf = true;
- if (action instanceof SystemSeparatorAction)
- {
- subMenu.add(new Separator());
- if (((SystemSeparatorAction)action).isRealAction())
- subMenu.add(action);
- }
- else
- subMenu.add(action);
- }
-
- return takenCareOf;
- }
-
- private boolean checkForSpecialGroup(String groupName, IContributionItem contribution, boolean add)
- {
- boolean takenCareOf = false;
- IMenuManager subMenu = getSpecialSubMenu(groupName);
- if (subMenu != null)
- {
- takenCareOf = true;
- subMenu.add(contribution);
- }
- return takenCareOf;
- }
-
- /**
- * Return the given subMenu if already instantiated locally, or
- * find it with the given subMenuId in the nested IMenuManager
- * if not yet instantiated locally.
- *
- * This is necessary in order to make sure the given submenu
- * is not created twice when it (or an item of it) has been
- * contributed by a client through plugin.xml already.
- *
- * @param subMenu existing local submenu instance, or
- * <code>null</code> if not yet instantiated locally.
- * @param subMenuId submenu ID by which to find it in IMenuManager.
- * @return existing instantiated, or newly found submenu instance,
- * or <code>null</code> if the subMenu does not exist yet.
- */
- private IMenuManager findSpecialSubMenu(IMenuManager subMenu, String subMenuId) {
- if (subMenu == null) {
- IContributionItem item = mgr.find(subMenuId);
- if (item instanceof IMenuManager) {
- subMenu = (IMenuManager)item;
- }
- }
- return subMenu;
- }
-
- private IMenuManager getSpecialSubMenu(String groupName)
- {
- IMenuManager subMenu = null;
- menuCreated = false;
- if (groupName!=null)
- {
- if (groupName.equals(ISystemContextMenuConstants.GROUP_NEW))
- {
- // first of all try to find the subMenu.
- // the submenu can already exist, when any adapter created it to allow the
- // contribution of actions via plugin.xml
- // RSE creates the submenus only, when they are needed within the code,
- // so it is possible that submenus doesn'texist for plugin.xml contributions
- // and so an error log entry is generated.
- newSubMenu = findSpecialSubMenu(newSubMenu, ISystemContextMenuConstants.MENU_NEW);
- if (newSubMenu == null)
- {
- newSubMenu = (new SystemCascadingNewAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_NEW, newSubMenu);
- menuCreated = true;
- }
- subMenu = newSubMenu;
- }
- /*
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_GOTO))
- {
- if (gotoSubMenu == null)
- {
- gotoSubMenu = (new SystemCascadingGoToAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_GOTO, gotoSubMenu);
- menuCreated = true;
- }
- subMenu = gotoSubMenu;
- }
- */
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_EXPANDTO))
- {
- expandtoSubMenu = findSpecialSubMenu(expandtoSubMenu, ISystemContextMenuConstants.MENU_EXPANDTO);
- if (expandtoSubMenu == null)
- {
- expandtoSubMenu = (new SystemCascadingExpandToAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_EXPANDTO, expandtoSubMenu);
- menuCreated = true;
- }
- subMenu = expandtoSubMenu;
- }
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_OPENWITH))
- {
- openwithSubMenu = findSpecialSubMenu(openwithSubMenu, ISystemContextMenuConstants.MENU_OPENWITH);
- if (openwithSubMenu == null)
- {
- openwithSubMenu = (new SystemCascadingOpenWithAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_OPENWITH, openwithSubMenu);
- menuCreated = true;
- }
- subMenu = openwithSubMenu;
- }
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_BROWSEWITH))
- {
- browsewithSubMenu = findSpecialSubMenu(browsewithSubMenu, ISystemContextMenuConstants.MENU_BROWSEWITH);
- if (browsewithSubMenu == null)
- {
- browsewithSubMenu = (new SystemCascadingBrowseWithAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_BROWSEWITH, browsewithSubMenu);
- menuCreated = true;
- }
- subMenu = browsewithSubMenu;
- }
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_COMPAREWITH))
- {
- comparewithSubMenu = findSpecialSubMenu(comparewithSubMenu, ISystemContextMenuConstants.MENU_COMPAREWITH);
- if (comparewithSubMenu == null)
- {
- comparewithSubMenu = (new SystemCascadingCompareWithAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_COMPAREWITH, comparewithSubMenu);
- menuCreated = true;
- }
- subMenu = comparewithSubMenu;
- }
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_REPLACEWITH))
- {
- replacewithSubMenu = findSpecialSubMenu(replacewithSubMenu, ISystemContextMenuConstants.MENU_REPLACEWITH);
- if (replacewithSubMenu == null)
- {
- replacewithSubMenu = (new SystemCascadingReplaceWithAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_REPLACEWITH, replacewithSubMenu);
- menuCreated = true;
- }
- subMenu = replacewithSubMenu;
- }
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_WORKWITH))
- {
- workwithSubMenu = findSpecialSubMenu(workwithSubMenu, ISystemContextMenuConstants.MENU_WORKWITH);
- if (workwithSubMenu == null)
- {
- workwithSubMenu = (new SystemCascadingWorkWithAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_WORKWITH, workwithSubMenu);
- menuCreated = true;
- }
- subMenu = workwithSubMenu;
- }
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_VIEWER_SETUP))
- {
- if (viewSubMenu == null)
- {
- viewSubMenu = (new SystemCascadingViewAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_VIEWER_SETUP, viewSubMenu);
- menuCreated = true;
- }
- subMenu = viewSubMenu;
- }
- else if (groupName.equals(ISystemContextMenuConstants.GROUP_STARTSERVER))
- {
- serverSubMenu = findSpecialSubMenu(serverSubMenu, ISystemContextMenuConstants.MENU_STARTSERVER);
- if (serverSubMenu == null)
- {
- serverSubMenu = (new SystemCascadingRemoteServersAction()).getSubMenu();
- mgr.appendToGroup(ISystemContextMenuConstants.GROUP_STARTSERVER, serverSubMenu);
- menuCreated = true;
- }
- subMenu = serverSubMenu;
- }
- }
- return subMenu;
- }
-
- public IMenuManager getSpecialSubMenuByMenuID(String menuID)
- {
- IMenuManager subMenu = null;
- String groupName = null;
- menuCreated = false;
- if (menuID!=null)
- {
- if (menuID.equals(ISystemContextMenuConstants.MENU_NEW))
- groupName = ISystemContextMenuConstants.GROUP_NEW;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_GOTO))
- groupName = ISystemContextMenuConstants.GROUP_GOTO;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_EXPANDTO))
- groupName = ISystemContextMenuConstants.GROUP_EXPANDTO;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_OPENWITH))
- groupName = ISystemContextMenuConstants.GROUP_OPENWITH;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_BROWSEWITH))
- groupName = ISystemContextMenuConstants.GROUP_BROWSEWITH;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_COMPAREWITH))
- groupName = ISystemContextMenuConstants.GROUP_COMPAREWITH;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_REPLACEWITH))
- groupName = ISystemContextMenuConstants.GROUP_REPLACEWITH;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_WORKWITH))
- groupName = ISystemContextMenuConstants.GROUP_WORKWITH;
- else if (menuID.equals(ISystemContextMenuConstants.MENU_STARTSERVER))
- groupName = ISystemContextMenuConstants.GROUP_STARTSERVER;
-
- if (groupName != null)
- subMenu = getSpecialSubMenu(groupName);
- }
- return subMenu;
- }
-
- public boolean wasMenuCreated()
- {
- return menuCreated;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
deleted file mode 100644
index 9cdccd716..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a this package, was in
- * the org.eclipse.rse.core package of the UI plugin.
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
- * David McKnight (IBM) - [237300] Problem with setDefaultHistory for SystemHistoryCombo.
- * David McKnight (IBM) - [240991] RSE startup creates display on worker thread before workbench.
- * David McKnight (IBM) - [240991] Avoiding calling SystemBasePluging.getWorkbench()
- ********************************************************************************/
-package org.eclipse.rse.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.rse.core.IRSEPreferenceNames;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemModelChangeEvent;
-import org.eclipse.rse.core.events.ISystemModelChangeEvents;
-import org.eclipse.rse.core.events.ISystemModelChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A utility class that encapsulates all global preferences for the remote system framework
- * for both core and UI preferences.
- * <p>
- * These include:
- * <ul>
- * <li>The list of profile names that are active
- * <li>The default user Id per system type
- * <li>The global setting about whether to show filter pools
- * <li>The global setting about whether to show filter strings
- * <li>
- * </ul>
- * This class should not be subclassed.
- */
-public class SystemPreferencesManager {
-
- /*
- * The following are preferences that may be set from the
- * system properties.
- */
- private static boolean showLocalConnection;
- private static boolean showProfilePage; // This is not a persistent preference
- private static boolean showNewConnectionPrompt; // This is not a persistent preference
-
- /*
- * Singleton instance to support listening to model change events
- */
- private static SystemPreferencesManager fInstance = new SystemPreferencesManager();
- private int fModelChangeListeners = 0;
- private ISystemModelChangeListener fModelChangeListener = null;
-
- /*
- * Private Constructor to discourage instance creation other than by ourselves.
- */
- private SystemPreferencesManager() {
- }
-
- /**
- * Migrate Preferences from UI Preference Store into Core Preference store
- */
- private static void migrateCorePreferences() {
- String[] keys = {
- IRSEPreferenceNames.ACTIVEUSERPROFILES,
- IRSEPreferenceNames.USE_DEFERRED_QUERIES,
- IRSEPreferenceNames.USERIDPERKEY
- };
- for (int i = 0; i < keys.length; i++) {
- migrateCorePreference(keys[i]);
- }
- }
-
- private static void migrateCorePreference(String preferenceName) {
- String name = ISystemPreferencesConstants.ROOT + preferenceName;
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- if (store.contains(name) && !store.isDefault(name)) {
- String value = store.getString(name);
- store.setToDefault(name);
- store.setDefault(name, "*migrated*"); //$NON-NLS-1$
- store = RSECorePlugin.getDefault().getPluginPreferences();
- store.setValue(preferenceName, value);
- }
- }
-
- /**
- * Initialize our preference store with our defaults.
- * This is called once at plugin startup.
- */
- public static void initDefaults() {
- migrateCorePreferences();
- initDefaultsUI();
- savePreferences();
- fInstance.startModelChangeListening();
- }
-
- private static void initDefaultsUI() {
-
- //String showProp = System.getProperty("rse.showNewConnectionPrompt");
- RSEUIPlugin ui = RSEUIPlugin.getDefault();
- Preferences store = ui.getPluginPreferences();
- showNewConnectionPrompt= getBooleanProperty("rse.showNewConnectionPrompt", ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT); //$NON-NLS-1$
- showLocalConnection = getBooleanProperty("rse.showLocalConnection", true); //$NON-NLS-1$
- showProfilePage = getBooleanProperty("rse.showProfilePage", false); //$NON-NLS-1$
- store.setDefault(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE, ISystemPreferencesConstants.DEFAULT_RESTORE_STATE_FROM_CACHE);
- store.setDefault(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES, ISystemPreferencesConstants.DEFAULT_QUALIFY_CONNECTION_NAMES);
- store.setDefault(ISystemPreferencesConstants.SHOWFILTERPOOLS, ISystemPreferencesConstants.DEFAULT_SHOWFILTERPOOLS);
- store.setDefault(ISystemPreferencesConstants.ORDER_CONNECTIONS, ISystemPreferencesConstants.DEFAULT_ORDER_CONNECTIONS);
- store.setDefault(ISystemPreferencesConstants.HISTORY_FOLDER, ISystemPreferencesConstants.DEFAULT_HISTORY_FOLDER);
- store.setDefault(ISystemPreferencesConstants.REMEMBER_STATE, ISystemPreferencesConstants.DEFAULT_REMEMBER_STATE);
- store.setDefault(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE, ISystemPreferencesConstants.DEFAULT_CASCADE_UDAS_BYPROFILE);
- store.setDefault(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT, showNewConnectionPrompt);
- store.setDefault(Mnemonics.POLICY_PREFERENCE, Mnemonics.POLICY_DEFAULT);
- store.setDefault(Mnemonics.APPEND_MNEMONICS_PATTERN_PREFERENCE, Mnemonics.APPEND_MNEMONICS_PATTERN_DEFAULT);
- store.setDefault(ISystemPreferencesConstants.SHOW_EMPTY_LISTS, ISystemPreferencesConstants.DEFAULT_SHOW_EMPTY_LISTS);
- savePreferences();
- }
-
- private static boolean getBooleanProperty(String propertyName, boolean defaultValue) {
- String property = System.getProperty(propertyName);
- boolean value = (property == null) ? defaultValue : property.equals(Boolean.toString(true));
- return value;
- }
-
- public static boolean getShowLocalConnection() {
- return showLocalConnection;
- }
-
- public static boolean getShowProfilePage() {
- return showProfilePage;
- }
-
- /**
- * @return true if the user has elected to show user defined actions cascaded by profile
- */
- public static boolean getCascadeUserActions() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- return store.getBoolean(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE);
- }
-
- /**
- * Sets if the user has elected to show user defined actions cascaded by profile.
- * Does not save the preferences. This must be done by the caller.
- * @see #savePreferences()
- * @param cascade whether or not to cascade user action menus
- */
- public static void setCascadeUserActions(boolean cascade) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE, cascade);
- }
-
- /**
- * @return the ordered list of connection names.
- * This is how user arranged his connections in the system view.
- */
- public static String[] getConnectionNamesOrder() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- return parseStrings(store.getString(ISystemPreferencesConstants.ORDER_CONNECTIONS));
- }
-
- /**
- * Gets the user's preference for the order of the connection names within a given profile
- * @param profileName the name of the profile to return the connection names for.
- * @return an array of connection names for this profile in the order preferred by the user.
- */
- public static String[] getConnectionNamesOrder(String profileName) {
- String[] allConnectionNamesOrder = SystemPreferencesManager.getConnectionNamesOrder();
- profileName = profileName + "."; //$NON-NLS-1$
- int profileNameLength = profileName.length();
- List l = new ArrayList();
- for (int idx = 0; idx < allConnectionNamesOrder.length; idx++)
- if (allConnectionNamesOrder[idx].startsWith(profileName)) {
- l.add(allConnectionNamesOrder[idx].substring(profileNameLength));
- }
- String[] names = new String[l.size()];
- l.toArray(names);
- return names;
- }
-
- /**
- * Gets the user's preference for the order of a given list of connections,
- * after resolving it against the actual list of connection names contained within
- * a specified profile.
- * Connections not in the given profile will be ignored.
- * @param realityConnectionList The list of connections that will be reordered according to
- * the user's preferred ordering.
- * @param profileName the name of the profile that we will search for these connections.
- * @return the list of connection names from the given list and profile in the order
- * preferred by the user.
- */
- public static String[] getConnectionNamesOrder(IHost[] realityConnectionList, String profileName) {
- if (realityConnectionList == null) return new String[0];
- String[] realityNames = new String[realityConnectionList.length];
- for (int idx = 0; idx < realityConnectionList.length; idx++) {
- realityNames[idx] = realityConnectionList[idx].getAliasName();
- }
- String[] names = resolveOrderPreferenceVersusReality(realityNames, getConnectionNamesOrder(profileName));
- return names;
- }
-
- /**
- * Sets user's preference for the order of the connection names according to the
- * list kept in the system registry.
- * This resets any user-specified ordering of profiles since the SystemRegistry
- * has no concept of ordered profiles. The hosts inside a profile, though,
- * will be ordered according to user preference.
- */
- public static void setConnectionNamesOrder() {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IHost[] conns = sr.getHosts();
- String[] names = new String[conns.length];
- for (int idx = 0; idx < names.length; idx++)
- names[idx] = conns[idx].getSystemProfileName() + "." + conns[idx].getAliasName(); //$NON-NLS-1$
- setConnectionNamesOrder(names);
- }
-
- /**
- * Sets the ordered list of connection names.
- * This is how user arranged connections in the system view.
- * @param connectionNames an array of connection names in the order they are to be presented.
- */
- public static void setConnectionNamesOrder(String[] connectionNames) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.ORDER_CONNECTIONS, makeString(connectionNames));
- savePreferences();
- }
-
- /**
- * Determines if a string (the needle) is present in an array of strings (the haystack)
- * @param haystack an array of strings to search
- * @param needle the string for which to search
- * @return true if the needle was found
- */
- private static boolean find(String[] haystack, String needle) {
- for (int idx = 0; idx < haystack.length; idx++) {
- if (haystack[idx].equals(needle)) return true;
- }
- return false;
- }
-
- /**
- * Resolves differences between two ordered name lists.
- * Used when there are differences between the actual list of names and
- * a restored ordered list of names.
- */
- private static String[] resolveOrderPreferenceVersusReality(String[] reality, String[] ordered) {
- List finalList = new ArrayList();
- // step 1: include all names from preferences list which do exist in reality...
- for (int idx = 0; idx < ordered.length; idx++) {
- if (SystemPreferencesManager.find(reality, ordered[idx])) finalList.add(ordered[idx]);
- }
- // step 2: add all names in reality which do not exist in preferences list...
- for (int idx = 0; idx < reality.length; idx++) {
- if (!SystemPreferencesManager.find(ordered, reality[idx])) finalList.add(reality[idx]);
- }
- String[] resolved = new String[finalList.size()];
- finalList.toArray(resolved);
- return resolved;
- }
-
- /**
- * @return the history for the folder combo box widget
- */
- public static String[] getFolderHistory() {
- return getWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER);
- }
-
- /**
- * Sets the history for the folder combo box widget.
- * Does not save the preferences. This must be done by the caller.
- * @see #savePreferences()
- * @param newHistory the names of the folders to be saved in the folder history
- */
- public static void setFolderHistory(String[] newHistory) {
- setWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER, newHistory);
- }
-
- /**
- * @return true if the user has elected to show connection names qualified by profile
- */
- public static boolean getQualifyConnectionNames() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- return store.getBoolean(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES);
- }
-
- /**
- * Sets if the user has elected to show connection names qualified by profile.
- * @param qualify whether or not to qualify the connection names in the UI.
- */
- public static void setQualifyConnectionNames(boolean qualify) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES, qualify);
- savePreferences();
- }
-
- /**
- * @return true if the user has elected to remember the state of the Remote Systems View
- */
- public static boolean getRememberState() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- return store.getBoolean(ISystemPreferencesConstants.REMEMBER_STATE);
- }
-
- /**
- * Sets if the user has elected to remember the state of RSE.
- * @param remember true if the state should be remembered.
- */
- public static void setRememberState(boolean remember) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.REMEMBER_STATE, remember);
- savePreferences();
- }
-
- /**
- * Return true if the user has elected to restore the state of the Remote Systems view from cached information
- */
- public static boolean getRestoreStateFromCache() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- return store.getBoolean(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE);
- }
-
- /**
- * Set if the user has elected to restore the state of the
- * Remote Systems View from cached information
- * @param restore whether or not to restore the state of RSE from cached information.
- */
- public static void setRestoreStateFromCache(boolean restore) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE, restore);
- savePreferences();
- }
-
- /**
- * Return true if the user has elected to show filter pools in the Remote System Explorer view
- */
- public static boolean getShowFilterPools() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- return store.getBoolean(ISystemPreferencesConstants.SHOWFILTERPOOLS);
- }
-
- /**
- * Sets whether or not to show filter pools.
- * @param show true if we want to show the filter pools
- */
- public static void setShowFilterPools(boolean show) {
- boolean prevValue = getShowFilterPools();
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.SHOWFILTERPOOLS, show);
- savePreferences();
- if (show != prevValue) {
- RSEUIPlugin.getTheSystemRegistryUI().setShowFilterPools(show);
- }
- }
-
- /**
- * @return true if the user has elected to show the "New Connection..." prompt
- * in the Remote Systems View
- */
- public static boolean getShowNewConnectionPrompt() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- boolean value = store.getBoolean(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT);
- return value;
- }
-
- /**
- * Sets whether to show the new connection... prompt in the Remote System Explorer view.
- * @param show true if we want to show the filter pools
- */
- public static void setShowNewConnectionPrompt(boolean show) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT, show);
- savePreferences();
- }
-
- /**
- * @return whether to turn on "Verify connection" checkbox on the New Connection wizard
- */
- public static boolean getVerifyConnection() {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setDefault(ISystemPreferencesConstants.VERIFY_CONNECTION, ISystemPreferencesConstants.DEFAULT_VERIFY_CONNECTION);
- return store.getBoolean(ISystemPreferencesConstants.VERIFY_CONNECTION);
- }
-
- /**
- * Sets whether connections should be verified by the New Connection wizard.
- * @param verify true if the connection should be verified
- */
- public static void setVerifyConnection(boolean verify) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(ISystemPreferencesConstants.VERIFY_CONNECTION, verify);
- savePreferences();
- }
-
- /**
- * Return the history for a widget given an arbitrary key uniquely identifying it
- */
- public static String[] getWidgetHistory(String key) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- String result = store.getString(key);
-
- // bug 237300
- // don't parse strings if we have ""
- if (result == null || result.length() == 0){
- return null;
- }
- else {
- return parseStrings(result);
- }
- }
-
- /**
- * Sets the history for a widget given an arbitrary key uniquely identifying it.
- * Does not save the preferences. This must be done by the caller.
- * @see #savePreferences()
- */
- public static void setWidgetHistory(String key, String[] newHistory) {
- Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- store.setValue(key, makeString(newHistory));
- }
-
- /**
- * Make a single string out of an array of strings. A semi-colon is
- * used as a delimiter between the separate values. No value in the
- * array can contain a semi-colon.
- * @param values the array of strings to condense into a single one
- * @return the condensed string
- */
- private static String makeString(String[] values) {
- StringBuffer allValues = new StringBuffer(20 * values.length);
- for (int idx = 0; idx < values.length; idx++) {
- if (values[idx] != null) {
- if (idx > 0) {
- allValues = allValues.append(';');
- }
- allValues.append(values[idx]);
- }
- }
- return allValues.toString();
- }
-
- /**
- * Parse out list of multiple values into a string array per value.
- * This is the inverse of the {@link #makeString(String[])} operation.
- * @param allvalues the string holding the condensed value
- * @return the reconstituted array of strings.
- */
- private static String[] parseStrings(String allvalues) {
- if (allvalues == null) return new String[0];
- String[] tokens = allvalues.split(";"); //$NON-NLS-1$
- return tokens;
- }
-
- /**
- * Save the preference stores.
- */
- public static void savePreferences() {
- RSEUIPlugin.getDefault().savePluginPreferences();
- RSECorePlugin.getDefault().savePluginPreferences();
- }
-
- /*
- * Start listening to SystemRegistry model change events
- */
- private void startModelChangeListening() {
- //TODO Register a listener for shutdown, to stop model change listening
- boolean alreadyListening;
- synchronized(this) {
- alreadyListening = (fModelChangeListeners>0);
- fModelChangeListeners++;
- }
-
- if (!alreadyListening) {
- // FIXME bug 240991: With the current workaround, we might miss events
- // Instead of adding the listener deferred in a job, the SystemRegistry
- // should send events via the IRSEInteractionProvider
- Job addListenerJob = new Job("Add Listener"){ //$NON-NLS-1$
- public IStatus run(IProgressMonitor monitor){
- while (!PlatformUI.isWorkbenchRunning()){
- try {
- //Checks in the loop are fast enough so we can poll often
- Thread.sleep(100);
- }
- catch (InterruptedException e){}
- }
-
- IWorkbench wb = PlatformUI.getWorkbench();
- if (!wb.isClosing()) {
- fModelChangeListener = new ModelChangeListener();
- RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener);
- }
- return Status.OK_STATUS;
- }
- };
- addListenerJob.setSystem(true);
- addListenerJob.schedule();
- }
- }
-
- /*
- * A listener for SystemRegistry Model Change events
- */
- private static class ModelChangeListener implements ISystemModelChangeListener, ISystemResourceChangeListener {
-
- public void systemModelResourceChanged(ISystemModelChangeEvent event) {
- int rt = event.getResourceType();
- if (rt==ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_CONNECTION) {
- switch(event.getEventType()) {
- case ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED:
- case ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED:
- case ISystemModelChangeEvents.SYSTEM_RESOURCE_ADDED:
- //TODO Change order of hosts from affected profile only?
- SystemPreferencesManager.setConnectionNamesOrder();
- break;
- }
- } else if (rt==ISystemModelChangeEvents.SYSTEM_RESOURCETYPE_PROFILE) {
- switch (event.getEventType()) {
- case ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED:
- case ISystemModelChangeEvents.SYSTEM_RESOURCE_REMOVED:
- case ISystemModelChangeEvents.SYSTEM_RESOURCE_CHANGED:
- //TODO Change order of hosts from affected profile only?
- SystemPreferencesManager.setConnectionNamesOrder();
- break;
- }
- if (event.getEventType()==ISystemModelChangeEvents.SYSTEM_RESOURCE_RENAMED) {
- boolean namesQualified = SystemPreferencesManager.getQualifyConnectionNames();
- RSEUIPlugin.getTheSystemRegistryUI().setQualifiedHostNames(namesQualified); // causes refresh events to be fired
- }
- }
- }
-
- public void systemResourceChanged(ISystemResourceChangeEvent event) {
- if (event.getType()==ISystemResourceChangeEvents.EVENT_MOVE_MANY
- && (event.getSource() instanceof IHost[])
- ) {
- //TODO Change order of hosts from affected profile only?
- SystemPreferencesManager.setConnectionNamesOrder();
- }
- }
-
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java
deleted file mode 100644
index bc42afd65..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java
+++ /dev/null
@@ -1,1527 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Javier Montalvo Orús (Symbian) - Bug 149151: New Connection first page should use a Listbox for systemtype
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [181939] avoid subsystem plugin activation just for enablement checking
- * David Dykstal (IBM) - [231666] special colon processing for french locales
- ********************************************************************************/
-
-package org.eclipse.rse.ui;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Locale;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.widgets.InheritableEntryField;
-import org.eclipse.rse.ui.widgets.SystemHistoryCombo;
-import org.eclipse.rse.ui.widgets.SystemHostCombo;
-import org.eclipse.swt.SWT;
-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.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.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
-
-import com.ibm.icu.text.Collator;
-
-/**
- * Static methods that can be used when writing SWT GUI code.
- * They simply make it more productive.
- */
-public class SystemWidgetHelpers {
- public static boolean traceHelpIDs = false;
- public static Label previousLabel;
-
- /**
- * This is the most flexible composite creation method.
- * @param parent Parent composite
- * @param parentSpan number of columns this is to span in the parent's composite
- * @param numColumns number of columns this composite is to have
- * @param border true if you want to show an etched border around the composite
- * @param label optional label to show in the border. Forces border to true
- * @param marginSize the number pixels around the composite. -1 means Eclipse default
- * @param spacingSize the number pixels around the composite controls. -1 means Eclipse default
- */
- public static Composite createComposite(Composite parent, int parentSpan, int numColumns, boolean border, String label, int marginSize, int spacingSize) {
- return createAlignedComposite(parent, parentSpan, numColumns, border, label, marginSize, spacingSize, GridData.FILL);
- }
-
- /**
- * Creates a composite with vertical alignment GridData.VERTICAL_ALIGN_BEGINNING.
- * @param parent Parent composite
- * @param parentSpan number of columns this is to span in the parent's composite
- * @param numColumns number of columns this composite is to have
- * @param border true if you want to show an etched border around the composite
- * @param label optional label to show in the border. Forces border to true
- * @param marginSize the number pixels around the composite. -1 means Eclipse default
- * @param spacingSize the number pixels around the composite controls. -1 means Eclipse default
- */
- public static Composite createVerticalBeginComposite(Composite parent, int parentSpan, int numColumns, boolean border, String label, int marginSize, int spacingSize) {
- return createAlignedComposite(parent, parentSpan, numColumns, border, label, marginSize, spacingSize, GridData.VERTICAL_ALIGN_BEGINNING);
- }
-
- /**
- * Created a composite
- */
- private static Composite createAlignedComposite(Composite parent, int parentSpan, int numColumns, boolean border, String label, int marginSize, int spacingSize, int verticalAlignment) {
- //border = true;
- boolean borderNeeded = border;
- if (label != null)
- borderNeeded = true; // force the case
- int style = SWT.NULL;
- if (borderNeeded)
- style |= SWT.SHADOW_ETCHED_IN;
- Composite composite = null;
- if (borderNeeded) {
- composite = new Group(parent, style);
- if (label != null)
- ((Group) composite).setText(label);
- } else {
- composite = new Composite(parent, style);
- }
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- if (marginSize != -1) {
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- }
- if (spacingSize != -1) {
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- }
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- data.horizontalSpan = parentSpan;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
-
- data.verticalAlignment = verticalAlignment;
- data.grabExcessVerticalSpace = false;
-
- composite.setLayoutData(data);
- return composite;
- }
-
- /**
- * Creates composite control and sets the default layout data.
- * @param parent GridLayout composite to put the new group composite into.
- * @param numColumns Number of columns the new group will contain.
- */
- public static Composite createComposite(Composite parent, int numColumns) {
- boolean testing = false; //true;
- if (testing)
- return createComposite(parent, 1, numColumns, true, Integer.toString(numColumns), -1, -1);
- else
- return createComposite(parent, 1, numColumns, false, null, -1, -1);
- }
-
- /**
- * Creates group composite control and sets the default layout data.
- * Group composites show a visible border line and optional text in it.
- * @param parent GridLayout composite to put the new group composite into.
- * @param numColumns Number of columns the new group will contain.
- * @param label Text to display in the group border. Can be null.
- */
- public static Group createGroupComposite(Composite parent, int numColumns, String label) {
- return (Group) createComposite(parent, 1, numColumns, true, label, -1, -1);
- }
-
- /**
- * Creates "tight" composite control and sets the default layout data.
- * A tight composite is one with no vertical or horizontal spacing, or margin spacing.
- * @param parent GridLayout composite to put the new group composite into.
- * @param numColumns Number of columns the new group will contain.
- */
- public static Composite createTightComposite(Composite parent, int numColumns) {
- return createComposite(parent, 1, numColumns, false, null, 0, 0);
- }
-
- /**
- * Creates "flush" composite control and sets the default layout data.
- * A flush composite is one with no margin spacing but normal inter-component spacing
- * @param parent GridLayout composite to put the new group composite into.
- * @param numColumns Number of columns the new group will contain.
- */
- public static Composite createFlushComposite(Composite parent, int numColumns) {
- return createComposite(parent, 1, numColumns, false, null, 0, -1);
- }
-
- /**
- * Creates a label for use a simple filler, to eat up space. This is for a rigid
- * filler that doesn't consume space.
- * @param parent Composite to put the field into.
- * @param span Horizontal span
- * @param widthHint How wide to make it. Pass -1 to use SWT default
- */
- public static Label createRigidFillerLabel(Composite parent, int span, int widthHint) {
- Label label = new Label(parent, SWT.CENTER);
- label.setText(" "); //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalSpan = span;
- //System.out.println("in createRigidFillerLabel. span = " + span);
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = false;
- if (widthHint != -1)
- data.widthHint = widthHint;
- //else
- // data.widthHint = 5;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Creates a label instance and inserts it into a given GridLayout.
- * @param parent GridLayout composite to put the field into.
- * @param text Text to display in the label.
- */
- public static Label createLabel(Composite parent, String text) {
- return createLabel(parent, text, 1);
- }
-
- /**
- * Creates a label instance and inserts it into a given GridLayout.
- * @param parent Composite to put the field into.
- * @param text Text to display in the label.
- * @param span Horizontal span
- */
- public static Label createLabel(Composite parent, String text, int span) {
- return createLabel(parent, text, span, false);
- }
-
- /**
- * Creates a label instance and inserts it into a given GridLayout, optionally
- * with a border style
- * @param parent Composite to put the field into.
- * @param text Text to display in the label.
- * @param span Horizontal span
- * @param wantBorder true to place border around the label
- */
- public static Label createLabel(Composite parent, String text, int span, boolean wantBorder) {
- int style = SWT.LEFT;
- if (wantBorder)
- style |= SWT.BORDER;
- if (span > 1)
- style |= SWT.WRAP;
- Label label = new Label(parent, style);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- //data.grabExcessHorizontalSpace = true;
- label.setLayoutData(data);
- return label;
- }
-
- /**
- * Creates a label instance and inserts it into a given GridLayout. Supports tooltip text
- * @param parent GridLayout composite to put the field into.
- * @param text
- * @param tooltip
- */
- public static Label createLabel(Composite parent, String text, String tooltip)
- {
- Label label = createLabel(parent, text);
- setToolTipText(label, tooltip);
- return label;
- }
-
- /**
- * Creates a label instance and inserts it into a given GridLayout.
- * @param parent Composite to put the field into.
- * @param text
- * @param tooltip
- * @param span Horizontal span
- * @param wantBorder true to place border around the label
- */
- public static Label createLabel(Composite parent, String text, String tooltip, int span, boolean wantBorder)
- {
- Label label = createLabel(parent, text, span, wantBorder);
- setToolTipText(label, tooltip);
- return label;
- }
-
- /**
- * Create a pair of labels, the first being a prompt and the second being a value. A colon
- * is appended to the text of the first label. The text value of the second will be set to "".
- * <p>
- * The first label is set to not grab excess horizontal space, while the second one is, since
- * its contents are variable.
- * <p>
- * To help with initial sizing, the widthHint of the second is set to 100.
- * <p>
- * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
- *
- * @param parent composite to put the fields into. Will be added sequentially
- * @param label
- * @param tooltip
- * @param wantBorder true if a border is desired around the second label (the value vs the prompt)
- * @return the second label created. Use setText to place the value in it.
- */
- public static Label createLabeledLabel(Composite parent, String label, String tooltip, boolean wantBorder) {
- previousLabel = createLabel(parent, label);
- String text = previousLabel.getText();
- previousLabel.setText(appendColon(text));
- ((GridData) previousLabel.getLayoutData()).grabExcessHorizontalSpace = false;
- Label label2 = createLabel(parent, "", 1, wantBorder); //$NON-NLS-1$
- ((GridData) label2.getLayoutData()).grabExcessHorizontalSpace = true;
- ((GridData) label2.getLayoutData()).widthHint = 100;
- setToolTipText(label2, tooltip);
- return label2;
- }
-
- /**
- * Return the prompting label from the last call to createLabeledXXXX.
- * These methods only return the second control, but we sometimes need access to the label.
- */
- public static Label getLastLabel() {
- return previousLabel;
- }
-
- /**
- * Create a spacer line. No widget returned so we have the freedom to change it over time
- */
- public static void createSpacerLine(Composite parent, int columnSpan, boolean wantBorder) {
- int style = SWT.LEFT; // | SWT.SEPARATOR;
- if (wantBorder)
- style |= SWT.BORDER | SWT.LINE_SOLID;
- if (columnSpan > 1)
- style |= SWT.WRAP;
- Label label = new Label(parent, style);
- //label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = columnSpan;
- data.horizontalAlignment = GridData.FILL;
- //data.grabExcessHorizontalSpace = true;
- label.setLayoutData(data);
- }
-
-
-
- /**
- * Creates a widget for displaying text verbiage that spans multiple lines. Takes resolved text vs resource bundle id.
- * The returned widget is not typed so we can easily change it in the future if we decide on a better widget.
- * @param parent Composite to put the field into.
- * @param text String is the verbiage text to display
- * @param span Horizontal span
- * @param border true if you want a border around the verbiage
- * @param widthHint number of pixels to limit width to before wrapping. 200 is a reasonable number
- * @return the Label widget, in case you want to tweak it
- */
- public static Label createVerbiage(Composite parent, String text, int span, boolean border, int widthHint) {
- Label widget = new Label(parent, border ? (SWT.LEFT | SWT.WRAP | SWT.BORDER) : (SWT.LEFT | SWT.WRAP));
- widget.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = span;
- data.horizontalAlignment = GridData.FILL;
- data.widthHint = widthHint;
- data.grabExcessHorizontalSpace = true;
- widget.setLayoutData(data);
- return widget;
- }
-
- /**
- * Create a labeled verbiage (wrappable label) field and insert it into a GridLayout, and assign tooltip text.
- * After calling this, you must call setText on the result to set its contents.
- * <p>
- * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
- *
- * @param parent composite to put the field into.
- * @param labelText
- * @param tooltip
- * @param span Horizontal span
- * @param border true if you want a border around the verbiage
- * @param widthHint number of pixels to limit width to before wrapping. 200 is a reasonable number
- * @return Label created.
- */
- public static Label createLabeledVerbiage(Composite parent, String labelText, String tooltip, int span, boolean border, int widthHint) {
- previousLabel = createLabel(parent, appendColon(labelText));
- Label verbiage = createVerbiage(parent, labelText, span, border, widthHint);
- setToolTipText(previousLabel, tooltip);
- setToolTipText(verbiage, tooltip);
- return verbiage;
- }
-
- /**
- * Create a label to show a command string as it is being built-up in a dialog
- * This version uses a default height of 3 normal lines.
- */
- public static Label createCommandStatusLine(Composite parent, int horizontalSpan) {
- return createCommandStatusLine(parent, horizontalSpan, 3);
- }
-
- /**
- * Create a label to show a command string as it is being built-up in a dialog.
- * This version allows you specify how tall to make it, in terms of normal line height.
- */
- public static Label createCommandStatusLine(Composite parent, int horizontalSpan, int heightInLines) {
- Label commandSoFar = new Label(parent, SWT.LEFT | SWT.WRAP);
- int dx = commandSoFar.getBounds().height;
- //System.out.println("Default label height = " + dx); ALWAYS 0!
- if (dx == 0)
- //dx = 12; // what else?
- dx = 15; // d47377
- GridData data = new GridData();
- data.horizontalSpan = horizontalSpan;
- data.horizontalAlignment = GridData.FILL;
- //data.widthHint = 300;
- data.heightHint = heightInLines * dx;
- data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- //data.grabExcessVerticalSpace = true;
- commandSoFar.setLayoutData(data);
- return commandSoFar;
- }
-
- /**
- * Create a text field and insert it into a GridLayout.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent GridLayout composite to put the field into.
- * @param listener Listener object to listen for events. Can be null.
- */
- public static Text createTextField(Composite parent, Listener listener) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- if (listener != null)
- text.addListener(SWT.Modify, listener);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = 150;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- text.setLayoutData(data);
- return text;
- }
-
- /**
- * Create a text field and insert it into a GridLayout, and assign tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent composite to put the field into.
- * @param listener object to listen for events. Can be null.
- * @param toolTip tooltip text
- */
- public static Text createTextField(Composite parent, Listener listener, String toolTip) {
- Text text = createTextField(parent, listener);
- setToolTipText(text, toolTip);
- return text;
- }
-
- /**
- * Create a labeled text field and insert it into a GridLayout, and assign tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
- *
- * @param parent composite to put the field into.
- * @param listener object to listen for events. Can be null.
- * @param labelText the label
- * @param tooltip the tooltip
- * @return TextField created.
- */
- public static Text createLabeledTextField(Composite parent, Listener listener, String labelText, String tooltip) {
- previousLabel = createLabel(parent, appendColon(labelText));
- Text entry = createTextField(parent, listener, tooltip);
- setToolTipText(previousLabel, tooltip);
- return entry;
- }
-
- /**
- * Create a readonly text field and insert it into a GridLayout.
- * @param parent GridLayout composite to put the field into.
- */
- public static Text createReadonlyTextField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- text.setEnabled(false);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = 150; // defect 45789
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- text.setLayoutData(data);
- return text;
- }
-
- /**
- * Create a readonly text field and insert it into a GridLayout,
- * and assign tooltip text.
- * @param parent composite to put the field into.
- * @param toolTip
- */
- public static Text createReadonlyTextField(Composite parent, String toolTip)
- {
- Text text = createReadonlyTextField(parent);
- setToolTipText(text, toolTip);
- return text;
- }
-
- /**
- * Create a labeled readonly text field and insert it into a GridLayout, and assign tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
- *
- * @param parent composite to put the field into.
- * @param text the label
- * @param tooltip the tooltip
- * @return TextField created.
- */
- public static Text createLabeledReadonlyTextField(Composite parent, String text, String tooltip) {
- previousLabel = createLabel(parent, appendColon(text));
- Text entry = createReadonlyTextField(parent, tooltip);
- setToolTipText(previousLabel, tooltip);
- return entry;
- }
-
- /**
- * Create a multiline text field and insert it into a GridLayout.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent GridLayout composite to put the field into.
- * @param listener Listener object to listen for events. Can be null.
- */
- public static Text createMultiLineTextField(Composite parent, Listener listener, int heightHint) {
- Text text = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
-
- if (listener != null)
- text.addListener(SWT.Modify, listener);
-
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.heightHint = heightHint;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- text.setLayoutData(data);
- return text;
- } // end createMultiLineTextField()
-
- /**
- * Create a multiline labeled text field and insert it into a GridLayout, and assign tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent composite to put the field into.
- * @param listener object to listen for events. Can be null.
- * @param labelString the label
- * @param tooltip the tooltip
- * @return TextField created.
- */
- public static Text createMultiLineLabeledTextField(Composite parent, Listener listener, String labelString, String tooltip, int heightHint) {
- Label label = createLabel(parent, appendColon(labelString));
- Text text = createMultiLineTextField(parent, listener, heightHint);
- setToolTipText(label, tooltip);
- return text;
- } // end createMultiLineLabeledTextField()
-
- /**
- * Creates a new checkbox instance and sets the default
- * layout data. Spans 1 column horizontally.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the checkbox into.
- * @param label to display in the checkbox.
- * @param listener object to listen for events. Can be null.
- */
- public static Button createCheckBox(Composite group, String label, Listener listener) {
- return createCheckBox(group, 1, label, listener);
- }
-
- /**
- * Creates a new checkbox instance with the given horizontal span and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the checkbox into.
- * @param horizontalSpan number of columns this checkbox is to span.
- * @param label to display in the checkbox.
- * @param listener object to listen for events. Can be null.
- */
- public static Button createCheckBox(Composite group, int horizontalSpan, String label, Listener listener) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- if (listener != null)
- button.addListener(SWT.Selection, listener);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.horizontalSpan = horizontalSpan;
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * Creates a new checkbox instance and sets the default
- * layout data, and sets the tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the checkbox into.
- * @param listener object to listen for events. Can be null.
- * @param label the label
- * @param tooltip the tooltip
- */
- public static Button createCheckBox(Composite group, Listener listener, String label, String tooltip)
- {
- Button button = createCheckBox(group, label, listener);
- setToolTipText(button, tooltip);
- return button;
- }
-
- /**
- * Creates a new checkbox instance with the given horizontal span and sets the default
- * layout data, and sets the tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the checkbox into.
- * @param horizontalSpan number of columns to span.
- * @param listener object to listen for events. Can be null.
- * @param label the label
- * @param tooltip the tooltip
- */
- public static Button createCheckBox(Composite group, int horizontalSpan, Listener listener, String label, String tooltip)
- {
- Button button = createCheckBox(group, horizontalSpan, label, listener);
- setToolTipText(button, tooltip);
- return button;
- }
-
- /**
- * Creates a new radiobutton instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param label to display in the button
- * @param listener object to listen for events. Can be null.
- */
- public static Button createRadioButton(Composite group, String label, Listener listener) {
- Button button = new Button(group, SWT.RADIO | SWT.LEFT);
- button.setText(label);
- if (listener != null)
- button.addListener(SWT.Selection, listener);
- GridData data = new GridData();
- // following 2 lines added in R2 by Phil, to be consistent with checkboxes
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * Creates a new radiobutton instance and sets the default
- * layout data, and assigns tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param listener object to listen for events. Can be null.
- * @param label the label
- * @param tooltip the tooltip
- */
- public static Button createRadioButton(Composite group, Listener listener, String label, String tooltip)
- {
- Button button = createRadioButton(group, label, listener);
- setToolTipText(button, tooltip);
- return button;
- }
-
- /**
- * Creates a new radiobutton instance and sets the default
- * layout data, and assigns tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param listener object to listen for events. Can be null.
- * @param label the label
- */
- public static Button createRadioButton(Composite group, Listener listener, String label)
- {
- Button button = createRadioButton(group, label, listener);
- return button;
- }
-
- /**
- * Creates a new pushbutton instance with an image, vs text.
- * SWT does not allow both image and text on a button.
- * Assign the listener to the passed in implementer of Listener.
- * @param group The composite to put the button into.
- * @param image The image to display in the button
- * @param listener The object to listen for events. Can be null.
- */
- public static Button createImageButton(Composite group, Image image, Listener listener) {
- Button button = new Button(group, SWT.PUSH);
- button.setImage(image);
- if (listener != null)
- button.addListener(SWT.Selection, listener);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * Creates a new pushbutton instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param label to display in the button
- * @param listener object to listen for events. Can be null.
- */
- public static Button createPushButton(Composite group, String label, Listener listener) {
- Button button = new Button(group, SWT.PUSH);
- button.setText(label);
- if (listener != null)
- button.addListener(SWT.Selection, listener);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- button.setLayoutData(data);
- return button;
- }
-
- /**
- * Creates a new pushbutton instance and sets the default
- * layout data, and assign tooltip text
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param label to display in the button
- * @param listener object to listen for events. Can be null.
- * @param tooltip the tooltip
- */
- public static Button createPushButton(Composite group, String label, Listener listener, String tooltip) {
- Button button = createPushButton(group, label, listener);
- setToolTipText(button, tooltip);
- return button;
- }
-
- /**
- * This one takes the resource bundle key and appends "label" and "tooltip" to it to
- * get the label and tooltip text.
- * @param group composite to put the button into.
- * @param listener object to listen for events. Can be null.
- * @param label the label
- * @param tooltip the tooltip
- */
- public static Button createPushButton(Composite group, Listener listener, String label, String tooltip)
- {
- Button button = createPushButton(group, label, listener);
- setToolTipText(button, tooltip);
- return button;
- }
-
- /**
- * Creates a new "Browse..." pushbutton instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param listener object to listen for events. Can be null.
- */
- public static Button createBrowseButton(Composite group, Listener listener)
- {
- String label = SystemResources.BUTTON_BROWSE;
- return createPushButton(group, label, listener);
- }
- /**
- * Creates a new "Browse..." pushbutton instance and sets the default
- * layout data, with tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param listener object to listen for events. Can be null.
- * @param tooltip the tooltip text
- * @deprecated
- */
- public static Button createBrowseButton(Composite group, Listener listener, String tooltip) {
- String label = SystemResources.BUTTON_BROWSE;
- return createPushButton(group, label, listener, tooltip);
- }
-
-
- /**
- * Creates a new listbox instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param label to display above the list box (can be null).
- * @param listener object to listen for events. Can be null.
- * @param multiSelect true if this is to be a multiple selection list. False for single selection.
- */
- public static List createListBox(Composite group, String label, Listener listener, boolean multiSelect) {
- return createListBox(group, label, listener, multiSelect, 1);
- }
-
- /**
- * Creates a new listbox instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param label to display above the list box (can be null).
- * @param listener object to listen for events. Can be null.
- * @param multiSelect true if this is to be a multiple selection list. False for single selection.
- * @param columnSpan number of columns this should span
- */
- public static List createListBox(Composite group, String label, Listener listener, boolean multiSelect, int columnSpan) {
- Composite composite_list = null;
- if (label != null) {
- composite_list = createComposite(group, 1);
- ((GridLayout) composite_list.getLayout()).marginWidth = 0;
- GridData data = new GridData();
- data.horizontalSpan = columnSpan;
- data.grabExcessVerticalSpace = true;
- data.verticalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- composite_list.setLayoutData(data);
- previousLabel = createLabel(composite_list, label);
- }
- int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER;
- List list = new List((composite_list != null) ? composite_list : group, multiSelect ? (SWT.MULTI | styles) : (SWT.SINGLE | styles));
- if (listener != null)
- list.addListener(SWT.Selection, listener);
- GridData data = new GridData();
- data.widthHint = 100;
- data.heightHint = 150;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessVerticalSpace = true;
- data.verticalAlignment = GridData.FILL;
- list.setLayoutData(data);
- return list;
- }
-
- /**
- * Creates a new listbox instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param label to display above the list box (can be null).
- * @param listener object to listen for events. Can be null.
- * @param multiSelect true if this is to be a multiple selection list. False for single selection.
- * @param tooltip the tooltip
- */
- public static List createListBox(Composite group, String label, Listener listener, boolean multiSelect, String tooltip) {
- List list = createListBox(group, label, listener, multiSelect);
- setToolTipText(list, tooltip);
- return list;
- }
-
- /**
- * Creates a new listbox instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param group composite to put the button into.
- * @param listener object to listen for events. Can be null.
- * @param multiSelect true if this is to be a multiple selection list. False for single selection.
- * @param label the label
- * @param tooltip the tooltip
- */
- public static List createListBox(Composite group, Listener listener, boolean multiSelect, String label, String tooltip) {
- List list = createListBox(group, label, listener, multiSelect);
- setToolTipText(list, tooltip);
- return list;
- }
-
- /**
- * Creates a new combobox instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent composite to put the button into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- */
- public static Combo createCombo(Composite parent, Listener listener) {
- Combo combo = createCombo(parent, SWT.DROP_DOWN);
- if (listener != null)
- combo.addListener(SWT.Selection, listener);
- return combo;
- }
-
- /**
- * private method for re-use
- */
- private static Combo createCombo(Composite parent, int style) {
- Combo combo = new Combo(parent, style);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = 150;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- combo.setLayoutData(data);
- return combo;
- }
-
- /**
- * Creates a new combobox instance and sets the default
- * layout data, with tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent composite to put the combo into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- * @param toolTip tooltip text
- */
- public static Combo createCombo(Composite parent, Listener listener, String toolTip)
- {
- Combo combo = createCombo(parent, listener);
- setToolTipText(combo, toolTip);
- return combo;
- }
-
- /**
- * Create a labeled combo field and insert it into a GridLayout, and assign tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
- *
- * @param parent composite to put the field into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- * @param label the label text
- * @param tooltip the tooltip for the combo field
- * @return Combo created.
- */
- public static Combo createLabeledCombo(Composite parent, Listener listener, String label, String tooltip)
- {
- previousLabel = createLabel(parent, appendColon(label));
- Combo entry = createCombo(parent, listener, tooltip);
- setToolTipText(previousLabel, tooltip);
- return entry;
- }
-
- /**
- * Creates a new readonly combobox instance and sets the default
- * layout data.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent composite to put the button into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- */
- public static Combo createReadonlyCombo(Composite parent, Listener listener) {
- Combo combo = createCombo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- if (listener != null)
- combo.addListener(SWT.Selection, listener);
- return combo;
- }
-
- /**
- * Creates a new readonly combobox instance and sets the default
- * layout data, with tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * @param parent composite to put the button into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- * @param tooltip
- */
- public static Combo createReadonlyCombo(Composite parent, Listener listener, String tooltip)
- {
- Combo combo = createReadonlyCombo(parent, listener);
- setToolTipText(combo, tooltip);
- return combo;
- }
-
- /**
- * Create a labeled readonly combo field and insert it into a GridLayout, and assign tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * If you need a handle to the prompting label, immediately call {@link #getLastLabel()}
- *
- * @param parent composite to put the field into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- * @param labelText the label
- * @param tooltip the tooltip
- * @return Combo created.
- */
- public static Combo createLabeledReadonlyCombo(Composite parent, Listener listener, String labelText, String tooltip)
- {
- labelText = appendColon(labelText);
- previousLabel = createLabel(parent, labelText);
- Combo entry = createReadonlyCombo(parent, listener, tooltip);
- setToolTipText(previousLabel, tooltip);
- return entry;
- }
-
- /**
- * Creates a new historical combobox instance and sets the default
- * layout data, with tooltip text.
- * <p>
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * A historical combobox is one that persists its contents between sessions. The management
- * of that persistence is handled for you!.
- * <p>
- * @param parent composite to put the combo into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addListener(SWT.Modify,this) on your own.
- * @param historyKey the preferences key (any unique string) to use to persist this combo's history
- * @param readonly true if this combo is to be readonly, forcing user to select from the history
- * @param tooltip the tooltip
- */
- public static SystemHistoryCombo createHistoryCombo(Composite parent, SelectionListener listener, String historyKey, boolean readonly, String tooltip)
- {
- SystemHistoryCombo combo = new SystemHistoryCombo(parent, SWT.NULL, historyKey, readonly);
- if (listener != null)
- combo.addSelectionListener(listener);
- boolean hasGridData = (combo.getLayoutData() != null) && (combo.getLayoutData() instanceof GridData);
- //System.out.println("history combo griddata non-null? " + hasGridData);
- int minwidth = 150;
- if (!hasGridData) {
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = minwidth;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- combo.setLayoutData(data);
- } else {
- ((GridData) combo.getLayoutData()).horizontalAlignment = GridData.FILL;
- ((GridData) combo.getLayoutData()).grabExcessHorizontalSpace = true;
- ((GridData) combo.getLayoutData()).widthHint = minwidth;
- }
- setToolTipText(combo, tooltip);
- return combo;
- }
-
-
-
-
- /**
- * Creates a new remote system connection combobox instance and sets the default
- * layout data, with tooltip text.
- * <p>
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * A remote system connection combobox is one that allows users to select a connection. The connection
- * list can be subsetted by system type, subsystem factory or subsystem factory category.
- * It has a "Connection:" prompt in front of it and optionally a "New..." button beside it.
- * <p>
- * @param parent composite to put the combo into.
- * @param listener object to listen for selection events. Can be null.
- * If you want to listen for modify events, call addSelectionListener(...) on your own.
- * @param systemTypes array of system types to subset connection list by. Specify a single entry of '*' for
- * all system types. Specify this <i>OR</i> specify factory <i>OR</i> specify factoryCategory
- * <i>OR</i> specify factory Id
- * @param factory the subsystem factory to subset connection list by. Only connections with a subsystem
- * owned by this factory are listed. Specify this <i>OR</i> specify systemTypes <i>OR</i> specify factoryCategory
- * <i>OR</i> specify factory Id
- * @param factoryId the subsystem factory id to subset connection list by. Only connections with a
- * subsystem owned by this factory are listed, where id is a string specified in the
- * plugin.xml file for the subsystem factory extension point definition.
- * Specify this <i>OR</i> specify factory <i>OR</i> specify systemTypes <i>OR</i> specify factory category
- * @param factoryCategory the subsystem factory category to subset connection list by. Only connections with a
- * subsystem owned by a factory of this category are listed, where category is a string specified in the
- * plugin.xml file for the subsystem factory extension point definition.
- * Specify this <i>OR</i> specify factory <i>OR</i> specify factory Id <i>OR</i> specify systemTypes
- * @param defaultConnection the connection to pre-select. Can be null.
- * @param horizontalSpan number of columns this should span
- * @param newButton true if the combo is to have a "New..." button beside it
- */
- public static SystemHostCombo createConnectionCombo(Composite parent, SelectionListener listener, IRSESystemType[] systemTypes, ISubSystemConfiguration factory, String factoryId, String factoryCategory, IHost defaultConnection, int horizontalSpan, boolean newButton) {
- SystemHostCombo combo = null;
- if (systemTypes != null)
- combo = new SystemHostCombo(parent, SWT.NULL, systemTypes, defaultConnection, newButton);
- else if (factory != null)
- combo = new SystemHostCombo(parent, SWT.NULL, factory, defaultConnection, newButton);
- else if (factoryId != null)
- combo = new SystemHostCombo(parent, SWT.NULL, defaultConnection, factoryId, newButton);
- else if (factoryCategory != null)
- combo = new SystemHostCombo(parent, SWT.NULL, defaultConnection, newButton, factoryCategory);
- if (listener != null && combo != null)
- combo.addSelectionListener(listener);
-
- boolean hasGridData = false;
- if (combo != null)
- hasGridData = (combo.getLayoutData() != null) && (combo.getLayoutData() instanceof GridData);
- //System.out.println("history directory griddata non-null? " + hasGridData);
- int minwidth = 250; // todo: tweak this?
- if (!hasGridData) {
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = minwidth;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- data.horizontalSpan = horizontalSpan;
- if (combo != null)
- combo.setLayoutData(data);
- } else {
- if (combo != null)
- {
- ((GridData) combo.getLayoutData()).horizontalSpan = horizontalSpan;
- ((GridData) combo.getLayoutData()).horizontalAlignment = GridData.FILL;
- ((GridData) combo.getLayoutData()).grabExcessHorizontalSpace = true;
- ((GridData) combo.getLayoutData()).widthHint = minwidth;
- }
- }
- return combo;
- }
-
- private static IRSESystemType[] validSystemTypes = null;
-
- /**
- * Return the list of all registered valid system types.
- *
- * A system type is considered valid, if at least one subsystem
- * configuration is registered against it, and the system type
- * is enabled in the Preferences.
- * The list is ordered alphabetically by system type label
- * according to international unicode rules, in the current Locale.
- *
- * @param restrictIds An array of system type IDs to restrict the
- * returned list of valid system types to only those requested,
- * or <code>null</code> to return all valid system types.
- * @return an ordered list of all registered valid system types.
- */
- public static IRSESystemType[] getValidSystemTypes(String[] restrictIds) {
- // Step 1: Get all static configured valid system types,
- // According to what subsystem configurations are registered.
- if (validSystemTypes==null) {
- IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
- ArrayList list = new ArrayList(systemTypes.length);
- //TODO check if we shouldn't better get the IRSESystemTypeAdapter and check for isEnabled()
- //This would do more than checking validity but also enablement
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISubSystemConfigurationProxy[] ssfProxies = sr.getSubSystemConfigurationProxies();
- for (int i=0; i<systemTypes.length; i++) {
- for (int j=0; j<ssfProxies.length; j++) {
- if (ssfProxies[j].appliesToSystemType(systemTypes[i])) {
- list.add(systemTypes[i]);
- break;
- }
- }
- }
- systemTypes = (IRSESystemType[])list.toArray(new IRSESystemType[list.size()]);
- sortSystemTypesByLabel(systemTypes);
- validSystemTypes = systemTypes;
- }
- // Step 2: Restrict the list if requested
- boolean filtered = false;
- java.util.List result = new ArrayList(validSystemTypes.length);
- java.util.List restrictList = (restrictIds==null) ? null : Arrays.asList(restrictIds);
- for(int i=0; i<validSystemTypes.length; i++) {
- IRSESystemType systemType = validSystemTypes[i];
- if (restrictList==null || restrictList.contains(systemType)) {
- // Step 3: check enablement in Preferences
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(RSESystemTypeAdapter.class));
- if (adapter != null && adapter.isEnabled(systemType)) {
- result.add(systemType);
- } else {
- filtered = true;
- }
- }
- }
- if (filtered) {
- return (IRSESystemType[])result.toArray(new IRSESystemType[result.size()]);
- } else {
- return validSystemTypes;
- }
- }
-
- /**
- * Sorts the given array of systemTypes in ascending order by system
- * type label.
- *
- * Note that this method sorts the array in place, so clients are
- * responsible for creating a copy of the array when needed.
- * Labels are sorted with a Collator according to international
- * unicode rules, in the current Locale.
- *
- * @param systemTypes list of system types to sort
- */
- public static void sortSystemTypesByLabel(IRSESystemType[] systemTypes) {
- Arrays.sort(systemTypes, new Comparator() {
- private Collator collator = Collator.getInstance();
- public int compare(Object o1, Object o2) {
- IRSESystemType t1 = (IRSESystemType)o1;
- IRSESystemType t2 = (IRSESystemType)o2;
- return collator.compare(t1.getLabel(), t2.getLabel());
- }
- });
- }
-
- /**
- * Return the labels for the given list of system types.
- * @param systemTypes an array of system types
- * @return the String labels for the system types.
- */
- public static String[] getSystemTypeLabels(IRSESystemType[] systemTypes) {
- String[] labels = new String[systemTypes.length];
- for (int i=0; i<systemTypes.length; i++) {
- labels[i] = systemTypes[i].getLabel();
- }
- return labels;
- }
-
- /**
- * Creates a readonly system type combination box with the given system types.
- *
- * Does NOT create the leading prompt or anything except the combo.
- * In order to find out what system type was selected, clients need to
- * use {@link Combo#getSelectionIndex()} and use the return value as
- * an index into the array of system types they provided.
- *
- * @param parent the parent composite to embed this widget in.
- * @param listener a listener for selection events.
- * @param systemTypes an array of system types to show in this Combo.
- * Must not be <code>null</code>.
- * Fill this with the result of {@link #getValidSystemTypes(String[])}
- * with a null argument in order to get a combo box with all valid
- * system types.
- * @return a Combo box displaying the given system types.
- */
- public static Combo createSystemTypeCombo(Composite parent, Listener listener, IRSESystemType[] systemTypes) {
- Combo combo = createReadonlyCombo(parent, listener, SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP);
- combo.setItems(getSystemTypeLabels(systemTypes));
- combo.select(0);
- return combo;
- }
-
- /**
- * Creates a hostname combination box. It if prefilled with all previously specified hostnames
- * for the given system type.
- * <p>
- * Does NOT create the leading prompt or anything except the combo.
- */
- public static Combo createHostNameCombo(Composite parent, Listener listener, IRSESystemType systemType) {
- //System.out.println("TipId: " + ISystemConstants.RESID_HOSTNAME_TIP);
- Combo combo = createCombo(parent, listener, SystemResources.RESID_CONNECTION_HOSTNAME_TIP);
- //System.out.println("Tip : " + combo.getToolTipText());
- combo.setItems(RSECorePlugin.getTheSystemRegistry().getHostNames(systemType));
- combo.select(0);
- return combo;
- }
-
- /**
- * Create an entry field controlled by an inherit/override switch button
- * <p>
- * After creating the widget, call setLocal to set initial state, and setInheritedText/setLocalText to set inherited/local text
- * @param parent composite to put the button into.
- * @param toggleToolTip text for the toggle. Can be null
- * @param entryToolTip text for the entry field. Can be null
- * @return The text field widget
- */
- public static InheritableEntryField createInheritableTextField(Composite parent, String toggleToolTip, String entryToolTip)
- {
- InheritableEntryField entryField = new InheritableEntryField(parent, SWT.NULL);
- if (toggleToolTip != null)
- entryField.setToggleToolTipText(toggleToolTip);
- if (entryToolTip != null)
- entryField.setTextFieldToolTipText(entryToolTip);
- return entryField;
- }
-
- /**
- * Helper method to line up the leading prompts in a composite, taking
- * into account composite prompts nested within.
- */
- public static void lineUpPrompts(Composite composite) {
- //System.out.println("Inside lineUpPrompts:");
- composite.layout(true);
- // FIND SIZE OF FIRST LABEL IN FIRST COLUMN (WILL ALL BE SAME SIZE)...
- Label firstLabel = getFirstColumnOneLabel(composite);
- // FIND MAX SIZE OF FIRST LABEL IN ALL NESTED COMPOSITES (WILL ALL BE DIFFERENT SIZES)...
- //System.out.println("Scanning nested composites:");
- int nbrColumns = ((GridLayout) composite.getLayout()).numColumns;
- Control[] childControls = composite.getChildren();
- int maxNestedLabelWidth = 0;
- int currColumn = 0;
- if ((childControls != null) && (childControls.length > 0)) {
- for (int idx = 0;(idx < childControls.length); idx++) {
- int rem = currColumn % nbrColumns;
- //System.out.println("...1.rem = " + rem);
- if ((currColumn == 0) || (rem == 0)) {
- if (childControls[idx] instanceof Composite) {
- Label firstNestedLabel = getFirstColumnOneLabel((Composite) childControls[idx]);
- if (firstNestedLabel != null) {
- if (firstNestedLabel.getSize().x > maxNestedLabelWidth)
- maxNestedLabelWidth = firstNestedLabel.getSize().x;
- }
- }
- }
- currColumn += ((GridData) childControls[idx].getLayoutData()).horizontalSpan;
- }
- //System.out.println("Max nested label size = " + maxNestedLabelWidth);
- }
-
- // DECIDE WHAT MAXIMUM WIDTH IS
- int columnOneWidth = 0;
- if (firstLabel != null)
- columnOneWidth = firstLabel.getSize().x;
- if (maxNestedLabelWidth > columnOneWidth)
- columnOneWidth = maxNestedLabelWidth;
- //System.out.println("Calculated column one width = " + columnOneWidth);
- // APPLY NEW WIDTH TO FIRST COLUMN ONE LABEL
- if (firstLabel != null)
- ((GridData) firstLabel.getLayoutData()).widthHint = columnOneWidth;
- // APPLY NEW WIDTH TO FIRST COLUMN ONE LABEL OF ALL NESTED COMPOSITES...
- currColumn = 0;
- if ((childControls != null) && (childControls.length > 0)) {
- for (int idx = 0;(idx < childControls.length); idx++) {
- int rem = currColumn % nbrColumns;
- if ((currColumn == 0) || (rem == 0)) {
- if (childControls[idx] instanceof Composite) {
- Label firstNestedLabel = getFirstColumnOneLabel((Composite) childControls[idx]);
- if (firstNestedLabel != null)
- ((GridData) firstNestedLabel.getLayoutData()).widthHint = columnOneWidth;
- }
- }
- currColumn += ((GridData) childControls[idx].getLayoutData()).horizontalSpan;
- }
- }
- composite.layout(true);
- }
-
- /**
- * Given a composite that has been layed out, return the first label found in the first column.
- */
- public static Label getFirstColumnOneLabel(Composite composite) {
- //System.out.println("...Inside getFirstColumnOneLabel:");
- int nbrColumns = ((GridLayout) composite.getLayout()).numColumns;
- Control[] childControls = composite.getChildren();
- Label firstLabel = null;
- int currColumn = 0;
- if ((childControls != null) && (childControls.length > 0)) {
- for (int idx = 0;(firstLabel == null) && (idx < childControls.length); idx++) {
- int rem = currColumn % nbrColumns;
- //System.out.println("......0.rem = " + rem);
- if ((currColumn == 0) || (rem == 0)) {
- if (childControls[idx] instanceof Label) {
- firstLabel = (Label) childControls[idx];
- if (firstLabel.getText().trim().length() == 0)
- firstLabel = null; // skip it. Only a filler.
- }
- }
- currColumn += ((GridData) childControls[idx].getLayoutData()).horizontalSpan;
- }
- }
- //if (firstLabel != null)
- // System.out.println("...returning first label of '"+firstLabel.getText()+"', width = " + firstLabel.getSize().x);
- //else
- // System.out.println("...no first label found");
- return firstLabel;
- }
-
- /**
- * Given a Composite, this method walks all the children recursively and
- * and sets the mnemonics uniquely for each child control where a
- * mnemonic makes sense (eg, buttons).
- * The letter/digit chosen for the mnemonic is unique for this Composite,
- * so you should call this on as high a level of a composite as possible
- * per Window.
- * Call this after populating your controls.
- * @return mnemonics object used for recording used-mnemonics. Use this
- * as input to subsequent calls to setMnemonics for the same window/dialog.
- */
- public static Mnemonics setMnemonics(Composite parent) {
- Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
- mnemonics.setMnemonics(parent);
- return mnemonics;
- }
-
- /**
- * Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
- */
- public static Mnemonics setMnemonics(Composite parent, boolean applyToPrecedingLabels) {
- Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
- mnemonics.setApplyMnemonicsToPrecedingLabels(applyToPrecedingLabels);
- mnemonics.setMnemonics(parent);
- return mnemonics;
- }
-
- /**
- * Same as above but specifically for wizard pages
- */
- public static Mnemonics setWizardPageMnemonics(Composite parent) {
- Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
- mnemonics.setOnWizardPage(true);
- mnemonics.setMnemonics(parent);
- return mnemonics;
- }
-
- /**
- * Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
- */
- public static Mnemonics setWizardPageMnemonics(Composite parent, boolean applyToPrecedingLabels) {
- Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
- mnemonics.setOnWizardPage(true);
- mnemonics.setApplyMnemonicsToPrecedingLabels(applyToPrecedingLabels);
- mnemonics.setMnemonics(parent);
- return mnemonics;
- }
-
- /**
- * Same as above but specifically for preference pages
- */
- public static Mnemonics setPreferencePageMnemonics(Composite parent) {
- Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
- mnemonics.setOnPreferencePage(true);
- mnemonics.setMnemonics(parent);
- return mnemonics;
- }
-
- /**
- * Same as above but also whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields.
- */
- public static Mnemonics setPreferencePageMnemonics(Composite parent, boolean applyToPrecedingLabels) {
- Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics for composite and nested composites
- mnemonics.setOnPreferencePage(true);
- mnemonics.setApplyMnemonicsToPrecedingLabels(applyToPrecedingLabels);
- mnemonics.setMnemonics(parent);
- return mnemonics;
- }
-
- /**
- * Same as above but takes as input a previously populated mnemonics object,
- * which records already-used mnemonics for whatever scope you want (a dialog usually).
- */
- public static Mnemonics setMnemonics(Mnemonics mnemonics, Composite parent) {
- mnemonics.setMnemonics(parent);
- return mnemonics;
- }
- /**
- * Given an SWT Menu, "walk it" and automatically assign unique
- * mnemonics for every menu item in it, and then for each
- * submenu, do so for it too.
- * @param menu the menubar to add mnemonics for
- */
- public static void setMnemonics(Menu menu) {
- Mnemonics mnemonics = new Mnemonics(); // instance of this class to get unique mnemonics FOR THIS MENU ONLY
- // walk the menu bar getting each menu...
- MenuItem menuItems[] = menu.getItems();
- for (int idx = 0; idx < menuItems.length; idx++) {
- MenuItem currMenuItem = menuItems[idx];
- // assign unique mnemonic from characters in menu text...
- currMenuItem.setText(mnemonics.setUniqueMnemonic(currMenuItem.getText()));
- // for a cascade or popup, this menuitem is itself a menu
- Menu nestedMenu = currMenuItem.getMenu();
- if (nestedMenu != null)
- setMnemonics(nestedMenu);
- } // end for all menus loop
- } // end addMnemonicsForMenuBar
-
- /**
- * Given a Composite, this method walks all the children recursively and
- * and sets the infopop help id for each child control where help
- * makes sense (eg, buttons, combos, entry fields, lists, trees).
- * <p>
- * Call this after populating your controls.
- */
- public static void setCompositeHelp(Composite parent, String helpID) {
- //setCompositeHelp(parent, helpID, (Hashtable)null);
- setHelp(parent, helpID);
- }
-
- /**
- * Set the context id for a control on a view part
- * @deprecated
- */
- public static void setHelp(Control c, IViewPart view, Object id) {
- //ViewContextComputer comp = new ViewContextComputer(view, id);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id.toString());
- if (traceHelpIDs)
- SystemBasePlugin.logInfo("Setting help id: " + id); //$NON-NLS-1$
- }
-
- /**
- * Set the context id for a control
- */
- public static void setHelp(Control c, String id) {
- PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id);
- }
-
- /**
- * Set the context id for an action
- */
- public static void setHelp(IAction c, String id) {
- String[] ids = new String[1];
- ids[0] = id;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id);
- }
-
- /**
- * Set the context id for a menu item
- */
- public static void setHelp(MenuItem c, String id) {
- String[] ids = new String[1];
- ids[0] = id;
- PlatformUI.getWorkbench().getHelpSystem().setHelp(c, id);
- //setHelp(c, ids);
- }
-
- private final static char STANDARD_COLON = ':';
- private final static char WIDE_COLON = '\uFF1A';
- /**
- * Appends a colon to a label, if the label doesn't already end in a colon of the proper size.
- * If the wrong size colon is already there, it strips it first.
- * @param label the label which to examine for a colon
- * @return the label ending with a colon of the appropriate size
- */
- public static String appendColon(String label) {
- /* Added for Defect 47275 */
- String result = label;
- boolean append = false;
- boolean strip = false;
- Locale currentLocale = Locale.getDefault();
- String language = currentLocale.getLanguage();
- boolean cjk = language.equals("zh") || language.equals("ja") || language.equals("ko"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- int n = result.length();
- if (n > 0) {
- char lastCharacter = label.charAt(n - 1);
- if (cjk) {
- strip = (lastCharacter == STANDARD_COLON);
- append = (lastCharacter != WIDE_COLON);
- } else {
- strip = (lastCharacter == WIDE_COLON);
- append = (lastCharacter != STANDARD_COLON);
- }
- } else {
- strip = false;
- append = true;
- }
- if (strip) {
- result = result.substring(0, n - 1);
- }
- if (append) {
- // special processing for french, a space is required before a colon
- if (language.equals("fr") && result.length() > 0) { //$NON-NLS-1$
- result += " "; //$NON-NLS-1$
- }
- result += (cjk ? WIDE_COLON : STANDARD_COLON);
- }
- return result;
- }
-
-
-
-
- /**
- * Set tooltip text
- * If key does not end in "tooltip", then this is appended to it
- */
- private static void setToolTipText(Control widget, String tooltip) {
- if (tooltip != null)
- widget.setToolTipText(tooltip);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayHidableSystemMessageAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayHidableSystemMessageAction.java
deleted file mode 100644
index 68fe4f615..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplayHidableSystemMessageAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Michael Berger (IBM) - Initial API and implementation
- * David McKnight (IBM) - [216596] determine whether to show yes/no or just okay
- *******************************************************************************/
-package org.eclipse.rse.ui.actions;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-public class DisplayHidableSystemMessageAction extends
- DisplaySystemMessageAction
-{
- protected IPreferenceStore _store;
- protected String _prefID;
- /**
- * @since 3.0
- */
- protected boolean _showYesNo = true;
-
- public DisplayHidableSystemMessageAction(SystemMessage message, IPreferenceStore prefStore, String prefID)
- {
- super(message);
- _store = prefStore;
- _prefID = prefID;
- }
-
- /**
- * @since 3.0
- */
- public DisplayHidableSystemMessageAction(SystemMessage message, IPreferenceStore prefStore, String prefID, boolean showYesNo)
- {
- super(message);
- _store = prefStore;
- _prefID = prefID;
- _showYesNo = showYesNo;
- }
-
- /**
- * @see Runnable#run()
- */
- public void run() {
- boolean finished = false;
-
- Shell[] shells = Display.getCurrent().getShells();
- for (int loop = 0; loop < shells.length && !finished; loop++) {
- if (shells[loop].isEnabled() && shells[loop].isVisible()) {
- SystemMessageDialog dialog = new SystemMessageDialog(shells[loop], message);
- dialog.setNoShowAgainOption(true, _store, _prefID, false);
- dialog.openQuestionNoException(_showYesNo);
- rc = dialog.getButtonPressedId();
- finished = true;
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java
deleted file mode 100644
index e1d54fc8d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/DisplaySystemMessageAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This class can be used to display SystemMessages via the Display.async
- * and sync methods.
- */
-public class DisplaySystemMessageAction implements Runnable {
-
-
- protected SystemMessage message;
- protected int rc;
-
- public DisplaySystemMessageAction(SystemMessage message) {
- this.message = message;
- }
-
-
- /**
- * @see Runnable#run()
- */
- public void run() {
- boolean finished = false;
-
- Shell[] shells = Display.getCurrent().getShells();
- for (int loop = 0; loop < shells.length && !finished; loop++) {
- if (shells[loop].isEnabled() && shells[loop].isVisible()) {
- SystemMessageDialog dialog = new SystemMessageDialog(shells[loop], message);
- dialog.open();
- rc = dialog.getButtonPressedId();
- finished = true;
- }
- }
- }
-
- /**
- * Retrieve the return code from displaying the SystemMessageDialog
- */
- public int getReturnCode() {
- return rc;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java
deleted file mode 100644
index c1149ee41..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemAction.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Shell;
-/**
- * Suggested interface for actions in popup menus of the Remote System Explorer view.
- * While suggested, it is not required to implement this interface.
- * @see SystemBaseAction
- */
-public interface ISystemAction extends IAction, ISelectionChangedListener
-{
-
- // ------------------------
- // CONFIGURATION METHODS...
- // ------------------------
- /**
- * Set the help id for the action
- */
- public void setHelp(String id);
- /**
- * Set the context menu group this action is to go into, for popup menus. If not set,
- * someone else will make this decision.
- */
- public void setContextMenuGroup(String group);
- /**
- * Is this action to be enabled or disabled when multiple items are selected.
- */
- public void allowOnMultipleSelection(boolean allow);
- /**
- * Specify whether this action is selection-sensitive. The default is true.
- * This means the enabled state is tested and set when the selection is set.
- */
- public void setSelectionSensitive(boolean sensitive);
-
- // -----------------------------------------------------------
- // STATE METHODS CALLED BY VIEWER AT FILL CONTEXT MENU TIME...
- // -----------------------------------------------------------
- /**
- * Set shell of parent window. Remote System Explorer will call this.
- */
- public void setShell(Shell shell);
- /**
- * Set the Viewer that called this action. It is good practice for viewers to call this
- * so actions can directly access them if needed.
- */
- public void setViewer(Viewer v);
- /**
- * Sometimes we can't call selectionChanged() because we are not a selection provider.
- * In this case, use this to set the selection.
- */
- public void setSelection(ISelection selection);
- /**
- * An optimization for performance reasons that allows all inputs to be set in one call
- */
- public void setInputs(Shell shell, Viewer v, ISelection selection);
-
-
- // ----------------------------------------------------------------
- // GET METHODS FOR RETRIEVING STATE OR CONFIGURATION INFORMATION...
- // ----------------------------------------------------------------
- /**
- * Get the help id for this action
- */
- public String getHelpContextId();
- /**
- * Convenience method to get shell of parent window, as set via setShell.
- */
- public Shell getShell();
- /**
- * Get the Viewer that called this action. Not guaranteed to be set,
- * depends if that viewer called setViewer or not. SystemView does.
- */
- public Viewer getViewer();
- /**
- * Retrieve selection as set by selectionChanged() or setSelection()
- */
- public IStructuredSelection getSelection();
- /**
- * Get the context menu group this action is to go into, for popup menus. By default is
- * null, meaning there is no recommendation
- */
- public String getContextMenuGroup();
- /**
- * Return whether this action is selection-sensitive. The default is true.
- * This means the enabled state is tested and set when the selection is set.
- */
- public boolean isSelectionSensitive();
- /**
- * Return if true if this is a dummy action
- */
- public boolean isDummy();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java
deleted file mode 100644
index e13e98b32..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemCopyTargetSelectionCallback.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-
-
-/**
- * Callback interface between copy-actions and copy select-target-parent dialogs
- */
-public interface ISystemCopyTargetSelectionCallback
-{
-
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement);
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java
deleted file mode 100644
index bdaeeda98..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemDialogAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-/**
- * Suggested interface for actions in popup menus of the Remote System Explorer view,
- * which put up dialogs.
- * @see SystemBaseDialogAction
- */
-public interface ISystemDialogAction extends ISystemAction
-{
- /*
- * Return the parent window/dialog of this action. Same as getShell()
- *
- public Shell getParent();*/
-
- /*
- * Set the parent window/dialog of this action. Same as setShell(Shell parent)
- *
- public void setParent(Shell parent);*/
-
- /**
- * Set the value used as input to the dialog. Usually for update mode.
- * This is an alternative to selectionChanged or setSelection, as typically it is
- * the selection that is used as the input to the dialog.
- */
- public void setValue(Object value);
- /**
- * If this action supports allowOnMultipleSelection, then whether the action is to
- * be invoked once per selected item (false), or once for all selected items (true)
- */
- public void setProcessAllSelections(boolean all);
-
- /**
- * Get the output of the dialog.
- */
- public Object getValue();
- /**
- * Returns true if the user cancelled the dialog.
- * The default way to guess at this is to test if the output from
- * getDialogValue was null or not. Override if you need to refine this.
- */
- public boolean wasCancelled();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemViewMenuListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemViewMenuListener.java
deleted file mode 100644
index 3506319a1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemViewMenuListener.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-package org.eclipse.rse.ui.actions;
-
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.swt.events.ArmListener;
-import org.eclipse.swt.events.MenuListener;
-
-/**
- * An interface to be implemented for listening for menu show events for the
- * purpose of applying mnemonics to the menu items.
- *
- * @since 3.0
- */
-public interface ISystemViewMenuListener extends IMenuListener, MenuListener, ArmListener
-{
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java
deleted file mode 100644
index 9b065447b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/ISystemWizardAction.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-/**
- * Suggested interface for actions in popup menus of the Remote System Explorer view,
- * which put up wizards.
- * @see SystemBaseWizardAction
- */
-public interface ISystemWizardAction extends ISystemDialogAction
-{
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/LazyDownloadJob.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/LazyDownloadJob.java
deleted file mode 100644
index 504bd700b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/LazyDownloadJob.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2007 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-package org.eclipse.rse.ui.actions;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-
-public class LazyDownloadJob extends Job
-{
- private ISystemEditableRemoteObject _editable;
- public LazyDownloadJob(ISystemEditableRemoteObject editable)
- {
- // TODO Auto-generated constructor stub
- super("Downloading " + editable.getAbsolutePath());
- _editable = editable;
- }
-
- public IStatus run(IProgressMonitor monitor)
- {
- try
- {
- _editable.download(monitor);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return Status.OK_STATUS;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java
deleted file mode 100644
index 804aaf7fd..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseAction.java
+++ /dev/null
@@ -1,818 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A suggested base class for remote systems related actions.
- * <p>
- * What this offers beyond the basic Action class:
- * <ul>
- * <li>Support for setting label and tooltip and description from a resource bundle and single key prefix,
- * from which each string is derived by appending ".label", ".tooltip" and ".description" to the prefix.
- * <li>Support for setting and retrieving the shell from which the action is launched. Can be
- * set in the parent, or passed as null there and set later via setShell. Retrieve via getShell.
- * <li>Support actions that are selection-dependent, but need not be informed of every selection change.
- * For performance reasons, only track selections if the action is displayed in the toolbar where
- * state change needs to be visible. For popup actions, we only need to be informed of the
- * currently selection at the time the popup is built. Popup menu builders call selectionChanged
- * in this class at popup population time, so you need only subclass this method. However, even
- * that is made easier. The default implementation of this method in this class converts the
- * selection to an IStructuredSelection, and calls an overridable method named updateSelection
- * passing the structured selection. The action is enabled or disabled based on the returned
- * boolean value. Just override updateSelection to enable or disable based on selection.
- * Indeed, the default implementation of the updateSelection method is to return the result of
- * AND-ED result of calling checkObjectType on each item in the selection. So the easiest thing
- * you can do to enable/disable is to override checkObjectType.
- * <li>Support actions that are selection-dependent and need to be informed of every selection change
- * as it happens. To enable this, simply call setSelectionProvider to supply the GUI object such
- * as a viewer which fires the selection changed events we wish to monitor for. For the Remote
- * System Explorer viewer, we would get call setSelectionProvider(SystemViewPlugin.getSystemView());
- * <li>Support for actions that are only to be enabled when a single item is selected. To enable this
- * and save from testing for it yourself, simply call the method allowOnMultipleSelection(false).
- * The default is true, multiple selections are allowed.
- * <li>Support for disabling actions when the corresponding SystemConnection for the selected object
- * is offline. The SystemConnection can be automatically determined for some of the common
- * objects (subsystems, IRemoteFiles), for others you must set the SystemConnection for
- * this offline support.</li>
- * </ul>
- * There are many constructors but they can be broken down into permutations of the following info:
- * <ul>
- * <li>Label, tooltip and description. These can be supplied as strings, or via resource bundle and key.
- * This requires four flavors of constructor to except varying of these four pieces of information.
- * <li>Images. There are four flavors of constructors that take an image, and four identical that do not.
- * </ul>
- *
- * <p>To use this dialog, subclass it and <b>override</b> the following methods</p>:
- * <sl>
- * <li>{@link #run()}, where you place the code to do the actual work when this action is invoked.
- * <li>{@link #updateSelection(IStructuredSelection)}, for selection sensitive actions. This is your first
- * opporunity to enable/disable the action when the selection changes, by looking at the given selection
- * and returning true or false. The default implementation calls checkObjectType for each selected object.
- * <li>{@link #checkObjectType(Object)}, for selection sensitive actions. This is your second
- * opporunity to enable/disable the action when the selection changes, by looking at each individual
- * selected object, and returning true or false.
- * </sl>
- * <p>In addition to the methods you must override, you can optionally call various methods to configure
- * this action:</p>
- * <sl>
- * <li>{@link #setInputs(Shell, Viewer,ISelection)} or {@link #setShell(Shell)} and {@link #setViewer(Viewer)} and
- * {@link #setSelection(ISelection)}. These methods are called by the RSE viewers for context menu actions, and
- * can be called directly for actions used in other contexts.
- * <li>{@link #setSelectionProvider(ISelectionProvider)}, for those cases when your action monitors for selection
- * changes (pull) versus being told about them (push) via setSelection. This is less efficient, and should only
- * be used for selection-dependent actions in toolbars and pull-down menus, versus popup menus.
- * <li>{@link #setHelp(String)} to set the ID of the F1 context help for this action.
- * <li>{@link #setContextMenuGroup(String)} to set the menu group in which to place this action, when used in menus.
- * <li>{@link #allowOnMultipleSelection(boolean)} to specify if this action is to be enabled or disabled when multiple
- * objects are selected. The default is disabled.
- * <li>{@link #setSelectionSensitive(boolean)} to specify if this action's enabled state is not sensitive to what
- * is currently selected.
- * </sl>
- * <p>Further, the code you write can use the properties captured by this action and retrievable by the getter methods
- * supplied by this class.</p>
- *
- * @see ISystemAction
- * @see SystemBaseDialogAction
- * @see SystemBaseWizardAction
- */
-public class SystemBaseAction extends Action implements ISystemAction
-{
- protected Shell shell;
- protected boolean allowOnMultipleSelection = false;
- protected IStructuredSelection sSelection = null;
- private Iterator selectionIterator = null;
- private String contextMenuGroup = null;
- protected boolean selectionSensitive = true;
- protected boolean traceSelections = false;
- protected String traceTarget;
- protected Viewer viewer = null;
- protected String helpId;
- protected Cursor waitCursor;
- protected Cursor arrowCursor;
- private ISelectionProvider fSelectionProvider;
- private Vector previousShells = new Vector();
- private Vector previousViewers = new Vector();
- //private Vector previousSelections = new Vector(); hmm, a problem here: can't just test for disposed.
- // todo: remember previous selections stack, and add a restoreSelection() method that the SystemView
- // will call after the context menu is disposed
-
- // yantzi: artemis 6.0: offline support
- private boolean isAvailableOffline;
- private IHost conn;
-
- /**
- * Constructor for SystemBaseAction when translated label is known. You must separately
- * call setToolTipText and setDescription to enable these if desired.
- * @param text string to display in menu or toolbar
- * @param image icon to display in menu or toolbar. Can be null.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- public SystemBaseAction(String text, ImageDescriptor image, Shell shell)
- {
- this(text, null, null, image, shell);
- }
- /**
- * Constructor for SystemBaseAction when translated label and tooltip are known. You must
- * separately call setDescription to enable this if desired.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param image icon to display in menu or toolbar. Can be null.
- * @param parent Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- public SystemBaseAction(String text, String tooltip, ImageDescriptor image, Shell parent)
- {
- this(text, tooltip, null, image, parent);
- }
- /**
- * Constructor for SystemBaseAction when translated label and tooltip and description are
- * all known.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param description string displayed in status bar of some displays. Longer than tooltip.
- * @param image icon to display in menu or toolbar. Can be null.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- public SystemBaseAction(String text, String tooltip, String description, ImageDescriptor image, Shell shell)
- {
- super(text, image);
- this.shell = shell;
- if (tooltip != null)
- setToolTipText(tooltip);
- if (description != null)
- setDescription(description);
- //setTracing("SystemFilterPoolReferenceSelectAction");
- }
-
- /**
- * Constructor for SystemBaseAction when translated label and tooltip and description are
- * all known.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param description string displayed in status bar of some displays. Longer than tooltip.
- * @param image icon to display in menu or toolbar. Can be null.
- * @param style one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
- * <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>, and <code>AS_UNSPECIFIED</code>.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- public SystemBaseAction(String text, String tooltip, String description, ImageDescriptor image, int style, Shell shell)
- {
- super(text, style);
- this.shell = shell;
- if (image != null)
- setImageDescriptor(image);
- if (tooltip != null)
- setToolTipText(tooltip);
- if (description != null)
- setDescription(description);
- //setTracing("SystemFilterPoolReferenceSelectAction");
- }
-
-
- /**
- * Used for actions with no image icon.
- * Constructor for SystemBaseAction when translated label is known. You must separately
- * call setToolTipText and setDescription to enable these if desired.
- * @param text string to display in menu or toolbar
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- public SystemBaseAction(String text, Shell shell)
- {
- this(text, null, null, null, shell);
- }
- /**
- * Used for actions with no image icon.
- * Constructor for SystemBaseAction when translated label and tooltip are known. You must
- * separately call setDescription to enable this if desired.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- public SystemBaseAction(String text, String tooltip, Shell shell)
- {
- this(text, tooltip, null, null, shell);
- }
- /**
- * Used for actions with no image icon.
- * Constructor for SystemBaseAction when translated label and tooltip and description are
- * all known.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param description string displayed in status bar of some displays. Longer than tooltip.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- public SystemBaseAction(String text, String tooltip, String description, Shell shell)
- {
- this(text, tooltip, description, null, shell);
- }
-
-
- // ------------------------
- // HELPER METHODS...
- // ------------------------
-
- /**
- * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
- */
- public void setBusyCursor(boolean setBusy)
- {
- if (setBusy)
- {
- // Set the busy cursor to all shells.
- Display d = getShell().getDisplay();
- waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
- setDisplayCursor(waitCursor);
- }
- else
- {
- setDisplayCursor(null);
- if (waitCursor != null)
- waitCursor.dispose();
- waitCursor = null;
- }
- }
- /**
- * Sets the given cursor for all shells currently active
- * for this window's display.
- *
- * @param c the cursor
- */
- protected void setDisplayCursor(Cursor c)
- {
- setDisplayCursor(getShell(), c);
- }
- /**
- * Sets the given cursor for all shells currently active for the given shell's display.
- *
- * @param c the cursor
- */
- public static void setDisplayCursor(Shell shell, Cursor c)
- {
- if (c == null)
- {
- // attempt to fix problem that the busy cursor sometimes stays. Phil
- shell.forceActive();
- shell.forceFocus();
- }
- Shell[] shells = shell.getDisplay().getShells();
- for (int i = 0; i < shells.length; i++)
- {
- shells[i].setCursor(c);
- }
- }
- /**
- * Turn on tracing for selections, shell and viewer to watch as it is set
- */
- protected void setTracing(boolean tracing)
- {
- traceSelections = tracing;
- }
- /**
- * Turn on tracing for selections, shell and viewer to watch as it is set,
- * scoped to a particular class name (will use indexOf('xxx') to match).
- */
- protected void setTracing(String tracingClassTarget)
- {
- traceSelections = true;
- traceTarget = tracingClassTarget;
- }
- /**
- * Issue trace message
- */
- protected void issueTraceMessage(String msg)
- {
- if (traceSelections)
- {
- String className = this.getClass().getName();
- if ((traceTarget==null) || (className.indexOf(traceTarget)>=0))
- SystemBasePlugin.logInfo(this.getClass().getName()+": "+getText()+": "+msg); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
- // -----------------------------------------------------------
- // CONFIGURATION METHODS...
- // -----------------------------------------------------------
-
- /**
- * An optimization for performance reasons that allows all inputs to be set in one call
- */
- public void setInputs(Shell shell, Viewer v, ISelection selection)
- {
- if (traceSelections)
- issueTraceMessage(" INSIDE SETINPUTS IN BASE ACTION CLASS"); //$NON-NLS-1$
- setShell(shell);
- setViewer(v);
- setSelection(selection);
- }
-
- /**
- * Sets the parent shell for this action. Usually context dependent.
- */
- public void setShell(Shell shell)
- {
- // in defect 42399 it was reported the shell for persistent actions gets reset in browse
- // dialogs, on a right click, overriding the real shell with the browse dialog's shell.
- // When the browse dialog is closed, we only retain the disposed shell. To solve this
- // we have to return a stack of shells and on getShell peel back to the last non-disposed
- // one...
- this.previousShells.add(this.shell);
- this.shell = shell;
- if (traceSelections)
- issueTraceMessage(" INSIDE SETSHELL. shell = " + shell); //$NON-NLS-1$
- }
- /**
- * Set the Viewer that called this action. It is good practice for viewers to call this
- * so actions can directly access them if needed.
- */
- public void setViewer(Viewer v)
- {
- this.previousViewers.add(this.viewer); // see comment in setShell
- this.viewer = v;
- if (traceSelections)
- issueTraceMessage(" INSIDE SETVIEWER. viewer = " + viewer); //$NON-NLS-1$
- }
- /**
- * This is called when the user selects something in the tree.
- * This is your opportunity to disable the action based on the current selection.
- * The default implementation of this method:
- * <ul>
- * <li>Disables the action if the selection is not a structured selection. Should never happen.
- * <li>Disables the action if more than one item is selected and allowOnMultipleSelection is false.
- * <li>Converts the selection to a structured selection and calls updateSelection. Uses returned
- * boolean value to setEnabled() this action.
- * </ul>
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection selection = event.getSelection();
- if (traceSelections)
- issueTraceMessage("INSIDE SELECTIONCHANGED. Selection null? " + (selection==null)); //$NON-NLS-1$
- setSelection(selection);
- }
- /**
- * This is called by the UI calling the action, if that UI is not a selection provider.
- * That is, this is an alternative to calling selectionChanged when there is no SelectionChangedEvent.
- * @see #selectionChanged(SelectionChangedEvent event)
- */
- public void setSelection(ISelection selection)
- {
- if (traceSelections)
- issueTraceMessage(" INSIDE SETSELECTION. Selection null? " + (selection==null)); //$NON-NLS-1$
- if ( !(selection instanceof IStructuredSelection) )
- {
- if (selectionSensitive)
- setEnabled(false);
- if (traceSelections)
- System.out.println(this.getClass().getName() + ". Returning false in setSelection. selection= " + selection); //$NON-NLS-1$
- return;
- }
- if (selectionSensitive)
- {
- // see comment in setShell
- //this.previousSelections.add(this.sSelection);
- }
- sSelection = (IStructuredSelection)selection;
- if (!selectionSensitive)
- {
- if (traceSelections)
- System.out.println(this.getClass().getName() + ". Returning. selectionSensitive = " + selectionSensitive); //$NON-NLS-1$
- return;
- }
- boolean multiSelect = (sSelection.size() > 1);
- if (!allowOnMultipleSelection && multiSelect)
- {
- setEnabled(false);
- if (traceSelections)
- System.out.println(this.getClass().getName() + ". Returning false in setSelection. #selected = " + sSelection.size()); //$NON-NLS-1$
- }
- else
- {
- boolean enable = false;
- /*
- boolean debug = getText().equals("Copy");
- if (debug)
- enable = updateSelection(sSelection);
- else */
- enable = updateSelection(sSelection);
- setEnabled(enable);
- }
- }
- /**
- * Identify the UI object that will be used to get the selection
- * list from. <b>Only call this if your action is displayed in a toolbar
- * or non-popup menu<b>, as it will impact performance. It results in your
- * action getting called every time the user changes his selection in
- * the given provider viewer.
- */
- public void setSelectionProvider(ISelectionProvider provider)
- {
- if (fSelectionProvider != null)
- fSelectionProvider.removeSelectionChangedListener(this);
-
- fSelectionProvider = provider;
- if (traceSelections)
- issueTraceMessage(" INSIDE SETSELECTIONPROVIDER. fSelectionProvider = " + fSelectionProvider); //$NON-NLS-1$
-
-
- if (fSelectionProvider != null)
- fSelectionProvider.addSelectionChangedListener(this);
- }
-
-
- // ---------------------------------------------------------------------------
- // CONFIGURATION METHODS CHILD CLASSES OR OTHERS CALL TO CONFIGURE THIS ACTION
- // ---------------------------------------------------------------------------
- /**
- * Set the help id for the action
- */
- public void setHelp(String id)
- {
- SystemWidgetHelpers.setHelp(this, id);
- this.helpId = id;
- }
-
- /**
- * Set the context menu group this action is to go into, for popup menus. If not set,
- * someone else will make this decision.
- */
- public void setContextMenuGroup(String group)
- {
- contextMenuGroup = group;
- }
- /**
- * This method is supplied for actions that are to be enable even when more than
- * one item is selected. The default is to only enable on single selections.
- */
- public void allowOnMultipleSelection(boolean allow)
- {
- allowOnMultipleSelection = allow;
- }
- /**
- * Specify whether this action is selection-sensitive. The default is true.
- * This means the enabled state is tested and set when the selection is set.
- */
- public void setSelectionSensitive(boolean sensitive)
- {
- selectionSensitive = sensitive;
- }
-
- // ---------------------------------------------------------------------------
- // METHODS THAT CAN OR SHOULD BE OVERRIDDEN BY CHILD CLASSES...
- // ---------------------------------------------------------------------------
-
- /**
- * First opportunity to decide if the action should be enabled or not based on the
- * current selection. Called by default implementation of selectionChanged, which
- * converts the ISelection to an IStructuredSelection, which is all we support. The
- * return result is used to enable or disable this action.
- * <p>
- * The default implementation of this method:
- * <ul>
- * <li>Returns false if calling checkObjectType on any object in the selection list returns false.
- * <li>Returns true otherwise.
- * </ul>
- * If desired, override this method for a different algorithm to decide enablement.
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- Iterator e= selection.iterator();
- while (enable && e.hasNext())
- {
- enable = checkObjectType(e.next());
- }
- return enable;
- }
-
- /**
- * Second and easiest opportunity to decide if the action should be enabled or not based
- * on the current selection. Called by default implementation of updateSelection, once for
- * each item in the selection. If any call to this returns false, the action is disabled.
- * The default implementation returns true.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- return true;
- }
-
-
- /**
- * This is the method called when the user selects this action.
- * Child classes need to override this. If you need the parent shell,
- * call getShell. If you need to know the current selection, call
- * getSelection(), or getFirstSelection() followed by getNextSelection()
- * until null is returned.
- * @see Action#run()
- */
- public void run()
- {
-
- }
-
-
- // -----------------------------------------------------------
- // GETTER METHODS RETURNING INFORMATION CAPTURED IN BASE CLASS
- // -----------------------------------------------------------
- /**
- * Return if true if this is a dummy action
- */
- public boolean isDummy()
- {
- String label = getText();
- if (label == null)
- return false;
- return label.equals("dummy"); //$NON-NLS-1$
- }
-
- /**
- * Retrieve the help id for this action
- */
- public String getHelpContextId()
- {
- return helpId;
- }
-
- /**
- * Retrieves the parent shell for this action. Will be null if setShell has not been called.
- */
- public Shell getShell()
- {
- return internalGetShell(true);
- }
- /**
- * Retrieves the parent shell for this action. Will be null if setShell has not been called.
- * Method for subclasses that want to call this and not do the test for null.
- */
- protected Shell getShell(boolean doTest)
- {
- return internalGetShell(doTest);
- }
- /**
- * Abstraction
- */
- private Shell internalGetShell(boolean doTest)
- {
- // in defect 42399 it was reported the shell for persistent actions gets reset in browse
- // dialogs, on a right click, overriding the real shell with the browse dialog's shell.
- // When the browse dialog is closed, we only retain the disposed shell. To solve this
- // we have to return a stack of shells and on getShell peel back to the last non-disposed
- // one...
- if ((shell!=null) && (shell.isDisposed()))
- {
- boolean found = false;
- Vector disposedShells = new Vector();
- for (int idx=previousShells.size()-1; !found && (idx>=0); idx--)
- {
- shell = (Shell)previousShells.elementAt(idx);
- if (shell.isDisposed())
- disposedShells.add(shell);
- else
- found = true;
- }
- if (!found)
- shell = null;
- for (int idx=0; idx<disposedShells.size(); idx++)
- previousShells.remove(disposedShells.elementAt(idx));
- }
- if (doTest && (shell == null))
- {
- System.out.println("Inside getShell for " + this.getClass().getName() + " and the shell is null! This needs to be investigated"); //$NON-NLS-1$ //$NON-NLS-2$
- SystemBasePlugin.logDebugMessage("SystemBaseAction", "Inside getShell for " + this.getClass().getName() + " and the shell is null! This needs to be investigated"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- return shell;
- }
- /**
- * Get the Viewer that called this action. Not guaranteed to be set,
- * depends if that viewer called setViewer or not. SystemView does.
- */
- public Viewer getViewer()
- {
- // see comment in getShell()...
- if ((viewer!=null) && (viewer.getControl().isDisposed()))
- {
- boolean found = false;
- Vector disposedViewers = new Vector();
- for (int idx=disposedViewers.size()-1; !found && (idx>=0); idx--)
- {
- viewer = (Viewer)previousViewers.elementAt(idx);
- if (viewer.getControl().isDisposed())
- disposedViewers.add(viewer);
- else
- found = true;
- }
- if (!found)
- viewer = null;
- for (int idx=0; idx<disposedViewers.size(); idx++)
- previousViewers.remove(disposedViewers.elementAt(idx));
- }
- return viewer;
- }
- /**
- * Return the current viewer as an ISystemTree if it is one, or null otherwise
- */
- protected ISystemTree getCurrentTreeView()
- {
- Viewer v = getViewer();
- if (v instanceof ISystemTree)
- return (ISystemTree)v;
- else
- return null;
- }
-
- /**
- * Get the context menu group this action is to go into, for popup menus. By default is
- * null, meaning there is no recommendation
- */
- public String getContextMenuGroup()
- {
- return contextMenuGroup;
- }
-
- /**
- * Return whether this action is selection-sensitive. The default is true.
- * This means the enabled state is tested and set when the selection is set.
- */
- public boolean isSelectionSensitive()
- {
- return selectionSensitive;
- }
-
- /**
- * Return value of last call to getSelectionProvider.
- */
- public ISelectionProvider getSelectionProvider()
- {
- return fSelectionProvider;
- }
-
- /**
- * Return current selection, as per last call to selectionChanged.
- */
- public IStructuredSelection getSelection()
- {
- if (traceSelections)
- issueTraceMessage(" INSIDE GETSELECTION. sSelection null? " + (sSelection==null)); //$NON-NLS-1$
- return sSelection;
- }
-
- /**
- * Return first item currently selected, as per last call to selectionChanged.
- * This is handy for actions where allowOnMultipleSelection is false.
- * This method also starts a new iterator, and after you can call getNextSelection()
- * until it returns null. This is handy for actions where allowOnMultipleSelection is true.
- * @see #getNextSelection()
- */
- protected Object getFirstSelection()
- {
- if (sSelection != null)
- {
- selectionIterator = sSelection.iterator();
- if (selectionIterator.hasNext())
- return selectionIterator.next();
- else
- return null;
- }
- else
- selectionIterator = null;
- return null;
- }
- /**
- * Return next item currently selection, as per last call to selectionChanged.
- * YOU MUST HAVE CALLED GETFIRSTSELECTION() PRIOR TO CALLING THIS.
- * Your code can loop until this returns null.
- * @see #getFirstSelection()
- */
- protected Object getNextSelection()
- {
- if ((sSelection != null) && (selectionIterator != null))
- {
- if (selectionIterator.hasNext())
- return selectionIterator.next();
- else
- return null;
- }
- else
- selectionIterator = null;
- return null;
- }
-
- /**
- * Disables this action if offline mode, otherwise delegates to the super class.
- *
- * @see org.eclipse.jface.action.IAction#isEnabled()
- */
- public boolean isEnabled()
- {
- if (!isAvailableOffline)
- {
- if (conn != null && conn.isOffline())
- {
- return false;
- }
- else
- {
- Object selection = getFirstSelection();
- while (selection != null)
- {
- if (selection instanceof ISubSystem && ((ISubSystem)selection).isOffline())
- {
- return false;
- }
-
- // yantzi: this disables all actions on SystemConnection
- //else if (selection instanceof SystemConnection)
- //{
- // connection = (SystemConnection)selection;
- // if (connection.isOffline())
- // return false;
- //}
-
- selection = getNextSelection();
- }
- }
-
- }
-
- return super.isEnabled();
- }
-
- /**
- * If this is one of those rare actions that is to be made available in offline mode, then call this
- * during or immediately after constructing to state that. The default is false.
- */
- public void setAvailableOffline(boolean availableOffline)
- {
- this.isAvailableOffline = availableOffline;
- }
-
- /**
- * Set the SystemConnection used by this action for disabling the action
- * in offline mode, or for whatever reason subclasses may need it.
- */
- public void setHost(IHost connection)
- {
- conn = connection;
- }
-
- /**
- * Return the system connection which is the parent of whatever is currently selected.
- */
- public IHost getSystemConnection()
- {
- return conn;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseCopyAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseCopyAction.java
deleted file mode 100644
index 59463ba4b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseCopyAction.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- *******************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.core.model.SystemProfileManager;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.dialogs.SystemSimpleCopyDialog;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * An abstract base class for all copy actions. Defers minimal requirements to
- * child classes.
- */
-public abstract class SystemBaseCopyAction extends SystemBaseDialogAction
- implements IRunnableWithProgress, ISystemCopyTargetSelectionCallback
-{
- protected ISystemProfileManager mgr;
- protected ISystemRegistry sr;
- protected String[] oldNames;
- protected String[] newNames;
- protected Object[] oldObjects;
- protected Object targetContainer;
- protected boolean copiedOk = true;
- //private boolean makeActive;
- protected Exception runException = null;
- protected int mode = SystemSimpleCopyDialog.MODE_COPY;
- protected int runCount = 0;
- public static final int MODE_COPY = SystemSimpleCopyDialog.MODE_COPY;
- public static final int MODE_MOVE = SystemSimpleCopyDialog.MODE_MOVE;
-
-
- /**
- * Constructor when using default action ID
- * @param parent Owning shell
- * @param mode Either MODE_COPY or MODE_MOVE from this class
- */
- public SystemBaseCopyAction(Shell parent, int mode)
- {
- this(parent, mode==MODE_COPY ? SystemResources.ACTION_COPY_LABEL : SystemResources.ACTION_MOVE_LABEL, mode);
- setToolTipText(mode==MODE_COPY ? SystemResources.ACTION_COPY_TOOLTIP : SystemResources.ACTION_MOVE_TOOLTIP);
- }
-
- /**
- * Constructor
- * @param parent Owning shell
- * @param label
- * @param mode Either MODE_COPY or MODE_MOVE from this class
- */
- public SystemBaseCopyAction(Shell parent, String label, int mode)
- {
- super(label,
- (mode==MODE_COPY ?
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY)
- //RSEUIPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_COPY_ID)
- : RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_MOVE_ID)),
- parent);
- this.mode = mode;
- mgr = SystemProfileManager.getDefault();
- sr = RSECorePlugin.getTheSystemRegistry();
- allowOnMultipleSelection(true);
- setProcessAllSelections(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- }
-
- /**
- * Reset. This is a re-run of this action
- */
- protected void reset()
- {
- oldNames = null;
- newNames = null;
- oldObjects = null;
- targetContainer = null;
- copiedOk = true;
- runException = null;
- //System.out.println("inside base reset()");
- }
-
- /**
- * Override of parent.
- * Return the dialog that will be used to prompt for the copy/move target location
- * @see #run()
- */
- protected Dialog createDialog(Shell parent)
- {
- ++runCount;
- if (runCount > 1)
- reset();
- SystemSimpleCopyDialog copyDlg = new SystemSimpleCopyDialog(parent, getPromptString(), mode, this, getTreeModel(), getTreeInitialSelection());
-
- // our title now reflects multiple selection. If single change it.
- IStructuredSelection sel = getSelection();
- //System.out.println("size = "+sel.size());
- if (sel.size() == 1)
- {
- String singleTitle = null;
- if (mode == MODE_COPY)
- singleTitle = SystemResources.RESID_COPY_SINGLE_TITLE;
- else
- singleTitle = SystemResources.RESID_MOVE_SINGLE_TITLE;
- //System.out.println("..."+singleTitle);
- if (!singleTitle.startsWith("Missing")) // TODO: remove test after next mri rev //$NON-NLS-1$
- copyDlg.setTitle(singleTitle);
- }
-
- return copyDlg;
- }
-
- protected abstract String[] getOldNames();
- protected abstract Object[] getOldObjects();
- /**
- * Get the verbiage prompt to show on line one of the copy dialog
- */
- protected String getPromptString()
- {
- if (mode == MODE_COPY)
- return SystemResources.RESID_COPY_PROMPT;
- else
- return SystemResources.RESID_MOVE_PROMPT;
- }
-
- protected abstract SystemSimpleContentElement getTreeModel();
- protected abstract SystemSimpleContentElement getTreeInitialSelection();
-
- /**
- * This method is a callback from the select-target-parent dialog, allowing us to decide whether the current selected
- * object is a valid parent object. This affects the enabling of the OK button on that dialog.
- * <p>
- * The default is to return true if the selected element has no children. This is sufficient for most cases. However,
- * in some cases it is not, such as for filter strings where we want to only enable OK if a filter is selected. It is
- * possible that filter pools have no filters, so the default algorithm is not sufficient. In these cases the child class
- * can override this method.
- */
- public boolean isValidTargetParent(SystemSimpleContentElement selectedElement)
- {
- return !selectedElement.hasChildren();
- }
-
-
- /**
- * Required by parent. We use it to actually do the work.
- */
- protected Object getDialogValue(Dialog dlg)
- {
- targetContainer = getTargetContainer(dlg);
- if (targetContainer != null)
- {
- boolean okToProceed = preCheckForCollision();
- if (!okToProceed)
- return null;
- IRunnableContext runnableContext = getRunnableContext();
- try
- {
- runnableContext.run(false,false,this); // inthread, cancellable, IRunnableWithProgress
- if (copiedOk)
- {
- SystemMessage completeMsg = getCompletionMessage(targetContainer, oldNames, newNames);
- if (completeMsg != null)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(),completeMsg);
- msgDlg.open();
- }
- }
- }
- catch (java.lang.reflect.InvocationTargetException exc) // unexpected error
- {
- showOperationMessage((Exception)exc.getTargetException(), getShell());
- //throw (Exception) exc.getTargetException();
- }
- catch (Exception exc)
- {
- showOperationMessage(exc, getShell());
- //throw exc;
- }
- }
- return null;
- }
- /**
- * Get an IRunnable context to show progress in. If there is currently a dialog or wizard up with
- * a progress monitor in it, we will use this, else we will create a progress monitor dialog.
- */
- protected IRunnableContext getRunnableContext()
- {
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc == null)
- irc = new ProgressMonitorDialog(getShell());
- return irc;
- }
- /**
- * Override this method if you supply your own copy/move target dialog.
- * Return the user-selected target or null if cancelled
- */
- protected Object getTargetContainer(Dialog dlg)
- {
- SystemSimpleCopyDialog cpyDlg = (SystemSimpleCopyDialog)dlg;
- Object targetContainer = null;
- if (!cpyDlg.wasCancelled())
- targetContainer = cpyDlg.getTargetContainer();
- return targetContainer;
- }
-
- /**
- * Do a pre-check for a collision situation.
- * This really is only a problem for filter strings, when a name collision is fatal verus
- * recoverable via a new-name prompt.
- */
- protected boolean preCheckForCollision()
- {
- boolean ok = true;
- oldNames = getOldNames();
- oldObjects = getOldObjects();
- int steps = oldObjects.length;
-
- String oldName = null;
- Object oldObject = null;
- for (int idx=0; ok && (idx<steps); idx++)
- {
- oldName = oldNames[idx];
- oldObject = oldObjects[idx];
- ok = preCheckForCollision(getShell(), targetContainer, oldObject, oldName);
- }
- return ok;
- }
- /**
- * Overridable entry point when you want to prevent any copies/moves if any of the
- * selected objects have a name collision.
- * <p>
- * If you decide to override this, it is your responsibility to issue the error
- * message to the user and return false here.
- * <p>
- * @return true if there is no problem, false if there is a fatal collision
- */
- protected boolean preCheckForCollision(Shell shell, Object targetContainer,
- Object oldObject, String oldName)
- {
- return true;
- }
-
- /**
- * Called after all the copy/move operations end, be it successfully or not.
- * Your opportunity to display completion or do post-copy selections/refreshes
- * @since 3.0 taking String argument
- */
- public void copyComplete(String operation) {}
-
- // ----------------------------------
- // INTERNAL METHODS...
- // ----------------------------------
- /**
- * Method required by IRunnableWithProgress interface.
- * Allows execution of a long-running operation modally by via a thread.
- * In our case, it runs the copy operation with a visible progress monitor
- */
- public void run(IProgressMonitor monitor)
- throws java.lang.reflect.InvocationTargetException,
- java.lang.InterruptedException
- {
- SystemMessage msg = getCopyingMessage();
- runException = null;
-
- try
- {
- //oldNames = getOldNames();
- //oldObjects = getOldObjects();
- int steps = oldObjects.length;
- monitor.beginTask(msg.getLevelOneText(), steps);
- copiedOk = true;
- String oldName = null;
- String newName = null;
- Object oldObject = null;
- newNames = new String[oldNames.length];
- for (int idx=0; copiedOk && (idx<steps); idx++)
- {
- oldName = oldNames[idx];
- oldObject = oldObjects[idx];
- monitor.subTask(getCopyingMessage(oldName).getLevelOneText());
- newName = checkForCollision(getShell(), monitor, targetContainer, oldObject, oldName);
- if (newName == null)
- copiedOk = false;
- else
- copiedOk = doCopy(targetContainer, oldObject, newName, monitor);
- newNames[idx] = newName;
- monitor.worked(1);
- }
- monitor.done();
- }
- catch(java.lang.InterruptedException exc)
- {
- monitor.done();
- runException = exc;
- throw (java.lang.InterruptedException)runException;
- }
- catch(Exception exc)
- {
- monitor.done();
- runException = new java.lang.reflect.InvocationTargetException(exc);
- throw (java.lang.reflect.InvocationTargetException)runException;
- }
- if (copiedOk)
- copyComplete(null);
- }
-
- protected abstract String checkForCollision(Shell shell, IProgressMonitor monitor, Object targetContainer, Object oldObject, String oldName);
- /**
- * Get the generic "Copying..." or "Moving..." message
- */
- protected SystemMessage getCopyingMessage()
- {
- if (mode == MODE_COPY)
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYGENERIC_PROGRESS);
- else
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVEGENERIC_PROGRESS);
- }
- /**
- * Get the specific "Copying %1..." or "Moving %1..." message
- */
- protected SystemMessage getCopyingMessage(String oldName)
- {
- SystemMessage msg = null;
- if (mode == MODE_COPY)
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COPYTHINGGENERIC_PROGRESS);
- else
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_MOVETHINGGENERIC_PROGRESS);
- msg.makeSubstitution(oldName);
- return msg;
- }
-
- /**
- * DO THE ACTUAL COPY OR MOVE. THIS MUST BE IMPLEMENTED BY CHILD CLASSES
- */
- protected abstract boolean doCopy(Object targetContainer, Object oldObject, String newName, IProgressMonitor monitor)
- throws Exception;
-
- /**
- * Return complete message.
- * Override if you want to popup a completion message after a successful copy/move
- */
- public SystemMessage getCompletionMessage(Object targetContainer, String[] oldNames, String[] newNames)
- {
- return null;
- }
-
- /**
- * Helper method to show an error message resulting from the attempted operation.
- */
- protected void showOperationMessage(Exception exc, Shell shell)
- {
- if (exc instanceof java.lang.InterruptedException)
- showOperationCancelledMessage(shell);
- else if (exc instanceof java.lang.reflect.InvocationTargetException)
- showOperationErrorMessage(shell, ((java.lang.reflect.InvocationTargetException)exc).getTargetException());
- else
- showOperationErrorMessage(shell, exc);
- }
-
- /**
- * Show an error message when the operation fails.
- * Shows a common message by default.
- * Overridable.
- */
- protected void showOperationErrorMessage(Shell shell, Throwable exc)
- {
- if (exc instanceof SystemMessageException)
- showOperationErrorMessage(shell, (SystemMessageException)exc);
- else
- {
- String msg = exc.getMessage();
- if ((msg == null) || (exc instanceof ClassCastException))
- msg = exc.getClass().getName();
- SystemMessageDialog msgDlg =
- new SystemMessageDialog(shell,
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED).makeSubstitution(msg));
- msgDlg.setException(exc);
- msgDlg.open();
- //RSEUIPlugin.logError("Copy/Move operation failed",exc);
- }
- }
- /**
- * Show an error message when the operation fails.
- * Shows a SystemMessage that was encapsulated in a SystemMessage exception
- * Overridable.
- */
- protected void showOperationErrorMessage(Shell shell, SystemMessageException exc)
- {
- SystemMessage msg = exc.getSystemMessage();
- SystemMessageDialog msgDlg =
- new SystemMessageDialog(shell, msg);
- msgDlg.open();
- //RSEUIPlugin.logError("Copy/Move operation failed",exc);
- }
-
- /**
- * Show an error message when the user cancels the operation.
- * Shows a common message by default.
- * Overridable.
- */
- protected void showOperationCancelledMessage(Shell shell)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_CANCELLED));
- msgDlg.open();
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDialogAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDialogAction.java
deleted file mode 100644
index 22ada1dc6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDialogAction.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.dialogs.ISystemPromptDialog;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A specialization for Action for actions that put up dialogs.
- * These actions have some common requirements:
- * <sl>
- * <li>They need to take the parent Shell object in the constructor or later perhaps via setParent
- * <li>They need to be able to set the input value for the dialog. This is typically related to
- * what is currently selected.
- * <li>They need to be able to get the output value from the dialog. This can be queried by
- * calling getValue after the action runs.
- * </sl>
- * <p>This subclass of SystemBaseAction implements the run() method in a way optimized for the processing
- * of dialogs: it calls an abstract method to create the dialog, then sets the input from the action's
- * value (if set) or selection (otherwise) and opens the dialog. After, it calls an abstract method to
- * extract the dialog's output object which is used to set this action's value, for the benefit of the
- * caller.
- * </p>
- * <p>To use this dialog, subclass it and <b>override</b> the following methods</p>:
- * <sl>
- * <li>{@link #createDialog(Shell)}
- * <li>{@link #getDialogValue(Dialog)}
- * <li>{@link #run()} but ONLY if you don't want the default implementation of this method.
- * </sl>
- * <p>In addition to the methods you must override, you can optionally call various methods to configure
- * this action. In addition to those in the parent class, this class offers these configuration methods:</p>
- * <sl>
- * <li>{@link #setDialogHelp(String)} to set the context help ID for the dialog, for cases where the dialog is generic
- * and its help depends on context and hence cannot be hardcoded in the dialog class.
- * <li>{@link #setValue(Object)} to the set the input object to pass to the dialog, for cases where the current selection
- * is not what you want to pass to the dialog.
- * <li>{@link #setNeedsProgressMonitor(boolean)} to specify if the dialog is to display a progress monitor or not, for cases
- * where this decision depends on context and hence cannot be hardcoded in the dialog class.
- * <li>{@link #setProcessAllSelections(boolean)} to specify the behaviour when there are multiple objects selected. By
- * default, the dialog will be created and processed once for each selected object, but you can specify that you instead
- * want to only invoke the dialog once and pass in all selected objects as a single ISelection object.
- * </sl>
- *
- */
-public abstract class SystemBaseDialogAction extends SystemBaseAction
- implements ISystemDialogAction
-{
- protected Object value;
- protected boolean processAll;
- protected boolean needsProgressMonitor, needsProgressMonitorSet;
- protected boolean cancelled;
- protected String dlgHelpId;
-
- /**
- * Constructor for SystemBaseDialogAction when translated label is known. You must separately
- * call setToolTipText and setDescription to enable these if desired.
- * @param text string to display in menu or toolbar
- * @param image icon to display in menu or toolbar. Can be null.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- protected SystemBaseDialogAction(String text, ImageDescriptor image, Shell shell)
- {
- super(text, image, shell);
- }
- /**
- * Constructor for SystemBaseDialogAction when translated label and tooltip are known. You must
- * separately call setDescription to enable this if desired.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param image icon to display in menu or toolbar. Can be null.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- protected SystemBaseDialogAction(String text, String tooltip, ImageDescriptor image, Shell shell)
- {
- super(text, tooltip, image, shell);
- }
-
-
- /**
- * Constructor for SystemBaseDialogAction when translated label and tooltip and description are
- * all known.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param description string displayed in status bar of some displays. Longer than tooltip.
- * @param image icon to display in menu or toolbar. Can be null.
- * @param shell Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- protected SystemBaseDialogAction(String text, String tooltip, String description, ImageDescriptor image, Shell shell)
- {
- super(text, tooltip, description, image, shell);
- }
-
-
-
-
- // ------------------------
- // HELPER/GETTER METHODS...
- // ------------------------
- /**
- * Return the help Id destined for the dialog this action brings up
- */
- public String getDialogHelpContextId()
- {
- return dlgHelpId;
- }
- /**
- * Get the value, typically set in actionPerformed
- * after putting up the dialog, and holds the output
- * from the dialog.
- */
- public Object getValue()
- {
- return value;
- }
- /**
- * Return true if the action's dialog/wizard is to include a progress monitor
- */
- public boolean getNeedsProgressMonitor()
- {
- return needsProgressMonitor;
- }
- /**
- * Return true if the caller explicitly called setNeedsProgressMonitor
- */
- protected boolean wasNeedsProgressMonitorSet()
- {
- return needsProgressMonitorSet;
- }
- /**
- * Return setting of setProcessAllSelections.
- * @see #setProcessAllSelections(boolean)
- */
- protected boolean getProcessAllSelections()
- {
- return this.processAll;
- }
- /**
- * Returns true if the user cancelled the dialog.
- * The default way to guess at this is to test if the output from
- * getDialogValue was null or not. Override if you need to refine this.
- */
- public boolean wasCancelled()
- {
- if (cancelled) // most accurate
- return true;
- else
- return (value == null);
- }
-
- // -----------------------------------------------------------
- // CONFIGURATION METHODS...
- // -----------------------------------------------------------
-
- /**
- * When using generic dialogs, it is nice to offer non-generic help.
- * If desired, set the help context ID here, and it will be passed on
- * to the generic dialog after instantiation of it.
- */
- public void setDialogHelp(String id)
- {
- this.dlgHelpId = id;
- }
- /**
- * Set the value used as input to the dialog
- */
- public void setValue(Object value)
- {
- this.value = value;
- }
- /**
- * If desired, specify if you want to include a progress monitor in your
- * dialog or wizard. If the dialog is a SystemPromptDialog or the Wizard
- * is a SystemWizardDialog, it will be passed on after instantiating the
- * dialog or wizard.
- */
- public void setNeedsProgressMonitor(boolean needs)
- {
- this.needsProgressMonitor = needs;
- this.needsProgressMonitorSet = true;
- }
- /**
- * If this action supports being enabled for multiple selections (the default,
- * but changable by calling allowOnMultipleSelections(false)), then by default
- * the default run() implementation will create and invoke the dialog once for each
- * item selected. Call this with true to change that behaviour so that the dialog
- * is only created and processed once.
- * <p>
- * Use this when the dialog itself will process all selected items at once.
- * <p>
- * The default is false.
- */
- public void setProcessAllSelections(boolean all)
- {
- this.processAll = all;
- }
-
- // -----------------------------------------------------------
- // OVERRIDABLE METHODS...
- // -----------------------------------------------------------
-
- /**
- * This is the method called by the system when the user
- * selects this action. This is a default implementation
- * which:
- * <ul>
- * <li>calls abstract method createDialog() to get the dialog
- * object. Child classes must implement this method.
- * <li>if the returned dialog implements ISystemPromptDialog, then
- * it will call setInputObject passing getValue() as the paramter.
- * If getValue returns null, then instead the currently selected objects
- * are passed as the parameter. If setProcessAllSelections has been called
- * then the current ISelection is passed, else the each object in the selection
- * is passed, and the dialog is displayed once per selected object.
- * Your dialog can then cast this input as necessary to initialize its input
- * fields, say. Presumably it knows what to cast it to. Note: code that
- * creates actions does not typically call setValue unless
- * the action is used in a UI that has no concept of ISelection, such as a
- * raw swt widget. ISelection is a JFace viewer concept.
- * <li>calls dlg.open(getShell()) on the dialog to display it.
- * <li>calls setValue(getDialogValue(dlg)) so callers can get the dialog output
- * via a call to getValue() on this action object. Again, this is typically only
- * used when launching actions from non-viewers, such as launching one dialog from
- * another dialog. When launching from popup-menus of viewers, use selectionChanged
- * instead. Either way, the object set or selected is passed on to the dialog,
- * if not null, by way of a call to the dialog's setInputObject method.
- * </ul>
- * If this action is to be enabled when multiple items are selected
- * (the default) then the processing above is repeated once for every object
- * selected. If your dialog actually processes all the selected items, then
- * call setProcessAllSelections(true) to change the behaviour to only do all
- * of this once. In this case setInputObject will be called with the
- * entire IStructuredSelection object, and your dialog code can process each
- * of the objects in it.
- * <p>
- * Please note that if NO ITEMS are selected, we will still call createDialog
- * but not call setInput.
- * <p>
- * To use this default implementation you must implement
- * the createDialog method. Note we will also call
- * dlg.setBlockOnOpen(true) on the returned dialog to
- * force it to be modal.
- */
- public void run()
- {
- Shell shell = getShell();
- if (shell == null)
- SystemBasePlugin.logDebugMessage(this.getClass().getName(),"Warning: shell is null!"); //$NON-NLS-1$
- Object currentSelection = null;
- if (!getProcessAllSelections())
- currentSelection = getFirstSelection();
- else
- currentSelection = getSelection();
- boolean cancelled = false;
-
- do
- {
- Dialog dlg = createDialog(getShell());
- if (dlg == null)
- return;
- dlg.setBlockOnOpen(true);
- Object dialogInputValue = currentSelection;
- if (getValue() != null)
- dialogInputValue = getValue();
- if ((dialogInputValue != null) && (dlg instanceof ISystemPromptDialog))
- {
- ((ISystemPromptDialog)dlg).setInputObject(dialogInputValue);
- }
- if (dlgHelpId!=null)
- {
- if (dlg instanceof SystemPromptDialog)
- ((SystemPromptDialog)dlg).setHelp(dlgHelpId);
- else if (dlg instanceof SystemWizardDialog)
- ((SystemWizardDialog)dlg).setHelp(dlgHelpId);
- }
- if (dlg instanceof SystemPromptDialog)
- {
- if (needsProgressMonitorSet)
- ((SystemPromptDialog)dlg).setNeedsProgressMonitor(needsProgressMonitor);
- }
-
- dlg.open();
-
- // if (rc != 0) NOT RELIABLE!
- if (dlg instanceof SystemWizardDialog)
- {
- if (((SystemWizardDialog)dlg).wasCancelled())
- cancelled = true;
- //System.out.println("Testing cancelled state of SystemWizardDialog: " + cancelled);
- }
- else if (dlg instanceof SystemPromptDialog)
- {
- if (((SystemPromptDialog)dlg).wasCancelled())
- cancelled = true;
- //System.out.println("Testing cancelled state of SystemPromptDialog: " + cancelled);
- }
-
- if (!cancelled)
- {
- setValue(getDialogValue(dlg));
-
- if ((currentSelection != null) && !getProcessAllSelections())
- currentSelection = getNextSelection();
- else if (currentSelection != null)
- currentSelection = null;
- }
- else
- setValue(null);
- } while (!cancelled && (currentSelection != null));
- }
-
- // -----------------------------------------------------------
- // ABSTRACT METHODS...
- // -----------------------------------------------------------
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to create and return
- * the dialog that is displayed by the default run method
- * implementation.
- * <p>
- * If you override actionPerformed with your own, then
- * simply implement this to return null as it won't be used.
- * @see #run()
- */
- protected abstract Dialog createDialog(Shell parent);
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to retrieve the data
- * from the dialog. For SystemPromptDialog dialogs, this is simply
- * a matter of returning dlg.getOutputObject();
- * <p>
- * This is called by the run method after the dialog returns, and
- * wasCancelled() is false. Callers of this object can subsequently
- * retrieve this returned value by calling getValue. If you don't need
- * to pass a value back to the caller of this action, simply return null
- * from this method.
- *
- * @param dlg The dialog object, after it has returned from open.
- */
- protected abstract Object getDialogValue(Dialog dlg);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java
deleted file mode 100644
index be36882dd..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseDummyAction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-
-/**
- * A dummy "placeholder" action for submenus that will be dynamically populated
- */
-public class SystemBaseDummyAction extends SystemBaseAction
-{
- public SystemBaseDummyAction()
- {
- super("dummy", null); //$NON-NLS-1$
- setSelectionSensitive(false);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java
deleted file mode 100644
index c12b4604a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseSubMenuAction.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManagerForTesting;
-import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Our framework is designed to allow actions to be added to popup menus.
- * Sometimes, we want an expandable or cascading menu item for an action.
- * That is what this class is designed for. It represents a populated submenu.
- */
-public abstract class SystemBaseSubMenuAction
- extends SystemBaseAction
-
-{
-
- private SystemSubMenuManager subMenu = null;
- protected String actionLabel;
- protected String menuID;
- protected boolean createMenuEachTime = true;
- protected boolean populateMenuEachTime = true;
- private boolean dontCascade = false;
- private boolean test;
- private static final IAction[] EMPTY_ACTION_ARRAY = new IAction[0];
-
- /**
- * Constructor for SystemBaseSubMenuAction when there is an image
- * @param label
- * @param tooltip
- * @param image The image to display for this action
- * @param shell the parent shell. If you pass <code>null</code> now, be sure to call {@link #setShell(Shell)} later.
- *
- * @deprecated use fields from resource class directly now instead of via ResourceBundle
- */
- protected SystemBaseSubMenuAction(ResourceBundle rb, String label, String tooltip,ImageDescriptor image,Shell shell)
- {
- super(label, tooltip, image, shell);
- actionLabel = label;
- //setTracing(true);
- }
-
-
- /**
- * Constructor for SystemBaseSubMenuAction when there is just a string
- * @param label the label to display.
- * @param shell the parent shell. If you pass <code>null</code> now, be sure to call {@link #setShell(Shell)} later.
- */
- protected SystemBaseSubMenuAction(String label, Shell shell)
- {
- super(label, shell);
- actionLabel = label;
- //setTracing(true);
- }
- /**
- * Constructor for SystemBaseSubMenuAction when there is just a string
- * @param label the label to display.
- * @param tooltip the tooltip to display.
- * @param shell the parent shell. If you pass <code>null</code> now, be sure to call {@link #setShell(Shell)} later.
- */
- protected SystemBaseSubMenuAction(String label, String tooltip, Shell shell)
- {
- super(label, tooltip, shell);
- actionLabel = label;
- //setTracing(true);
- }
- /**
- * Constructor for SystemBaseSubMenuAction when there is just a string and image
- * @param label the label to display.
- * @param image the image descriptor for the action.
- * @param shell the parent shell. If you pass <code>null</code> now, be sure to call {@link #setShell(Shell)} later.
- */
- protected SystemBaseSubMenuAction(String label, ImageDescriptor image, Shell shell)
- {
- super(label, image, shell);
- actionLabel = label;
- //setTracing(true);
- }
-
- /**
- * Constructor for SystemBaseSubMenuAction when there is just a string and image
- * @param label the label to display.
- * @param tooltip the tooltip to display.
- * @param image the image descriptor for the action.
- * @param shell the parent shell. If you pass <code>null</code> now, be sure to call {@link #setShell(Shell)} later.
- */
- protected SystemBaseSubMenuAction(String label, String tooltip, ImageDescriptor image, Shell shell)
- {
- super(label, tooltip, image, shell);
- actionLabel = label;
- //setTracing(true);
- }
-
- /**
- * Set the menu ID. This is important to allow action contributions via the popupMenus extension point.
- */
- public void setMenuID(String Id)
- {
- this.menuID = Id;
- }
-
- /**
- * Call this if the submenu should be created on-the-fly every time, versus creating and populating it
- * only on the first usage.
- */
- public void setCreateMenuEachTime(boolean eachTime)
- {
- this.createMenuEachTime = eachTime;
- }
- /**
- * Call this if the submenu should be populated on-the-fly every time, versus populating it
- * only on the first usage. This only makes sense to be true if setCreateMenuEachTime is false.
- */
- public void setPopulateMenuEachTime(boolean eachTime)
- {
- this.populateMenuEachTime = eachTime;
- }
-
- /**
- * Set test mode on
- */
- public void setTest(boolean testMode)
- {
- this.test = testMode;
- }
-
-
- /**
- * <i>Must be overridden</i>
- * <p>Example of this:<p>
- * <pre><code>
- * menu.add(new MyAction1());
- * </code></pre>
- * @param menu The cascading menu, which is created for you. Add your actions to it.
- * @return The given menu if you just populated it, or a new menu if you want to create the menu yourself.
- */
- public abstract IMenuManager populateSubMenu(IMenuManager menu);
-
- /**
- * Return the MenuManager object. It is this that is added to the primary popup menu.
- */
- public IMenuManager getSubMenu()
- {
- if ((subMenu == null) || createMenuEachTime)
- {
- if (menuID == null)
- {
- if (test)
- subMenu = new SystemSubMenuManagerForTesting(this,actionLabel);
- else
- subMenu = new SystemSubMenuManager(this,actionLabel);
- }
- else
- {
- if (test)
- subMenu = new SystemSubMenuManagerForTesting(this, actionLabel, menuID);
- else
- subMenu = new SystemSubMenuManager(this,actionLabel, menuID);
- }
- createStandardGroups(subMenu);
- subMenu.setTracing(traceSelections, traceTarget);
- populateSubMenu(subMenu);
- if (traceSelections)
- {
- issueTraceMessage("*** INSIDE GETSUBMENU for "+actionLabel+". createMenuEachTime = " + createMenuEachTime); //$NON-NLS-1$ //$NON-NLS-2$
- }
- subMenu.setToolTipText(getToolTipText());
- //cascadeAllInputs(); no point in doing in now, setInputs will be called later by SV
- subMenu.addMenuListener(createMnemonicsListener(!populateMenuEachTime));
- }
- else if (populateMenuEachTime)
- {
- subMenu.removeAll();
- createStandardGroups(subMenu);
- populateSubMenu(subMenu);
- if (traceSelections)
- {
- issueTraceMessage("*** INSIDE GETSUBMENU for "+actionLabel+". populateMenuEachTime = " + populateMenuEachTime); //$NON-NLS-1$ //$NON-NLS-2$
- }
- //cascadeAllInputs(); no point in doing in now, setInputs will be called later by SV
- //Menu m = subMenu.getMenu();
- //System.out.println("SubMenu's menu null? " + (m==null));
- //if (m != null)
- //m.addMenuListener(new SystemViewMenuListener());
- }
- else if (traceSelections)
- {
- issueTraceMessage("*** INSIDE GETSUBMENU for "+actionLabel+". SUBMENU ALREADY CREATED. "); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return subMenu;
- }
- /**
- * Creates the standard groups for the context sub-menu.
- */
- protected void createStandardGroups(IMenuManager menu)
- {
- if (!menu.isEmpty())
- return;
- // simply sets partitions in the menu, into which actions can be directed.
- // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
- // Deleted groups are not used yet.
- //... decided it is better to let this get created when needed, else will be at the top of the menu.
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
-
- }
-
- /**
- * Return the actions currently in the menu.
- * Never returns null, but may return an empty array.
- */
- public IAction[] getActions()
- {
- //System.out.println("in getActions. subMenu null? "+(subMenu==null));
- if (subMenu==null)
- return EMPTY_ACTION_ARRAY;
- else
- {
- IContributionItem[] items = subMenu.getItems();
- //System.out.println("in getActions. #items "+items.length);
- Vector v = new Vector();
- for (int idx=0; idx<items.length; idx++)
- if (items[idx] instanceof ActionContributionItem)
- v.add( ((ActionContributionItem)items[idx]).getAction() );
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager menu = (SystemSubMenuManager)items[idx];
- v.add(menu.getParentCascadingAction());
- }
- //else
- //System.out.println("...item: "+items[idx].getClass().getName());
- IAction[] actions = new IAction[v.size()];
- for (int idx=0; idx<v.size(); idx++)
- actions[idx] = (IAction)v.elementAt(idx);
- return actions;
- }
- }
-
-
-
- /**
- * Overridable method that instantiates the menu listener who job is to add
- * mnemonics.
- *
- * @param setMnemonicsOnlyOnce true if the menu is static and so mnemonics
- * need only be set once. False if it is dynamic
- * @since 3.0 replaced SystemViewMenuListener by ISystemViewMenuListener
- */
- protected ISystemViewMenuListener createMnemonicsListener(boolean setMnemonicsOnlyOnce)
- {
- return new SystemViewMenuListener(setMnemonicsOnlyOnce);
- }
-
- /**
- * Sets the parent shell for this action. This is an override of our parent's method so we can
- * cascade it to each sub-action.
- */
- public void setShell(Shell shell)
- {
- super.setShell(shell);
- if (!dontCascade)
- cascadeShell();
- }
-
- /**
- * This is called by the framework to set the selection input, just prior to showing the popup menu.
- * We cascade this down to all of the actions added to this submenu.
- */
- public void setSelection(ISelection selection)
- {
- super.setSelection(selection);
- if (!dontCascade)
- cascadeSelection(selection);
- }
-
- /**
- * This is called by the framework to set the selection input, just prior to showing the popup menu.
- * We cascade this down to all of the actions added to this submenu.
- */
- public void setViewer(Viewer v)
- {
- super.setViewer(v);
- if (!dontCascade)
- cascadeViewer();
- }
-
- /**
- * Return the shell. If not set locally, queries it from the submenu, which is where it is set by the RSE framework
- */
- public Shell getShell()
- {
- if (super.getShell(false) != null)
- return super.getShell(false);
- else if (subMenu != null)
- return subMenu.getShell();
- else
- return null;
- }
- /**
- * Return the selection. If not set locally, queries it from the submenu, which is where it is set by the RSE framework
- */
- public IStructuredSelection getSelection()
- {
- if (super.getSelection() != null)
- return super.getSelection();
- else if (subMenu != null)
- return subMenu.getSelection();
- else
- return null;
- }
- /**
- * Return the viewer. If not set locally, queries it from the submenu, which is where it is set by the RSE framework
- */
- public Viewer getViewer()
- {
- if (super.getViewer() != null)
- return super.getViewer();
- else if (subMenu != null)
- return subMenu.getViewer();
- else
- return null;
- }
-
- /**
- * Special method called by our submenu manager when from its setInputs method. No need to
- * cascade as the menu manager will do it for us.
- */
- public void setInputsFromSubMenuManager(Shell shell, Viewer v, ISelection selection)
- {
- dontCascade = true; // so we don't redundantly do cascading. Phil
- super.setInputs(shell, v, selection); // calls setSelection+Shell+Viewer
- dontCascade = false;
- }
-
- /**
- * An optimization for performance reasons that allows all inputs to be set in one call.
- * Intercept of parent so we can cascade to sub-actions. Note however this won't really ever
- * get called. This is because for cascading menu actions we don't put this action object into
- * the menumanager ... we put the SystemSubMenu object so that is what the SystemView will call.
- */
- public void setInputs(Shell shell, Viewer v, ISelection selection)
- {
- dontCascade = true; // so we don't redundantly do cascading. Phil
- super.setInputs(shell, v, selection); // calls setSelection+Shell+Viewer
- dontCascade = false;
- if (traceSelections)
- issueTraceMessage(" INSIDE SETINPUTS IN BASE ACTION CLASS"); //$NON-NLS-1$
- cascadeAllInputs();
- }
-
- /**
- * Cascade the current selection to all actions
- */
- private void cascadeSelection(ISelection selection)
- {
- if (traceSelections)
- {
- issueTraceMessage("*** INSIDE CASCADESELECTION ***"); //$NON-NLS-1$
- issueTraceMessage(" subMenu = " + subMenu); //$NON-NLS-1$
- issueTraceMessage(" selection = " + selection); //$NON-NLS-1$
- }
- if (subMenu == null)
- return;
- subMenu.setSelection(selection);
- /*
- IAction[] actions = subMenu.getActions();
- for (int idx=0; idx<actions.length; idx++)
- {
- if (actions[idx] instanceof ISystemAction)
- {
- ((ISystemAction)actions[idx]).setSelection(selection);
- }
- }
- */
- }
-
- /**
- * Cascade the current shell to all actions
- */
- private void cascadeShell()
- {
- if (subMenu == null)
- return;
- Shell shell = super.getShell(false);
- if (shell != null)
- {
- subMenu.setShell(shell);
- /*
- IAction[] items = subMenu.getActions();
- for (int idx=0; idx<items.length; idx++)
- if (items[idx] instanceof ISystemAction)
- ((ISystemAction)items[idx]).setShell(shell);
- */
- }
- }
-
- /**
- * Cascade the current viewer to all actions
- */
- private void cascadeViewer()
- {
- if (subMenu == null)
- return;
- if (viewer != null)
- {
- subMenu.setViewer(viewer);
- /*
- IAction[] items = subMenu.getActions();
- for (int idx=0; idx<items.length; idx++)
- if (items[idx] instanceof ISystemAction)
- ((ISystemAction)items[idx]).setViewer(viewer);
- */
- }
- }
-
- /**
- * Called when actions added dynamically
- */
- protected void cascadeAllInputs()
- {
- if (subMenu == null)
- return;
- Shell shell = super.getShell(false);
- Viewer viewer = super.getViewer();
- ISelection selection = super.getSelection();
- subMenu.setInputs(shell, viewer, selection);
- /*
- IAction[] actions = subMenu.getActions();
- if (traceSelections)
- {
- issueTraceMessage("INSIDE CASCADEALLINPUTS FOR "+actionLabel+". NBR ACTIONS = "+actions.length);
- }
-
- for (int idx=0; idx<actions.length; idx++)
- {
- if (actions[idx] instanceof ISystemAction)
- {
- ISystemAction action = (ISystemAction)actions[idx];
- action.setInputs(shell, viewer, selection);
- }
- }
- */
- }
-
- /**
- * Enable/disable this menu action. This amounts to enabling/disabling the associated sub menu.
- * Unfortunately, there is no way to do this!
- */
- public void setEnabled(boolean enable)
- {
- super.setEnabled(enable);
- if (subMenu!=null)
- {
- //subMenu.setEnabled(enable);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseWizardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseWizardAction.java
deleted file mode 100644
index 8382d7054..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemBaseWizardAction.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
-import org.eclipse.rse.ui.wizards.ISystemWizard;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * A specialization for the eclipse Action method, for actions that put up wizards.
- * <p> This class is most effective when used with actions that extend {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard},
- * or implement {@link org.eclipse.rse.ui.wizards.ISystemWizard}. It supports
- * settings that are propogated to the wizard, and wizard pages if they extend {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage},
- * or implement {@link org.eclipse.rse.ui.wizards.ISystemWizardPage}.
- * </p>
- * The advantages to using this class over the base action class are:
- * <ul>
- * <li>Supports setting the label, description, image and tooltip text for this action, via constructors.
- * <li>Sets {@link org.eclipse.rse.ui.actions.SystemBaseAction#allowOnMultipleSelection(boolean)} to false, since most wizard actions are not permitted on multiple selection.
- * <li>Supports setting whether the wizard requires a {@link org.eclipse.rse.ui.actions.SystemBaseDialogAction#setNeedsProgressMonitor(boolean) progress-monitor} or not, which is propogated to the wizard.
- * <li>Supports setting the overall wizard {@link #setWizardTitle(String) title}, which is propogated to the wizard.
- * <li>Supports setting the overall wizard {@link #setWizardImage(ImageDescriptor) image}, which is propogated to the wizard.
- * <li>Supports setting the default wizard {@link #setWizardPageTitle(String) page-title}, which is propogated to the wizard and the wizard pages.
- * <li>Supports setting the wizard;s default {@link #setHelp(String) contextual-help}, which is propogated to the wizard and the wizard pages.
- * <li>Supports setting the wizard's {@link #setMinimumPageSize(int,int) minimum-size}, which is propogated and applied to the wizard.
- * <li>Supports a {@link #wasCancelled()} method so the caller can easily determine if the wizard was dismissed or cancelled by the user.
- * <li>Supports propogation of the {@link org.eclipse.rse.ui.actions.SystemBaseAction#getViewer() current-viewer}.
- * </ul>
- *
- * <p>To use this class:</p>
- * <ol>
- * <li>Create your wizard class that extends {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard}, and is populated with
- * pages that extend {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage}.
- * <li>Define your action's label and tooltip translatable strings in a resource bundle, where the former's key ends with "label" and the latter's
- * key ends with "tooltip".
- * <li>Define your subclass of this wizard. Decide if you want to set the wizard's title, page-title, image, help and optionally minimum size
- * in your wizard subclass, or here in your action subclass. For re-use it is best to set it in the wizard, if possible.
- * <li>Override {@link #createWizard()} to instantiate, configure and return your wizard.
- * <li>Decide if you will do the work of the wizard in the wizard's performFinish method, or here in this action subclass. If here,
- * override {@link #postProcessWizard(IWizard)}. You might also override this if you need to set output variables in the action,
- * after the sucessful completion of the wizard.
- * </ol>
- */
-public abstract class SystemBaseWizardAction extends SystemBaseDialogAction implements ISystemWizardAction {
-
- private IWizard newWizard;
- private String wizardTitle, pageTitle;
- private ImageDescriptor wizardImage;
- private int minPageWidth = -1, minPageHeight = -1;
-
- /**
- * Constructor for SystemBaseWizardAction when translated label is known. You must separately
- * call setToolTipText and setDescription to enable these if desired.
- * @param text string to display in menu or toolbar
- * @param image icon to display in menu or toolbar. Can be null.
- * @param parent Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- protected SystemBaseWizardAction(String text, ImageDescriptor image, Shell parent) {
- super(text, image, parent);
- allowOnMultipleSelection(false);
- }
-
- /**
- * Constructor for SystemBaseWizardAction when translated label and tooltip are known. You must
- * separately call setDescription to enable this if desired.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param image icon to display in menu or toolbar. Can be null.
- * @param parent Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- protected SystemBaseWizardAction(String text, String tooltip, ImageDescriptor image, Shell parent) {
- super(text, tooltip, image, parent);
- allowOnMultipleSelection(false);
- }
-
- /**
- * Constructor for SystemBaseWizardAction when translated label and tooltip and description are
- * all known.
- * @param text string to display in menu or toolbar
- * @param tooltip string to display when user hovers mouse over action.
- * @param description string displayed in status bar of some displays. Longer than tooltip.
- * @param image icon to display in menu or toolbar. Can be null.
- * @param parent Shell of parent window. Can be null if you don't know it, but call setShell when you do.
- */
- protected SystemBaseWizardAction(String text, String tooltip, String description, ImageDescriptor image, Shell parent) {
- super(text, tooltip, description, image, parent);
- allowOnMultipleSelection(false);
- }
-
- /**
- * Set the wizard title. Using this makes it possible to avoid subclassing a wizard
- */
- public void setWizardTitle(String title) {
- this.wizardTitle = title;
- }
-
- /**
- * Set the wizard image. Using this makes it possible to avoid subclassing a wizard
- */
- public void setWizardImage(ImageDescriptor wizardImage) {
- this.wizardImage = wizardImage;
- }
-
- /**
- * Set the wizard page title. Using this makes it possible to avoid subclassing.
- * The page title goes below the wizard title, and can be unique per page. However,
- * typically the wizard page title is the same for all pages... eg "Filter".
- * <p>
- * This is not used by default, but can be queried via getPageTitle() when constructing
- * pages.
- */
- public void setWizardPageTitle(String pageTitle) {
- this.pageTitle = pageTitle;
- }
-
- /**
- * Return the page title as set via setWizardPageTitle
- */
- public String getWizardPageTitle() {
- return pageTitle;
- }
-
- /**
- * Call this method to set the wizard's dimensions without having to subclass the wizard.
- * If you pass zero for either value, then the default will be used for that.
- */
- public void setMinimumPageSize(int width, int height) {
- //if (width <= 0)
- // width = 300; // found this number in WizardDialog code
- //if (height<= 0)
- // height = 225; // found this number in WizardDialog code
- this.minPageWidth = width;
- this.minPageHeight = height;
- }
-
- /**
- * Override of parent's method. Does the following:
- * <ul>
- * <li>Calls abstract createWizard() method to get wizard instance
- * <li>If wizard implements ISystemWizard, calls setInputValue(...), passing in
- * getValue() if not null, else passing in getFirstSelection() if not null.
- * <li>Instantiates a WizardDialog object with the wizard object from createWizard().
- * Returns this to run() in our parent class which then opens this dialog.
- * </ul>
- *
- */
- protected final Dialog createDialog(Shell shell) {
- newWizard = createWizard();
-
- if ((newWizard instanceof Wizard) && wasNeedsProgressMonitorSet())
- ((Wizard)newWizard).setNeedsProgressMonitor(getNeedsProgressMonitor());
-
- if (newWizard instanceof Wizard) {
- if (wizardTitle != null)
- ((Wizard)newWizard).setWindowTitle(wizardTitle);
- if (wizardImage != null)
- ((Wizard)newWizard).setDefaultPageImageDescriptor(wizardImage);
- }
-
- return doCreateWizardDialog(shell, newWizard);
- }
-
- /**
- * Creates the dialog instance. Called from <code>createDialog(...)</code>.
- * Gives overrides the chance to plug-in their own specialized wizard dialog
- * implementations.
- *
- * @param shell The shell to create the dialog in. Must be not <code>null</code>.
- * @param wizard The wizard to create the wizard dialog for. Must be not <code>null</code>.
- *
- * @return The wizard dialog instance. Must be never <code>null</code>.
- */
- protected WizardDialog doCreateWizardDialog(Shell shell, IWizard wizard) {
- assert shell != null && wizard != null;
-
- WizardDialog dialog = null;
-
- if (newWizard instanceof ISystemWizard) {
- ISystemWizard swizard = (ISystemWizard)newWizard;
- if (pageTitle != null)
- swizard.setWizardPageTitle(pageTitle);
- swizard.setViewer(getViewer());
- dialog = new SystemWizardDialog(shell, swizard);
- int w = swizard.getMinimumPageWidth();
- int h = swizard.getMinimumPageHeight();
- if (minPageWidth > 0)
- w = minPageWidth;
- if (minPageHeight > 0)
- h = minPageHeight;
- //System.out.println("In SystemBaseWizardAction. minPageWidth = " + w + ", minPageHeight = " + h);
- if ((w > 0) && (h > 0))
- dialog.setMinimumPageSize(w, h);
-
- } else
- dialog = new WizardDialog(shell, newWizard);
-
- return dialog;
- }
-
- /**
- * The default processing for the run method calls createDialog, which
- * we override in this class. The implementation of createDialog calls
- * this method that you must override, to create the wizard. The result
- * goes into a WizardDialog which is opened and hence displayed to the
- * user.
- */
- protected abstract IWizard createWizard();
-
- /**
- * By default, we try to get the wizard's value by calling getOutputObject()
- */
- protected Object getDialogValue(Dialog dlg) {
- postProcessWizard(newWizard);
- if (newWizard instanceof ISystemWizard) {
- ISystemWizard ourWizard = (ISystemWizard)newWizard;
- return ourWizard.getOutputObject();
- } else
- return null;
- }
-
- /**
- * Typically, the wizard's performFinish method does the work required by
- * a successful finish of the wizard. However, often we also want to be
- * able to extract user-entered data from the wizard, by calling getters
- * in this action. To enable this, override this method to populate your
- * output instance variables from the completed wizard, which is passed
- * as a parameter. This is only called after successful completion of the
- * wizard.
- */
- protected void postProcessWizard(IWizard wizard) {
- }
-
- /**
- * Returns true if the user cancelled the wizard.
- * This is an override of the parent method, since we can be more
- * accurate with wizards than we can with dialogs.
- */
- public boolean wasCancelled() {
- if (newWizard instanceof ISystemWizard) {
- ISystemWizard ourWizard = (ISystemWizard)newWizard;
- return ourWizard.wasCancelled();
- } else
- return super.wasCancelled();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyToClipboardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyToClipboardAction.java
deleted file mode 100644
index e0538cc78..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemCopyToClipboardAction.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemDropActionDelegate;
-import org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.PluginTransferData;
-import org.eclipse.ui.part.ResourceTransfer;
-
-
-/**
- * Copy selected objects to clipboard action.
- */
-public class SystemCopyToClipboardAction extends SystemBaseAction implements IValidatorRemoteSelection
-{
- private IStructuredSelection _selection;
- private Clipboard _clipboard;
- private boolean _doResourceTransfer = false; // determines whether or not to download on copy
-
- /**
- * Constructor
- */
- public SystemCopyToClipboardAction(Shell shell, Clipboard clipboard)
- {
- super(SystemResources.ACTION_COPY_LABEL,
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
- shell);
-
- _clipboard = clipboard;
- setToolTipText(SystemResources.ACTION_COPY_TOOLTIP);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0116"); //$NON-NLS-1$
- }
-
- public void run()
- {
- if (_selection != null)
- {
- copySelectionToClipboard(_selection);
- }
- }
-
- private IResource getResource(IAdaptable dragObject)
- {
- IResource resource = null;
- ISystemViewElementAdapter viewAdapter = (ISystemViewElementAdapter) dragObject.getAdapter(ISystemViewElementAdapter.class);
- ISystemRemoteElementAdapter remoteAdapter = (ISystemRemoteElementAdapter)dragObject.getAdapter(ISystemRemoteElementAdapter.class);
-
- if (remoteAdapter != null)
- {
- if (remoteAdapter.canEdit(dragObject))
- {
- ISystemEditableRemoteObject editable = remoteAdapter.getEditableRemoteObject(dragObject);
- // corresponds to a file
- IFile file = editable.getLocalResource();
- if (!file.exists())
- {
- LazyDownloadJob job = new LazyDownloadJob(editable);
- job.schedule();
- }
- resource = file;
- }
- else if (viewAdapter != null)
- {
- if (viewAdapter.hasChildren(dragObject))
- {
- IContainer parentFolder = null;
- // corresponds to a folder
- Object[] children = viewAdapter.getChildren(dragObject, new NullProgressMonitor());
- for (int i = 0; i < children.length; i++)
- {
- IAdaptable child = (IAdaptable)children[i];
- IResource childResource = getResource(child);
- if (childResource != null)
- {
- parentFolder = childResource.getParent();
- if (!parentFolder.exists())
- {
- try
- {
- parentFolder.touch(new NullProgressMonitor());
- }
- catch (Exception e)
- {
-
- }
-
- }
- }
- }
-
-
- resource = parentFolder;
- }
- }
- }
- return resource;
- }
-
-
- private void copySelectionToClipboard(IStructuredSelection ss)
- {
- Iterator iterator = ss.iterator();
-
- // marshall data
- StringBuffer textStream = new StringBuffer(""); //$NON-NLS-1$
- StringBuffer dataStream = new StringBuffer(""); //$NON-NLS-1$
-
- ArrayList fileNames = new ArrayList();
- ArrayList resources = new ArrayList();
-
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
-
- while (iterator.hasNext())
- {
- Object dragObject = iterator.next();
-
- if (dragObject instanceof IAdaptable)
- {
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter) ((IAdaptable) dragObject).getAdapter(ISystemViewElementAdapter.class);
-
- if (adapter != null)
- {
- String text = adapter.getAlternateText(dragObject);
- textStream.append(getTextTransferPrepend(dragObject, adapter));
- textStream.append(text);
- textStream.append(getTextTransferAppend(dragObject, adapter));
-
- if (adapter.canDrag(dragObject))
- {
- ISubSystem subSystem = null;
- if (dragObject instanceof ISubSystem)
- {
- subSystem = (ISubSystem)dragObject;
- String subSystemId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForSubSystem(subSystem);
- dataStream.append(subSystemId);
- }
- else if (dragObject instanceof IHost)
- {
- IHost connection = (IHost)dragObject;
- String connectionId = RSECorePlugin.getTheSystemRegistry().getAbsoluteNameForConnection(connection);
- dataStream.append(connectionId);
- }
- else
- {
- // get the subsystem id
- subSystem = adapter.getSubSystem(dragObject);
- String subSystemId = registry.getAbsoluteNameForSubSystem(subSystem);
-
- dataStream.append(subSystemId);
- dataStream.append(":"); //$NON-NLS-1$
-
- String objectId = adapter.getAbsoluteName(dragObject);
- dataStream.append(objectId);
-
- if (iterator.hasNext())
- {
- dataStream.append(SystemViewDataDropAdapter.RESOURCE_SEPARATOR);
- }
-
- if (_doResourceTransfer)
- {
- IResource resource = getResource((IAdaptable)dragObject);
- if (resource != null)
- {
- resources.add(resource);
-
- String fileName = resource.getLocation().toOSString();
- fileNames.add(fileName);
- }
- }
- }
- }
- }
- }
- }
-
- PluginTransferData data = new PluginTransferData(SystemDropActionDelegate.ID, dataStream.toString().getBytes());
-
- // put data in clipboard
- if (_doResourceTransfer && resources.size() > 0)
- {
- IResource[] ft = new IResource[resources.size()];
- for (int i = 0; i < ft.length; i++)
- {
- ft[i] = (IResource) resources.get(i);
- }
-
- String[] fn = new String[fileNames.size()];
- for (int j = 0; j < fn.length; j++)
- {
- fn[j] = (String)fileNames.get(j);
- }
-
- _clipboard.setContents(new Object[] { data, ft, fn, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), ResourceTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()});
-
- }
- else
- {
- String[] ft = new String[fileNames.size()];
- for (int i = 0; i < ft.length; i++)
- {
- ft[i] = (String) fileNames.get(i);
- }
-
- if (ft.length > 0)
- {
- _clipboard.setContents(new Object[] { data, ft, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance()});
- }
- else
- {
- _clipboard.setContents(new Object[] { data, textStream.toString() }, new Transfer[] { PluginTransfer.getInstance(), TextTransfer.getInstance()});
- }
- }
- }
-
- /**
- * Returns the string to prepend for the selected object for text transfer.
- * Default implementation returns the empty string.
- * @param obj the selected object.
- * @param adapter the adapter of the selected object.
- * @return the string to prepend for the selected object.
- */
- protected String getTextTransferPrepend(Object obj, ISystemViewElementAdapter adapter) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns the string to append for the selected object for text transfer.
- * Default implementation returns the system line separator (i.e. the line.separator property).
- * @param obj the selected object.
- * @param adapter the adapter of the selected object.
- * @return the string to append for the selected object.
- */
- protected String getTextTransferAppend(Object obj, ISystemViewElementAdapter adapter) {
- return System.getProperty("line.separator"); //$NON-NLS-1$
- }
-
- /**
- * The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage
- * if it is not to be enabled. The message will be displayed on the message line.
- * <p>
- * This is overridden in SystemMoveRemoteFileAction
- */
- public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
- {
- return null;
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We simply ensure every selected object has a system view element adapter.
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof IAdaptable)
- {
- IAdaptable adaptable = (IAdaptable) selectedObject;
- ISystemViewElementAdapter va = (ISystemViewElementAdapter) (adaptable.getAdapter(ISystemViewElementAdapter.class));
- if (va != null)
- {
- enable = va.canDrag(selectedObject);
- }
- else
- {
- enable = false;
- }
- }
- else
- {
- enable = false;
- }
- }
-
- if (enable)
- {
- _selection = selection;
- }
- return enable;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java
deleted file mode 100644
index 19a575f8a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Set action id for identification from plugin.xml menu extensions.
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Uwe Stieber (Wind River) - [192202] Default RSE new connection wizard does not allow to query created host instance anymore
- * Uwe Stieber (Wind River) - [189426] System File/Folder Dialogs - New Connection Not Added to Drop Down
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard;
-import org.eclipse.rse.ui.wizards.newconnection.RSEMainNewConnectionWizard;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action that displays the New Connection wizard
- */
-public class SystemNewConnectionAction extends SystemBaseWizardAction {
-
- private boolean fromPopupMenu = true;
- private ISelectionProvider sp;
- private IRSESystemType[] restrictSystemTypesTo;
-
- // The current selection the action is knowing of. Just pass on
- // to the wizards. Do not interpret here!
- private ISelection selectedContext;
- // The associated connection object of the selected context if
- // determinable from the selected context
- private IHost connectionContext;
-
- /**
- * Constructor.
- *
- * @param shell The parent shell to host the new wizard
- * @param fromPopupMenu true if being launched from the Remote System Explorer view directly,
- * false if being launched from a dialog
- * @param sp The selection provider that will supply the selection via getSelection, if
- * fromPopupMenu is false
- */
- public SystemNewConnectionAction(Shell shell, boolean fromPopupMenu, ISelectionProvider sp) {
- this(shell, fromPopupMenu, true, sp);
- }
-
- /**
- * Constructor for SystemNewConnectionAction when you don't want the icon.
- * @param shell The parent shell to host the new wizard
- * @param fromPopupMenu true if being launched from the Remote System Explorer view directly,
- * false if being launched from a dialog
- * @param wantIcon true if you want the icon to show beside the action, false if not
- * @param sp The selection provider that will supply the selection via getSelection, if
- * fromPopupMenu is false
- */
- public SystemNewConnectionAction(Shell shell, boolean fromPopupMenu, boolean wantIcon, ISelectionProvider sp) {
- this(shell, SystemResources.ACTION_NEWCONN_LABEL, SystemResources.ACTION_NEWCONN_TOOLTIP, fromPopupMenu, wantIcon, sp);
- }
-
- /**
- * Constructor for SystemNewConnectionAction when you possibly don't want the icon, and want to
- * supply your own label. This is the "full" flavoured constructor!
- *
- * @param shell The parent shell to host the new wizard
- * @param label The label for the action
- * @param tooltip the tooltip for the action
- * @param fromPopupMenu true if being launched from the Remote System Explorer view directly,
- * false if being launched from a dialog
- * @param wantIcon true if you want the icon to show beside the action, false if not
- * @param sp The selection provider that will supply the selection via getSelection, if
- * fromPopupMenu is false
- */
- public SystemNewConnectionAction(Shell shell, String label, String tooltip, boolean fromPopupMenu, boolean wantIcon, ISelectionProvider sp) {
- super(label, tooltip, wantIcon ? RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTION_ID) : null, shell);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- this.fromPopupMenu = fromPopupMenu;
- this.sp = sp;
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0000"); //$NON-NLS-1$
- }
-
- /**
- * The default processing for the run method calls createDialog, which
- * in turn calls this method to return an instance of our wizard.
- * <p>
- * Our default implementation is to return <code>RSEMainNewConnectionWizard</code>.
- */
- protected IWizard createWizard() {
- // reset the output value
- setValue(null);
-
- // create the new connection wizard instance.
- RSEMainNewConnectionWizard newConnWizard = new RSEMainNewConnectionWizard();
-
- // simulate a selection changed event if the action is not called from
- // a popup menu and a selection provider is set
- if (!fromPopupMenu && sp != null) setSelection(sp.getSelection());
-
- // First, restrict the wizard in the system types to show if this is
- // requested.
- if (restrictSystemTypesTo != null) {
- newConnWizard.restrictToSystemTypes(restrictSystemTypesTo);
- }
-
- // If there is an remembered selection, we pass on the selected context
- // totally untranslated to the wizards. The specific wizards have to
- // interpret the selection themself. We simple cannot know here what is
- // necessary and what not. Wizard providers may want to get selections
- // we have no idea from. Only chance to do so, pass the selection on.
- newConnWizard.setSelectedContext(selectedContext);
-
- // if we had determined the connection context of the selected context, pass
- // on as well to the new connection wizard.
- newConnWizard.setConnectionContext(connectionContext);
-
- // If the wizard is restricted to only one system type, the main wizard has to be skipped
- // and the dialog needs to be initialized directly with the selected wizard.
- if (newConnWizard.isRestrictedToSingleSystemType()) {
- IWizard wizard = newConnWizard.getSelectedWizard();
- if (wizard instanceof ISelectionChangedListener) {
- ((ISelectionChangedListener)wizard).selectionChanged(new SelectionChangedEvent(newConnWizard, newConnWizard.getSelection()));
- }
- return wizard;
- }
-
- return newConnWizard;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction#doCreateWizardDialog(org.eclipse.swt.widgets.Shell, org.eclipse.jface.wizard.IWizard)
- */
- protected WizardDialog doCreateWizardDialog(Shell shell, IWizard wizard) {
- // The new connection action is always using the standard Eclipse WizardDialog!!!
- return new WizardDialog(getShell(), wizard);
- }
-
- /**
- * Call this to restrict the system types that the user is allowed to choose
- */
- public void restrictSystemTypes(IRSESystemType[] systemTypes) {
- this.restrictSystemTypesTo = systemTypes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction#postProcessWizard(org.eclipse.jface.wizard.IWizard)
- */
- protected void postProcessWizard(IWizard wizard) {
- if (wizard instanceof RSEMainNewConnectionWizard) wizard = ((RSEMainNewConnectionWizard)wizard).getSelectedWizard();
- if (wizard instanceof RSEDefaultNewConnectionWizard) {
- setValue(((RSEDefaultNewConnectionWizard)wizard).getCreatedHost());
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction#getDialogValue(org.eclipse.jface.dialogs.Dialog)
- */
- protected Object getDialogValue(Dialog dlg) {
- // We have to trick the super implementation a little bit because otherwise
- // we do not get access to the current wizard instance. The postProcessWizard
- // implementation will use setValue() for pushing the created host instance,
- // which in turn we query here again in case the super implementation does
- // return null to us (which is the case if the wizard does not implement ISystemWizard,
- // what is what we do not want to do in case of RSEDefaultNewConnectionWizard anymore).
- Object value = super.getDialogValue(dlg);
- if (value == null && getValue() != null) value = getValue();
- return value;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection) {
- boolean enabled = super.updateSelection(selection);
- // store the selection. The wizard contributor may want to analyse
- // the current selection by themself.
- selectedContext = selection;
-
- // and try to determine the connection context from the selection
- if (enabled) {
- Object firstSelection = getFirstSelection();
- IHost conn = null;
- if (firstSelection != null) {
- if (firstSelection instanceof IHost)
- conn = (IHost)firstSelection;
- else if (firstSelection instanceof ISubSystem)
- conn = ((ISubSystem)firstSelection).getHost();
- else if (firstSelection instanceof ISystemFilterPoolReference) {
- ISystemFilterPoolReference sfpr = (ISystemFilterPoolReference)firstSelection;
- ISubSystem ss = (ISubSystem)sfpr.getProvider();
- conn = ss.getHost();
- } else if (firstSelection instanceof ISystemFilterReference) {
- ISystemFilterReference sfr = (ISystemFilterReference)firstSelection;
- ISubSystem ss = (ISubSystem)sfr.getProvider();
- conn = ss.getHost();
- } else if (firstSelection instanceof ISystemFilterStringReference) {
- ISystemFilterStringReference sfsr = (ISystemFilterStringReference)firstSelection;
- ISubSystem ss = (ISubSystem)sfsr.getProvider();
- conn = ss.getHost();
- }
- }
-
- connectionContext = conn;
- }
-
- return enabled;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
deleted file mode 100644
index fd17b1aa1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPasteFromClipboardAction.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Kenya Ishimoto (IBM) - [241197] Paste action causes IllegalArgumentException at Resource.copy
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemDNDTransferRunnable;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.PluginTransferData;
-import org.eclipse.ui.part.ResourceTransfer;
-
-
-/**
- * Paste resources in system clipboard to the selected resource action.
- */
-public class SystemPasteFromClipboardAction extends SystemBaseAction implements IValidatorRemoteSelection
-{
-
-
- private int _srcType;
- private Object _selection;
- private Clipboard _clipboard;
- /**
- * Constructor
- */
- public SystemPasteFromClipboardAction(Shell shell, Clipboard clipboard)
- {
- super(SystemResources.ACTION_PASTE_LABEL,
- PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
- //RSEUIPlugin.getDefault().getImageDescriptor(ISystemConstants.ICON_SYSTEM_PASTE_ID),
- shell);
- _clipboard = clipboard;
- _srcType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE;
- setEnabled(false);
-
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_REORGANIZE);
- setHelp(RSEUIPlugin.HELPPREFIX + "actn0117"); //$NON-NLS-1$
- }
-
- public void run()
- {
- if (_selection != null)
- {
- pasteClipboardToSelection(_selection);
- }
- }
-
-
- private void pasteClipboardToSelection(Object target)
- {
- List srcObjects = RSEUIPlugin.getTheSystemRegistryUI().getSystemClipboardObjects(_srcType);
- if (srcObjects.size() > 0)
- {
- // do the transfer
- SystemDNDTransferRunnable runnable = new SystemDNDTransferRunnable(target, (ArrayList)srcObjects, getViewer(), _srcType);
- if (target instanceof IAdaptable)
- {
- ISystemDragDropAdapter targetAdapter = (ISystemDragDropAdapter) ((IAdaptable) target).getAdapter(ISystemDragDropAdapter.class);
-
- if (targetAdapter != null)
- {
- List rulesList = new ArrayList();
-
- if (target instanceof ISchedulingRule) {
- rulesList.add(target);
- }
-
- int j = 0;
- for (int i = 0; i < srcObjects.size(); i++)
- {
- if (srcObjects.get(i) instanceof ISchedulingRule)
- {
- rulesList.add(srcObjects.get(i));
- j++;
- }
- /** FIXME - IREmoteFile is systems.core independent now
- else if (srcObjects.get(i) instanceof IRemoteFile)
- {
- rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)srcObjects.get(i)));
- j++;
- }
- **/
- }
- /*
- if (target instanceof ISchedulingRule)
- {
- rulesList.add(target);
- }
- */
- /** FIXME - IREmoteFile is systems.core independent now
- else if (target instanceof IRemoteFile)
- {
- rulesList.add(new RemoteFileSchedulingRule((IRemoteFile)target));
- }
- */
- /*
- else
- {
- rulesList.add(targetSubSystem);
- }
- */
- if (rulesList.size() > 0)
- {
- ISchedulingRule[] rules = (ISchedulingRule[])rulesList.toArray(new ISchedulingRule[rulesList.size()]);
- MultiRule rule = new MultiRule(rules);
- runnable.setRule(rule);
- }
- }
- }
- runnable.schedule();
- RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
- }
- // clear clipboard
- // _clipboard.setContents(new Object[] { null }, new Transfer[] { PluginTransfer.getInstance()});
- // setEnabled(false);
- }
-
-
- /**
- * The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage
- * if it is not to be enabled. The message will be displayed on the message line.
- * <p>
- * This is overridden in SystemMoveRemoteFileAction
- */
- public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects)
- {
- return null;
- }
-
- public boolean hasSource()
- {
- synchronized (_clipboard)
- {
- try
- {
- Object object = _clipboard.getContents(PluginTransfer.getInstance());
- if (object != null)
- {
- if (object instanceof PluginTransferData)
- {
- PluginTransferData data = (PluginTransferData) object;
- byte[] result = data.getData();
- if (result != null)
- {
- _srcType = SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE;
- return true;
- }
- }
- }
- else
- {
- // clipboard must have resources or files
- ResourceTransfer resTransfer = ResourceTransfer.getInstance();
- object = _clipboard.getContents(resTransfer);
- if (object != null)
- {
- IResource[] resourceData = (IResource[]) object;
- if (resourceData.length > 0)
- {
- _srcType = SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE;
- return true;
- }
- }
- else
- {
- FileTransfer fileTransfer = FileTransfer.getInstance();
- object = _clipboard.getContents(fileTransfer);
-
- if (object != null)
- {
- String[] fileData = (String[]) object;
- if (fileData.length > 0)
- {
- _srcType = SystemDNDTransferRunnable.SRC_TYPE_OS_RESOURCE;
- return true;
- }
- }
- else
- {
- TextTransfer textTransfer = TextTransfer.getInstance();
- object = _clipboard.getContents(textTransfer);
-
- if (object != null)
- {
- //String textData = (String) object;
- _srcType = SystemDNDTransferRunnable.SRC_TYPE_TEXT;
- return true;
- }
- }
- }
- }
- }
- catch (Exception e)
- {
- }
- }
- return false;
- }
-
- /**
- * We override from parent to do unique checking...
- * <p>
- * We simply ensure every selected object is an IRemoteFile
- * <p>
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- if (hasSource())
- {
- boolean enable = true;
- Iterator e = selection.iterator();
- while (enable && e.hasNext())
- {
- Object selectedObject = e.next();
- if (selectedObject instanceof IAdaptable)
- {
- IAdaptable adaptable = (IAdaptable) selectedObject;
- ISystemDragDropAdapter va = (ISystemDragDropAdapter) (adaptable.getAdapter(ISystemDragDropAdapter.class));
- if (va != null)
- {
- enable = va.canDrop(selectedObject);
- /* to allow disable of paste
- * not sure if this is a performance hit or not
- if (enable)
- {
- SubSystem tgtSS = va.getSubSystem(selectedObject);
- List srcObjects = getClipboardObjects();
- if (_srcType == SystemDNDTransferRunnable.SRC_TYPE_RSE_RESOURCE)
- {
-
- for (int i = 0; i < srcObjects.size() && enable; i++)
- {
- Object srcObject = srcObjects.get(i);
- ISystemDragDropAdapter srcAdapter = (ISystemDragDropAdapter)((IAdaptable)srcObject).getAdapter(ISystemDragDropAdapter.class);
- SubSystem srcSS = srcAdapter.getSubSystem(srcObject);
- boolean sameSystem = (srcSS == tgtSS);
- enable = va.validateDrop(srcObject, selectedObject, sameSystem);
- }
- }
- else if (_srcType == SystemDNDTransferRunnable.SRC_TYPE_ECLIPSE_RESOURCE)
- {
- for (int i = 0; i < srcObjects.size() && enable; i++)
- {
- Object srcObject = srcObjects.get(i);
- boolean sameSystem = false;
- enable = va.validateDrop(srcObject, selectedObject, sameSystem);
- }
- }
- else if (_srcType == SystemDNDTransferRunnable.SRC_TYPE_OS_RESOURCE)
- {
- for (int i = 0; i < srcObjects.size() && enable; i++)
- {
- Object srcObject = srcObjects.get(i);
- boolean sameSystem = false;
- enable = va.validateDrop(srcObject, selectedObject, sameSystem);
- }
- }
-
- }
- */
- }
- else
- {
- enable = false;
- }
- }
- else
- {
- enable = false;
- }
- }
- if (enable)
- {
- _selection = selection.getFirstElement();
- }
- return enable;
- }
- else
- {
- return false;
- }
-
- }
-
- protected IRunnableContext getRunnableContext(Shell shell)
- {
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- if (irc != null)
- {
- return irc;
- }
- else
- {
- /*
- // for other cases, use statusbar
- IWorkbenchWindow win = RSEUIPlugin.getActiveWorkbenchWindow();
- if (win != null)
- {
- Shell winShell = RSEUIPlugin.getActiveWorkbenchShell();
- if (winShell != null && !winShell.isDisposed() && winShell.isVisible())
- {
- RSEUIPlugin.logInfo("Using active workbench window as runnable context");
- shell = winShell;
- return win;
- }
- else
- {
- win = null;
- }
- }
- */
-
- irc = new ProgressMonitorDialog(shell);
- RSEUIPlugin.getTheSystemRegistryUI().setRunnableContext(shell, irc);
- return irc;
- }
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java
deleted file mode 100644
index 8823e5fd3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAction.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Michael Berger (IBM) - 146339 Added refresh action graphic.
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [188160] avoid parent refresh if not doing deferred queries
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewFilterReferenceAdapter;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to refresh the selected node in the Remote System Explorer tree view
- */
-public class SystemRefreshAction extends SystemBaseAction
- //
-{
- private IStructuredSelection _selection = null;
-
- /**
- * Constructor
- */
- public SystemRefreshAction(Shell parent)
- {
- super(SystemResources.ACTION_REFRESH_LABEL, SystemResources.ACTION_REFRESH_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_REFRESH_ID), // D54577
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0017"); //$NON-NLS-1$
- setAvailableOffline(true);
- }
-
- /**
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- _selection = selection;
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- if (_selection != null)
- {
- Set localItems = new HashSet();
- Set remoteItems = new HashSet();
- Vector namesToSelect = new Vector();
-
- Iterator iter = _selection.iterator();
- while(iter.hasNext()) {
- Object obj = iter.next();
- if (obj instanceof ISystemContainer) {
- ((ISystemContainer)obj).markStale(true);
- }
-
- // get the adapter and find out if it's a leaf node. If so, refresh the parent as well.
- ISystemViewElementAdapter adapter = getViewAdapter(obj);
- if (adapter != null) {
- // choose the item to refresh -- use parent in case of leaf node.
- //
- // This is because subsystems with deferred queries do not have an
- // adapter call for deferred query of properties for a non-container.
- //
- // The problem with this code is, that we cannot know here whether it
- // actually is a leaf node that can never have children, or a container
- // that just happens not to have children right now. Also, this code
- // adds overhead that may be an unnecessary performance hit.
- Object itemToRefresh = obj;
- ISubSystem subsys = adapter.getSubSystem(obj);
- if (subsys!=null && adapter.supportsDeferredQueries(subsys) && !(adapter instanceof SystemViewFilterReferenceAdapter)) {
- //if deferred queries are not supported, hasChildren() goes right to the remote.
- //If deferred queries are supported, it is expected to be cached.
- if (!adapter.hasChildren((IAdaptable)obj)) {
- Object parent = adapter.getParent(obj);
- if (parent!=null) {
- itemToRefresh = parent;
- }
- }
- }
-
- // If we can REFRESH_REMOTE, add the absolute name to reselect
- String absoluteName = adapter.getAbsoluteName(obj);
- if (absoluteName!=null) {
- //Remote items will be refreshed later
- remoteItems.add(itemToRefresh);
- namesToSelect.add(absoluteName);
- } else if (!localItems.contains(obj)) {
- localItems.add(obj);
- sr.fireEvent(new SystemResourceChangeEvent(obj, ISystemResourceChangeEvents.EVENT_REFRESH, obj));
- }
- }
- else {
- sr.fireEvent(new SystemResourceChangeEvent(obj, ISystemResourceChangeEvents.EVENT_REFRESH, obj));
- }
- }
- //Free objects
- localItems.clear();
- //Deferred refresh of remote items: Try to optimize refresh by reducing the number of parents
- boolean itemsChanged = true;
- while (remoteItems.size()>1 && itemsChanged) {
- itemsChanged = false;
- Iterator it = remoteItems.iterator();
- while (it.hasNext()) {
- Object obj = it.next();
- ISystemViewElementAdapter adapter = getViewAdapter(obj);
- Object parent = adapter.getParent(obj);
- if (remoteItems.contains(parent)) {
- it.remove();
- itemsChanged = true;
- }
- }
- }
- //Fire events
- Iterator it = remoteItems.iterator();
- while (it.hasNext()) {
- Object obj = it.next();
- ISubSystem subsys = getViewAdapter(obj).getSubSystem(obj);
- if (subsys!=null) {
- //Remote refresh works properly inside the subsystem only. Outside, we need to do local refresh.
- sr.fireEvent(new SystemResourceChangeEvent(obj, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, namesToSelect));
- } else {
- sr.fireEvent(new SystemResourceChangeEvent(obj, ISystemResourceChangeEvents.EVENT_REFRESH, obj));
- sr.fireEvent(new SystemResourceChangeEvent(namesToSelect, ISystemResourceChangeEvents.EVENT_SELECT_REMOTE, null));
- }
- }
- }
- else
- {
- //TODO Check if this is dead code?
- if ((viewer != null) && (viewer instanceof ISystemResourceChangeListener))
- {
- sr.fireEvent((ISystemResourceChangeListener)viewer,
- new SystemResourceChangeEvent(sr,
- ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED, null));
- }
- else
- sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH_SELECTED, null));
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java
deleted file mode 100644
index 836d0287e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemRefreshAllAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action allows users to refresh the entire Remote System Explorer tree view
- */
-public class SystemRefreshAllAction extends SystemBaseAction
-
-{
-
- //private SystemProfile prevProfile = null;
- private IStructuredSelection _selection = null;
- private Object _rootObject = null;
-
- /**
- * Constructor for SystemRefreshAllAction
- */
- public SystemRefreshAllAction(Shell parent)
- {
- super(SystemResources.ACTION_REFRESH_ALL_LABEL,SystemResources.ACTION_REFRESH_ALL_TOOLTIP,
- parent);
- allowOnMultipleSelection(true);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_BUILD);
- //setSelectionSensitive(false);
- setSelectionSensitive(true);// use selection to decide what to invalidate
-
- setHelp(RSEUIPlugin.HELPPREFIX+"actn0009"); //$NON-NLS-1$
- }
-
- public void setRootObject(Object object)
- {
- _rootObject = object;
- }
-
- /**
- * @see SystemBaseAction#updateSelection(IStructuredSelection)
- */
- public boolean updateSelection(IStructuredSelection selection)
- {
- boolean enable = true;
- _selection = selection;
- return enable;
- }
-
- /**
- * This is the method called when the user selects this action.
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run()
- {
- if (_selection != null)
- {
- // mark all selected objects as stale if applicable
- Iterator iter = _selection.iterator();
- while(iter.hasNext())
- {
- Object obj = iter.next();
-
- if (obj instanceof ISystemContainer)
- {
- ((ISystemContainer)obj).markStale(true);
- }
- }
- }
- if (_rootObject != null)
- {
- if (_rootObject instanceof ISystemContainer)
- {
- ((ISystemContainer)_rootObject).markStale(true);
- }
- }
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.fireEvent(new SystemResourceChangeEvent(sr, ISystemResourceChangeEvents.EVENT_REFRESH, null));
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java
deleted file mode 100644
index bbaed8f65..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemTablePrintAction.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.actions;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemDecoratingLabelProvider;
-import org.eclipse.rse.ui.view.SystemTableView;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.printing.PrintDialog;
-import org.eclipse.swt.printing.Printer;
-import org.eclipse.swt.printing.PrinterData;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-
-
-/**
- * This is the action for printing the contents of the table view
- */
-public class SystemTablePrintAction extends SystemBaseAction
-{
-
- private int[] _columnWidths = null;
- private int[] _columnAlignments = null;
-
- private boolean bPrintSelection;
- private boolean bPageRange;
-
- private int endLine;
- private int bottomMargin = 100;
- private int leftMargin = 100;
- private int rightMargin = 100;
- private int topMargin = 100;
-
- private String sPrintOutputName = null;
- private String sPageTitle = null;
- private String sTableTitle = null;
- private String sColumnHeader = null;
- private String sUnderLine = null;
- private String sEndOfListing = null;
-
- private int pageNumber = 1;
- private boolean startedPage = false;
- int startPage;
- int endPage;
-
- private int pageHeight;
- private int pageWidth;
- private int x;
- private int y = 0;
- private int w;
- private int textHeight;
-
- private Printer printer;
- private boolean bPrintPage;
- private GC g;
-
- private SystemTableView _viewer = null;
- private String _title = null;
- private boolean _hasColumns = false;
-
- /**
- * Constructor.
- * @param title the title for the print document
- * @param viewer the viewer to print the contents of
- */
- public SystemTablePrintAction(String title, SystemTableView viewer)
- {
- super(SystemResources.ACTION_PRINTLIST_LABEL, null);
- setToolTipText(SystemResources.ACTION_PRINTLIST_TOOLTIP);
- setTableView(title, viewer);
- }
-
- /**
- * Sets the title for the print document and the table view to print from
- * @param title the title for the print document
- * @param viewer the viewer to print the contents of
- */
- public void setTableView(String title, SystemTableView viewer)
- {
- _title = title;
- _viewer = viewer;
- }
-
- /**
- * Called to check whether this action should be enabled.
- */
- public void checkEnabledState()
- {
- if (_viewer != null && _viewer.getInput() != null)
- {
- setEnabled(true);
- }
- else
- {
- setEnabled(false);
- }
- }
-
- /**
- * Called when the user chooses to print
- */
- public void run()
- {
- // page format info
- DateFormat dateFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
- String sCurrentDate = dateFormatter.format(new Date());
-
- sPrintOutputName = SystemResources.RESID_TABLE_PRINTLIST_TITLE;
- sPageTitle = sPrintOutputName;
- sPageTitle = sPageTitle + sCurrentDate;
-
- // Table title
- sTableTitle = _title;
-
- /*============================*/
- /* Present the print dialog */
- /*============================*/
- PrintDialog printDialog = new PrintDialog(_viewer.getShell());
-
- PrinterData printerData = printDialog.open();
- if (printerData == null) // user cancelled the print job?
- {
- return;
- }
- // get updated settings from the print dialog
- bPrintSelection = (printerData.scope & PrinterData.SELECTION) != 0;
- bPageRange = printerData.scope == PrinterData.PAGE_RANGE;
-
- Table table = _viewer.getTable();
-
- TableItem[] printItems = table.getItems();
- if (bPrintSelection)
- {
- printItems = table.getSelection();
- endLine = printItems.length;
- if (endLine == 0)
- return; // nothing to print
- }
- else if (bPageRange)
- {
- endLine = printItems.length;
- startPage = printerData.startPage;
- endPage = printerData.endPage;
- if (endPage < startPage)
- return; // nothing to print
- }
-
- /*===================*/
- /* do the printing */
- /*===================*/
- // start print job
- printer = new Printer(printerData);
-
- if (!printer.startJob(sPrintOutputName))
- {
- printer.dispose();
- return;
- }
-
- Rectangle clientArea = printer.getClientArea();
-
- pageHeight = clientArea.height;
- pageWidth = clientArea.width;
- g = new GC(printer);
-
- textHeight = g.getFontMetrics().getHeight();
-
- /*----------------------------------------*/
- /* go through all the lines to print... */
- /*----------------------------------------*/
- pageNumber = 1;
- startedPage = false;
-
- // scale factor
- int scaleFactor = 1;
- Rectangle tableClientArea = table.getClientArea();
- int tableWidth = tableClientArea.width - 5;
- if (tableWidth > pageWidth)
- {
- scaleFactor = tableWidth / pageWidth;
- }
-
- int columnCount = table.getColumnCount();
- if (columnCount > 1)
- {
- _hasColumns = true;
- }
- else
- {
- _hasColumns = false;
- }
-
- // header info
-
- getColumnInfo(scaleFactor);
- sColumnHeader = getColumnHeader();
- sUnderLine = getHeaderSeparator();
-
- sEndOfListing = getTableFooter();
-
- for (int i = 0; i < printItems.length; i++)
- {
- TableItem item = printItems[i];
- Object data = item.getData();
-
- String line = getLine(data, columnCount);
-
- printLine(line);
- }
-
- printLine(" "); //$NON-NLS-1$
- printLine(sEndOfListing);
-
- /*=======================*/
- /* finish up print job */
- /*=======================*/
- g.dispose();
-
- printer.endJob();
- printer.dispose();
-
- System.gc();
- return;
- }
-
- /*
- * Print one line
- */
- private void printLine(String text)
- {
- do // until the text of one line is printed
- {
- // start a new page
- if (!startedPage)
- {
- if (bPageRange)
- {
- if (pageNumber >= startPage && pageNumber <= endPage)
- bPrintPage = true;
- else
- bPrintPage = false;
- }
- else
- bPrintPage = true;
-
- startedPage = true;
- x = leftMargin;
- y = topMargin;
- if (bPrintPage)
- {
- printer.startPage();
- g.drawString(sPageTitle + pageNumber, x, y);
-
- y += textHeight * 2;
-
- g.drawString(sTableTitle, x, y);
- y += textHeight * 2;
-
- g.drawString(sColumnHeader, x, y);
- y += textHeight;
-
- g.drawString(sUnderLine, x, y);
- y += textHeight;
- }
- else
- {
- y = topMargin + textHeight * 6;
- }
- pageNumber++;
- }
- // start at beginning of the line
- x = leftMargin;
-
- if (text != null)
- {
- int l = text.length();
- while (l > 0)
- {
- w = g.stringExtent(text.substring(0, l)).x;
- if (x + w <= pageWidth - rightMargin)
- {
- break;
- }
- l--;
- }
- String remainingText = null; // text spillin' to next print line
- if (l > 0 && l < text.length())
- {
- remainingText = text.substring(l);
- text = text.substring(0, l);
- }
- if (bPrintPage)
- g.drawString(text, x, y);
- text = remainingText; // still to print text spillin' over edge
- }
- // finished a print line, go to next
- y += textHeight;
- // done with this page (a new line height doesn't fit)?
- if (y + textHeight > pageHeight - bottomMargin)
- {
- if (bPrintPage)
- printer.endPage();
- startedPage = false;
- }
- }
- while (text != null); //end do
- }
-
- private void getColumnInfo(int scaleFactor)
- {
- // scale widths
- Table table = _viewer.getTable();
- if (table.getColumnCount() > 1)
- {
- _hasColumns = true;
- }
- else
- {
- _hasColumns = false;
- }
-
- if (_hasColumns)
- {
- _columnWidths = new int[table.getColumnCount()];
- _columnAlignments = new int[table.getColumnCount()];
-
- for (int i = 0; i < table.getColumnCount(); i++)
- {
- TableColumn column = table.getColumn(i);
- int width = column.getWidth();
- _columnWidths[i] = width / 9;
- _columnAlignments[i] = column.getAlignment();
- }
- }
- }
-
- private String getColumnHeader()
- {
- StringBuffer sbColumnHeader = new StringBuffer(""); //$NON-NLS-1$
- sbColumnHeader.append(getBlankLine());
-
- if (_hasColumns)
- {
- IPropertyDescriptor[] descriptors = _viewer.getVisibleDescriptors(_viewer.getInput());
- sbColumnHeader.insert(0, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL);
-
- int offset = _columnWidths[0];
- sbColumnHeader.insert(offset, " "); //$NON-NLS-1$
- offset++;
-
- for (int i = 0; i < descriptors.length; i++)
- {
- String label = descriptors[i].getDisplayName();
- int columnWidth = _columnWidths[i + 1];
- int labelWidth = label.length();
-
- if (_columnAlignments[i + 1] == SWT.LEFT)
- {
- if (labelWidth > columnWidth)
- {
- label = label.substring(0, columnWidth - 3);
- label += "..."; //$NON-NLS-1$
- }
- sbColumnHeader.insert(offset, label);
- }
- else
- {
-
- int rightOffset = offset + (columnWidth - labelWidth) - 1;
-
- if (rightOffset < offset)
- {
- int delta = (offset - rightOffset) - 3;
- label = label.substring(0, delta);
- label += "..."; //$NON-NLS-1$
- rightOffset = offset;
- }
-
- sbColumnHeader.insert(rightOffset, label);
- }
-
- offset += columnWidth;
- sbColumnHeader.insert(offset, " "); //$NON-NLS-1$
- offset++;
- }
- }
- return sbColumnHeader.toString();
- }
-
- private String getHeaderSeparator()
- {
- StringBuffer separator = new StringBuffer(""); //$NON-NLS-1$
- if (_hasColumns)
- {
- for (int i = 0; i < _columnWidths.length; i++)
- {
- int width = _columnWidths[i];
- for (int t = 0; t < width; t++)
- {
- separator.append("-"); //$NON-NLS-1$
- }
-
- separator.append(" "); //$NON-NLS-1$
- }
- }
-
- return separator.toString();
- }
-
- private String getTableFooter()
- {
- String footer = " * * * * * E N D O F L I S T I N G * * * * *"; //$NON-NLS-1$
- return footer;
- }
-
- private int getTotalWidth()
- {
- int totalWidth = 0;
- if (_hasColumns)
- {
- for (int i = 0; i < _columnWidths.length; i++)
- {
- totalWidth += _columnWidths[i];
- }
- }
- else
- {
- totalWidth = pageWidth;
- }
-
- return totalWidth;
- }
-
- private String getBlankLine()
- {
- StringBuffer blankLine = new StringBuffer();
-
- int totalWidth = getTotalWidth();
- for (int b = 0; b < totalWidth; b++)
- {
- blankLine.append(" "); //$NON-NLS-1$
- }
-
- return blankLine.toString();
- }
-
- private String getLine(Object object, int numColumns)
- {
- StringBuffer line = new StringBuffer(""); //$NON-NLS-1$
-
- //SystemTableViewProvider lprovider = (SystemTableViewProvider) _viewer.getLabelProvider();
- SystemDecoratingLabelProvider lprovider = (SystemDecoratingLabelProvider)_viewer.getLabelProvider();
- if (_hasColumns)
- {
- line.append(getBlankLine());
- int offset = 0;
- for (int column = 0; column < numColumns; column++)
- {
- String columnText = lprovider.getColumnText(object, column);
- int labelWidth = columnText.length();
-
- int columnWidth = _columnWidths[column];
- if (_columnAlignments[column] == SWT.LEFT)
- {
- if (labelWidth > columnWidth)
- {
- columnText = columnText.substring(0, columnWidth - 3);
- columnText += "..."; //$NON-NLS-1$
- }
-
- line.insert(offset, columnText);
-
- }
- else
- {
- int rightOffset = offset + (columnWidth - labelWidth) - 1;
- if (rightOffset < offset)
- {
- int delta = (offset - rightOffset) + 3;
- columnText = columnText.substring(0, labelWidth - delta);
- columnText += "..."; //$NON-NLS-1$
- rightOffset = offset;
- }
-
- line.insert(rightOffset, columnText);
- }
-
- offset += columnWidth;
- line.insert(offset, " "); //$NON-NLS-1$
- offset++;
- }
- }
- else
- {
- String columnText = lprovider.getColumnText(object, 0);
- line.append(columnText);
- }
-
- return line.toString();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java
deleted file mode 100644
index 0d7e04c16..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * David Dykstal (IBM) - [231856] making dialog a bit wider
- *******************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Dialog for prompting the user to add / change an environment variable.
- */
-public class EnvironmentVariablesPromptDialog extends SystemPromptDialog implements ModifyListener {
-
-
- private Text nameTextField, valueTextField;
- private String name, value, invalidNameChars;
- private IRSESystemType systemType;
- private boolean change; // Is this dialog for add or change
- private String[] existingNames;
-
- /**
- * Constructor for EnvironmentVariablesPromptDialog.
- * @param shell the parent shell
- * @param title the title of the dialog
- */
- public EnvironmentVariablesPromptDialog(Shell shell, String title, IRSESystemType systemType, String invalidNameChars, String[] existingNames, boolean change) {
- super(shell, title);
- this.change = change;
- this.systemType = systemType;
- this.invalidNameChars = invalidNameChars;
- this.existingNames = existingNames;
- }
-
- /**
- * Constructor for EnvironmentVariablesPromptDialog.
- * @param shell the parent shell
- * @param title the dialog title
- * @param inputObject the object providing values for this dialog
- */
- public EnvironmentVariablesPromptDialog(Shell shell, String title, Object inputObject, String invalidNameChars, String[] existingNames, boolean change) {
- super(shell, title, inputObject);
- this.change = change;
- this.invalidNameChars = invalidNameChars;
- this.existingNames = existingNames;
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent) {
-
- Composite page = SystemWidgetHelpers.createComposite(parent, 2);
-
- // Prompt for name
- SystemWidgetHelpers.createLabel(page, SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_LABEL);
- nameTextField = SystemWidgetHelpers.createTextField(page, null);
- ((GridData)nameTextField.getLayoutData()).widthHint = 500; // hint of this size allows more message text to be displayed
- nameTextField.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_TOOLTIP);
- if (name != null && !name.trim().equals("")) //$NON-NLS-1$
- {
- nameTextField.setText(name);
- setInitialOKButtonEnabledState(true);
- }
- else
- {
- setInitialOKButtonEnabledState(false);
- }
- nameTextField.addModifyListener(this);
-
- // Prompt for value
- SystemWidgetHelpers.createLabel(page, SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_LABEL);
- valueTextField = SystemWidgetHelpers.createTextField(page, null);
- ((GridData)valueTextField.getLayoutData()).widthHint = 500;
- valueTextField.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_TOOLTIP);
- if (value != null)
- {
- valueTextField.setText(value);
- }
-
- if (!change)
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "envv0001"); //$NON-NLS-1$
- else
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "envv0002"); //$NON-NLS-1$
-
-
- // Set name and value limits for known system types
- if (systemType != null)
- {
- if (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID))
- {
- nameTextField.setTextLimit(128);
- valueTextField.setTextLimit(1024);
- }
- else if (systemType.isWindows())
- {
- nameTextField.setTextLimit(300);
- valueTextField.setTextLimit(1024);
- }
- }
-
- return parent;
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl() {
- return nameTextField;
- }
-
- /**
- * Get the environment varaible name entered in the dialog.
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Get the environment varaible value entered in the dialog.
- */
- public String getValue()
- {
- return value;
- }
-
- /**
- * Preset the name for the environment variable
- */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Preset the value for the environment variable
- */
- public void setValue(String value)
- {
- this.value = value;
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#processOK()
- */
- protected boolean processOK() {
- if (nameTextField.getText() != null && !nameTextField.getText().trim().equals("")) //$NON-NLS-1$
- {
- String nameStr;
- if (invalidNameChars != null && invalidNameChars.indexOf(' ') != -1)
- {
- nameStr = nameTextField.getText().trim();
- }
- else
- {
- nameStr = nameTextField.getText();
- }
-
- // dy: Change to use a String of invalid charactes supplied by the subsystem
- //if (nameStr.indexOf('=') > 0 || nameStr.indexOf(' ') > 0)
- if (invalidNameChars != null)
- {
- for (int i = 0; i < invalidNameChars.length(); i++)
- {
- if (nameStr.indexOf(invalidNameChars.charAt(i)) != -1)
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_INVALIDCHAR));
- nameTextField.setFocus();
- return false;
- }
- }
- }
-
- if (existingNames != null)
- {
- // Check if this one already exists
- for (int i = 0; i < existingNames.length; i++)
- {
- if (nameStr.equals(existingNames[i]))
- {
- if (!change || !nameStr.equals(name))
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE);
- msg.makeSubstitution(nameStr);
- setErrorMessage(msg);
- nameTextField.setFocus();
- return false;
- }
- }
- }
- }
-
- name = nameStr;
- value = valueTextField.getText();
- return true;
- }
- else
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_NONAME));
- nameTextField.setFocus();
- return false;
- }
- }
-
- /**
- * @see org.eclipse.swt.events.ModifyListener#modifyText(ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- if (nameTextField.getText().trim().equals("")) //$NON-NLS-1$
- {
- enableOkButton(false);
- }
- else
- {
- enableOkButton(true);
- }
-
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ICredentialsValidator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ICredentialsValidator.java
deleted file mode 100644
index a4ea9a35d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ICredentialsValidator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - Changed from ISignonValidator to generalize the concept and
- * remove the UI dependencies.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import org.eclipse.rse.core.subsystems.ICredentials;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-
-
-/**
- * Interface for providing a credentials validator. This will be used when
- * credentials are acquired or when they are about to be used. Can check
- * credentials for expiration or for validity.
- * <p>
- * Any context will need to be set in the implementations of this interface
- * prior to its validation.
- */
-public interface ICredentialsValidator {
-
- /**
- * Verify if credentials are valid.
- *
- * @param credentials The credentials to be validated.
- *
- * @return null if the credentials are valid, a SystemMessage describing the
- * type of problem if invalid.
- */
- public SystemMessage validate(ICredentials credentials);
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java
deleted file mode 100644
index b99223fcb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPasswordPromptDialog.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Suggested interface for a dialog used to prompt user for a password.
- */
-public interface ISystemPasswordPromptDialog
-{
- /**
- * Set modal vs modeless
- */
- public void setBlockOnOpen(boolean block);
- /**
- * Open the dialog
- */
- public int open();
- /**
- * Set the input System object in which the user is attempting to do a connect action.
- * This is used to query the system type, host name and userId to display to the user for
- * contextual information.
- * <p>
- * This must be called right after instantiating this dialog.
- */
- public void setSystemInput(IConnectorService systemObject);
- /**
- * Allow caller to determine if window was cancelled or not.
- */
- public boolean wasCancelled();
- /**
- * Call this to specify a validator for the userId. It will be called per keystroke.
- */
- public void setUserIdValidator(ISystemValidator v);
- /**
- * Call this to specify a validator for the password. It will be called per keystroke.
- */
- public void setPasswordValidator(ISystemValidator v);
- /**
- * Call this to specify a validator for the signon. It will be called when the OK button is pressed.
- */
- public void setSignonValidator(ICredentialsValidator v);
- /**
- * Call this to force the userId and password to uppercase
- */
- public void setForceToUpperCase(boolean force);
- /**
- * Call this to query the force-to-uppercase setting
- */
- public boolean getForceToUpperCase();
- /**
- * Return the userId entered by user
- */
- public String getUserId();
- /**
- * Return the password entered by user
- */
- public String getPassword();
- /**
- * Sets the password
- */
- public void setPassword(String password);
- /**
- * Preselect the save password checkbox. Default value is to not
- * select the save password checkbox.
- */
- public void setSavePassword(boolean save);
- /**
- * Return true if the user changed the user id
- */
- public boolean getIsUserIdChanged();
- /**
- * Return true if the user elected to make the changed user Id a permanent change.
- */
- public boolean getIsUserIdChangePermanent();
- /**
- * Return true if the user elected to save the password
- */
- public boolean getIsSavePassword();
- /**
- * Return the shell for this dialog
- */
- public Shell getShell();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java
deleted file mode 100644
index 0612638ff..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemPromptDialog.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Uwe Stieber} (Wind River) - API consistency.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-
-/**
- * Suggested interface for dialogs used in actions in remote system framework.
- */
-public interface ISystemPromptDialog {
- /**
- * For explicitly setting input object
- */
- public void setInputObject(Object inputObject);
-
- /**
- * For explicitly getting input object
- */
- public Object getInputObject();
-
- /**
- * For explicitly getting output object after dialog is dismissed. Set by the
- * dialog's processOK method.
- */
- public Object getOutputObject();
-
- /**
- * For explicitly setting output object after wizard is dismissed. Called in the
- * wizard's processFinish method, typically.
- */
- public void setOutputObject(Object outputObject);
-
- /**
- * Allow caller to determine if window was cancelled or not.
- */
- public boolean wasCancelled();
-
- /**
- * Expose inherited protected method convertWidthInCharsToPixels as a publicly
- * excessible method
- */
- public int publicConvertWidthInCharsToPixels(int chars);
-
- /**
- * Expose inherited protected method convertHeightInCharsToPixels as a publicly
- * excessible method
- */
- public int publicConvertHeightInCharsToPixels(int chars);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java
deleted file mode 100644
index 8a86b0cb2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/ISystemTypedObject.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * The re-usable rename and delete dialogs in RSE require the objects to be adaptable to
- * ISystemViewElementAdapter, in order to show the object's type in the dialog. If you
- * want to re-use these dialogs for inputs that do not adapt to ISystemViewElementAdapter,
- * then ensure your input objects implement this interface.
- */
-public interface ISystemTypedObject
-{
- /**
- * Return the name of the object.
- */
- public String getName();
- /**
- * Return the type of the object. This is a displayable string, used to tell the user
- * what type of resource this is.
- */
- public String getType();
- /**
- * Returns an image descriptor for the image to represent this object. More efficient than getting the image.
- */
- public ImageDescriptor getImageDescriptor();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemChangePasswordDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemChangePasswordDialog.java
deleted file mode 100644
index 7448d121d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemChangePasswordDialog.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.swt.widgets.Text;
-
-/**
- * A SystemChangePasswordDialog is typically presented when the password on the remote system has expired
- * and a new one needs to be saved. This dialog presents presents two enabled text fields - the first holds
- * the new password, the second holds its confirmation.
- * There is also a checkbox to save the password. Actually saving the password is the responsibility of the client.
- */
-public class SystemChangePasswordDialog extends SystemPromptDialog
-{
- private String _hostname;
- private String _user;
- private String _oldPassword = ""; //$NON-NLS-1$
- private String _newPassword = ""; //$NON-NLS-1$
-
- private Text _txtOldPassword;
- private Text _txtNewPassword;
- private Text _txtConfirmPassword;
-
- private boolean savePassword = false;
- protected Button _chkBoxSavePassword;
-
- private boolean newPasswordModified = false;
- private boolean confirmModified = false;
-
- private boolean _promptForOldPassword = false;
-
- /**
- * Construct a new SystemChangePasswordDialog. Since this dialog is asking for a new password
- * there is no need to supply the old password, however a remote system will usually require
- * the old password to effect a change. Thus clients of this class would typically be expected
- * to have this available.
- * @param shell The shell the dialog will use to present itself.
- * @param hostname The remote host name.
- * @param userid The user id that will be presented. May be the empty string.
- * @param msg The message that will be presented when the dialog is initially shown. This may be null.
- */
- public SystemChangePasswordDialog(Shell shell, String hostname, String userid, SystemMessage msg)
- {
- super(shell, SystemResources.RESID_CHANGE_PASSWORD_TITLE, false);
- _hostname = hostname;
- _user = userid;
- setErrorMessage(msg);
- }
-
- public void promptForOldPassword(boolean flag)
- {
- _promptForOldPassword = flag;
- }
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- if (_promptForOldPassword)
- {
- return _txtOldPassword;
- }
- return _txtNewPassword;
- }
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent) {
-
- Label label = null;
- Composite c = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- c.setLayout(layout);
-
- // Host Name
- label = new Label(c, SWT.NONE);
- label.setText(SystemResources.RESID_PREF_SIGNON_HOSTNAME_LABEL);
-
- Text system = SystemWidgetHelpers.createTextField(c, null);
- system.setText(_hostname);
- system.setEditable(false);
- system.setEnabled(false);
- system.setToolTipText(SystemResources.RESID_PREF_SIGNON_HOSTNAME_TOOLTIP);
- ((GridData) system.getLayoutData()).widthHint = 75;
-
- // User ID
- label = new Label(c, SWT.NONE);
- label.setText(SystemResources.RESID_PREF_SIGNON_USERID_LABEL);
-
- Text userID = SystemWidgetHelpers.createTextField(c, null);
- userID.setText(_user);
- userID.setEditable(false);
- userID.setEnabled(false);
- userID.setToolTipText(SystemResources.RESID_PREF_SIGNON_USERID_TOOLTIP);
- ((GridData) userID.getLayoutData()).widthHint = 75;
-
- if (_promptForOldPassword)
- {
- // Old password
- label = new Label(c, SWT.NONE);
- label.setText(SystemResources.RESID_CHANGE_PASSWORD_OLD_LABEL);
- _txtOldPassword = SystemWidgetHelpers.createTextField(c, null);
- _txtOldPassword.setEchoChar('*');
- _txtOldPassword.setToolTipText(SystemResources.RESID_CHANGE_PASSWORD_OLD_TOOLTIP);
- ((GridData) _txtOldPassword.getLayoutData()).widthHint = 75;
- }
-
- // New password
- label = new Label(c, SWT.NONE);
- label.setText(SystemResources.RESID_CHANGE_PASSWORD_NEW_LABEL);
- _txtNewPassword = SystemWidgetHelpers.createTextField(c, null);
- _txtNewPassword.setEchoChar('*');
- _txtNewPassword.setToolTipText(SystemResources.RESID_CHANGE_PASSWORD_NEW_TOOLTIP);
- ((GridData) _txtNewPassword.getLayoutData()).widthHint = 75;
-
- // Confirm new password
- label = new Label(c, SWT.NONE);
- label.setText(SystemResources.RESID_CHANGE_PASSWORD_CONFIRM_LABEL);
- _txtConfirmPassword = SystemWidgetHelpers.createTextField(c, null);
- _txtConfirmPassword.setEchoChar('*');
- _txtConfirmPassword.setToolTipText(SystemResources.RESID_CHANGE_PASSWORD_CONFIRM_TOOLTIP);
- ((GridData) _txtConfirmPassword.getLayoutData()).widthHint = 75;
-
- // Save signon information checkbox
- // DY: align password checkbox with entry fields
- _chkBoxSavePassword = SystemWidgetHelpers.createCheckBox(
- c, 1, this, SystemResources.RESID_PASSWORD_SAVE_LABEL, SystemResources.RESID_PASSWORD_SAVE_TOOLTIP);
- _chkBoxSavePassword.setSelection(savePassword);
- // disable until the user enters something for consistency with the save user ID checkbox
- _chkBoxSavePassword.setEnabled(false);
-
- _txtNewPassword.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- newPasswordModified = true;
- validatePasswordInput();
- }
- }
- );
-
- _txtConfirmPassword.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- confirmModified = true;
- validatePasswordInput();
- }
- }
- );
- setInitialOKButtonEnabledState(false);
-
- return parent;
- }
-
- /**
- * Return true if the user elected to save the password
- */
- private boolean internalGetIsSavePassword()
- {
- savePassword = _chkBoxSavePassword.getSelection();
- return savePassword;
- }
-
- /**
- * This hook method is called whenever the text changes in the password input fields.
- */
- protected SystemMessage validatePasswordInput()
- {
- clearErrorMessage();
- _chkBoxSavePassword.setEnabled(newPasswordModified || confirmModified);
- if (!newPasswordModified || !confirmModified) return null;
- okButton.setEnabled(true);
-
- String newPassword = _txtNewPassword.getText().trim();
- String confirmPassword = _txtConfirmPassword.getText().trim();
-
- if (_promptForOldPassword)
- {
- _oldPassword = _txtOldPassword.getText().trim();
- }
-
- if (!newPassword.equals(confirmPassword))
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_MISMATCH);
- }
- else if (newPassword.equals("")) //$NON-NLS-1$
- {
- return RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD);
- }
- _newPassword = newPassword;
- return null;
- }
-
- /**
- * @see SystemPromptDialog#processOK()
- */
- protected boolean processOK()
- {
- savePassword = internalGetIsSavePassword();
- SystemMessage error = validatePasswordInput();
- if (error == null) return true;
- else setErrorMessage(error);
- return false;
- }
-
- /**
- * @return The old password set by the user or null if the
- * cancel button was pressed or if no old password prompt is displayed.
- */
- public String getOldPassword()
- {
- return _oldPassword;
- }
-
- /**
- * @return The new password set by the user or null if the
- * cancel button was pressed.
- */
- public String getNewPassword()
- {
- return _newPassword;
- }
-
- /**
- * Return true if the user elected to make the changed user Id a permanent change.
- */
- public boolean getIsSavePassword()
- {
- return savePassword;
- }
-
- /**
- * Preselect the save password checkbox. Default value is to not
- * select the save password checkbox.
- */
- public void setSavePassword(boolean save)
- {
- savePassword = save;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java
deleted file mode 100644
index 28a84f5a6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- * David Dykstal (IBM) - [232066] Adjusted width of dialog for translation
- *******************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import java.util.List;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.PasswordPersistenceManager;
-import org.eclipse.rse.core.model.SystemSignonInformation;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * SystemPasswordPersistencePrompt is used with the save password preference page
- * to prompt the user to add or change password information.
- */
-public final class SystemPasswordPersistencePrompt extends SystemPromptDialog implements ModifyListener
-{
-
-
-
- private Text hostname, userid, password, passwordVerify;
- private Combo systemType;
- private IRSESystemType[] systemTypes;
- private SystemSignonInformation signonInfo;
- private boolean change;
- private String originalHostname, originalUserid;
- private IRSESystemType originalSystemType;
-
- private List existingEntries;
-
- /**
- * Constructor for SystemPasswordPersistencePrompt.
- * @param shell the parent shell
- * @param title the dialog title
- */
- public SystemPasswordPersistencePrompt(Shell shell, String title, List existingEntries, boolean change) {
- super(shell, title);
- this.change = change;
- this.existingEntries = existingEntries;
- setInitialOKButtonEnabledState(false);
- }
-
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent) {
-
- Composite page = SystemWidgetHelpers.createComposite(parent, 2);
- Layout parentLayout = parent.getLayout();
- if (parentLayout instanceof GridLayout) {
- GridData gd = new GridData(SWT.BEGINNING, SWT.TOP, true, true);
- gd.widthHint = 400;
- page.setLayoutData(gd);
- }
-
- // Hostname prompt
- SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_HOSTNAME_LABEL);
- hostname = SystemWidgetHelpers.createTextField(page, null, SystemResources.RESID_PREF_SIGNON_HOSTNAME_TOOLTIP);
- if (originalHostname != null)
- hostname.setText(originalHostname);
- hostname.addModifyListener(this);
-
- // System type prompt
- systemTypes = PasswordPersistenceManager.getInstance().getRegisteredSystemTypes();
- String[] systemTypeLabels = new String[systemTypes.length];
- for (int i=0; i<systemTypes.length; i++) {
- systemTypeLabels[i] = systemTypes[i].getLabel();
- }
- SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_SYSTYPE_LABEL, SystemResources.RESID_PREF_SIGNON_SYSTYPE_TOOLTIP);
- systemType = SystemWidgetHelpers.createReadonlyCombo(page, null);
- systemType.setItems(systemTypeLabels);
- if (originalSystemType != null)
- systemType.setText(originalSystemType.getLabel());
- systemType.addModifyListener(this);
-
- // User ID prompt
- SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_USERID_LABEL);
- userid = SystemWidgetHelpers.createTextField(page, null, SystemResources.RESID_PREF_SIGNON_USERID_TOOLTIP);
- if (originalUserid != null)
- userid.setText(originalUserid);
- userid.addModifyListener(this);
-
- // Password prompt
- SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_PASSWORD_LABEL);
- password = SystemWidgetHelpers.createTextField(page, null, SystemResources.RESID_PREF_SIGNON_PASSWORD_TOOLTIP);
- password.setEchoChar('*');
- password.addModifyListener(this);
-
- // Confirm password prompt
- SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_PASSWORD_VERIFY_LABEL);
- passwordVerify = SystemWidgetHelpers.createTextField(page, null,SystemResources.RESID_PREF_SIGNON_PASSWORD_VERIFY_TOOLTIP);
- passwordVerify.setEchoChar('*');
- passwordVerify.addModifyListener(this);
-
- return page;
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl() {
- return hostname;
- }
-
- public SystemSignonInformation getSignonInformation() {
- return signonInfo;
- }
-
- /**
- * @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#processOK()
- */
- protected boolean processOK() {
- // Check for blank fields
- String sHostName = hostname.getText();
- if (sHostName == null || sHostName.trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- okButton.setEnabled(false);
- hostname.setFocus();
- return false;
- }
-
- int systemTypeIndex = systemType.getSelectionIndex();
- if (systemTypeIndex<0)
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- okButton.setEnabled(false);
- systemType.setFocus();
- return false;
- }
-
- String sUserID = userid.getText();
- if (sUserID == null || sUserID.trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- okButton.setEnabled(false);
- userid.setFocus();
- return false;
- }
-
- String sPwd1 = password.getText();
- if (sPwd1 == null || sPwd1.trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- okButton.setEnabled(false);
- password.setFocus();
- return false;
- }
-
- String sPwd2 = passwordVerify.getText();
- if (sPwd2 == null || sPwd2.trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- okButton.setEnabled(false);
- passwordVerify.setFocus();
- return false;
- }
-
- // Check if new and verify passwords match
- if (!sPwd1.equals(sPwd2))
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_MISMATCH));
- okButton.setEnabled(false);
- password.setFocus();
- password.setSelection(0, sPwd1.length());
- return false;
- }
-
- IRSESystemType systemType = systemTypes[systemTypeIndex];
- signonInfo = new SystemSignonInformation(hostname.getText(), userid.getText(), password.getText(), systemType);
-
- if (change)
- {
- if (exists(signonInfo.getHostname(), signonInfo.getUserId(), signonInfo.getSystemType()))
- {
- if (!signonInfo.getSystemType().equals(originalSystemType) ||
- !signonInfo.getHostname().equalsIgnoreCase(originalHostname) ||
- //!signonInfo.getHostname().equalsIgnoreCase(RSEUIPlugin.getQualifiedHostName(originalHostname)) ||
- !signonInfo.getUserId().equals(originalUserid))
- {
- // User changed hostname, systemtype or userid and the change conflicts with an existing entry
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_EXISTS);
- msg.makeSubstitution(sUserID, sHostName);
- setErrorMessage(msg);
- okButton.setEnabled(false);
- hostname.setFocus();
- return false;
- }
- }
- }
- else
- {
- // Adding a new entry, make sure it doesn't already exist
- if (exists(signonInfo.getHostname(), signonInfo.getUserId(), signonInfo.getSystemType()))
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_EXISTS);
- msg.makeSubstitution(sUserID, sHostName);
- setErrorMessage(msg);
- okButton.setEnabled(false);
- hostname.setFocus();
- return false;
- }
- }
-
- return super.processOK();
- }
-
- /**
- * Check if a password is already saved for the given hostname, user ID and system type
- */
- private boolean exists(String hostname, String userID, IRSESystemType systemType)
- {
- SystemSignonInformation info;
- PasswordPersistenceManager manager = PasswordPersistenceManager.getInstance();
- boolean found = false;
-
- for (int i = 0; !found && i < existingEntries.size(); i++)
- {
- info = (SystemSignonInformation) existingEntries.get(i);
- if (hostname.equalsIgnoreCase(info.getHostname()) &&
- systemType.equals(info.getSystemType()))
- {
- if (!manager.isUserIDCaseSensitive(info.getSystemType()))
- {
- found = userID.equalsIgnoreCase(info.getUserId());
- }
- else
- {
- found = userID.equals(info.getUserId());
- }
- }
- }
-
- return found;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- super.createControl(parent);
- if (change)
- {
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "pwdi0002"); //$NON-NLS-1$
- password.setFocus();
- }
- else
- {
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "pwdi0001"); //$NON-NLS-1$
- hostname.setFocus();
- }
- }
-
- /**
- * Set the input data to prepopulate the change dialog
- */
- public void setInputData(IRSESystemType systemtype, String hostname, String userid)
- {
- originalSystemType = systemtype;
- originalHostname = hostname;
- originalUserid = userid;
- }
- /**
- * @see org.eclipse.swt.events.ModifyListener#modifyText(ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- if (e.getSource() == hostname && hostname.getText().trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- hostname.setFocus();
- okButton.setEnabled(false);
- }
- else if (e.getSource() == userid && userid.getText().trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- userid.setFocus();
- okButton.setEnabled(false);
- }
- else if (e.getSource() == systemType && systemType.getText().trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- systemType.setFocus();
- okButton.setEnabled(false);
- }
- else if (e.getSource() == password && password.getText().trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- password.setFocus();
- okButton.setEnabled(false);
- }
- else if (e.getSource() == passwordVerify && passwordVerify.getText().trim().equals("")) //$NON-NLS-1$
- {
- setErrorMessage(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD));
- passwordVerify.setFocus();
- okButton.setEnabled(false);
- }
- else
- {
- clearErrorMessage();
-
- if (hostname.getText().trim().equals("") || //$NON-NLS-1$
- userid.getText().trim().equals("") || //$NON-NLS-1$
- systemType.getText().trim().equals("") || //$NON-NLS-1$
- password.getText().trim().equals("") || //$NON-NLS-1$
- passwordVerify.getText().trim().equals("")) //$NON-NLS-1$
- {
- // clear error messages but button stays disabled
- okButton.setEnabled(false);
- }
- else
- {
- okButton.setEnabled(true);
- }
- }
-
- }
-
- /**
- * @see org.eclipse.jface.window.Window#open()
- */
- public int open()
- {
- return super.open();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java
deleted file mode 100644
index 78aeab584..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * David Dykstal (IBM) - [210474] Deny save password function missing
- * David Dykstal (IBM) - [210242] Credentials dialog should look different if password is not supported or optional
- * Richie Yu (IBM) - [241716] Handle change expired password
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSEPreferencesManager;
-import org.eclipse.rse.core.model.SystemSignonInformation;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ICredentials;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.swt.widgets.Text;
-
-/**
- * Prompt user for password.
- * This class is final due to the sensitive nature of the
- * information being prompted for.
- */
-public final class SystemPasswordPromptDialog extends SystemPromptDialog implements ISystemPasswordPromptDialog {
-
-// labels are not as big as text fields so we need to set the height for the system type
-// and hostname labels so they are equally spaced with the user ID and password entry fields
-// private static final int LABEL_HEIGHT = 17;
-
- private Text textPassword;
- private Text textUserId;
- private Button userIdPermanentCB;
- private Button savePasswordCB;
- private String originalUserId;
- private String userId;
- private String password;
- private boolean userIdPermanent = false;
- private boolean savePassword = false;
- private boolean forceToUpperCase;
- private boolean userIdChanged = false;
- private boolean validate = true;
- private boolean requiresPassword;
- private boolean requiresUserId;
- private ISystemValidator userIdValidator;
- private ISystemValidator passwordValidator;
- private ICredentialsValidator signonValidator;
- private IConnectorService connectorService = null;
-
- /**
- * Constructor for SystemPasswordPromptDialog
- * @param shell The shell in which to base this dialog.
- * @param requiresUserId true if the userid field of the dialog must not be empty.
- * Used only if there is no validator specified for
- * {@link #setUserIdValidator(ISystemValidator)}.
- * @param requiresPassword true if the password field of the dialog must not be empty.
- * Used only if there is no password validator specified using
- * {@link #setPasswordValidator(ISystemValidator)}.
- */
- public SystemPasswordPromptDialog(Shell shell, boolean requiresUserId, boolean requiresPassword) {
- super(shell, SystemResources.RESID_PASSWORD_TITLE);
- setHelp(RSEUIPlugin.HELPPREFIX + "pwdp0000"); //$NON-NLS-1$
- this.requiresPassword = requiresPassword;
- this.requiresUserId = requiresUserId;
- }
-
- /**
- * Set the connector service from which the user is attempting to do a connect action.
- * This is used to query the system type, host name and user id to display to the user for
- * contextual information.
- * <p>
- * This must be called prior to opening this dialog.
- * @param connectorService the connector service associated with this dialog
- */
- public void setSystemInput(IConnectorService connectorService) {
- this.connectorService = connectorService;
- }
-
- /**
- * Sets the validator for the userId. If not null it will be called per keystroke.
- * <p>
- * This must be called prior to opening this dialog if something other than the default is needed.
- * @param v a validator
- */
- public void setUserIdValidator(ISystemValidator v) {
- userIdValidator = v;
- }
-
- /**
- * Sets the validator for the password. If not null it will be called per keystroke.
- * The default validator is null.
- * <p>
- * This must be called prior to opening this dialog if something other than the default is needed.
- * @param v a validator
- */
- public void setPasswordValidator(ISystemValidator v) {
- passwordValidator = v;
- }
-
- /**
- * Sets the validator for the signon.
- * The default validator is null.
- * If not null the validator will be called when the user presses OK.
- * <p>
- * This must be called prior to opening this dialog if something other than the default is needed.
- * @param v a signon validator
- */
- public void setSignonValidator(ICredentialsValidator v) {
- signonValidator = v;
- }
-
- /**
- * Sets the option to force the userId and password to uppercase. This use should be rare.
- * Use this with caution.
- * <p>
- * The default is false.
- * This must be called prior to opening this dialog if something other than the default is needed.
- * @param force true if the user id and password are to be forced to uppercase
- */
- public void setForceToUpperCase(boolean force) {
- this.forceToUpperCase = force;
- }
-
- /**
- * Call this to query the force-to-uppercase setting
- * @return the setting for forcing the user id and password to upper case
- */
- public boolean getForceToUpperCase() {
- return forceToUpperCase;
- }
-
- /**
- * Creates the dialog controls.
- * @param parent the containing composite control in which our controls will be created. It is assumed
- * to have a grid layout.
- * @return the composite control we create that nests inside the parent
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent) {
-
- // top level composite
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(composite, 2);
-
- // yantzi: artemis 6.0, at request of zOS team I am changing the system type and hostname
- // to labels so they are clearer to read than non-editable entry fields
-
- // dwd: cannot set height hints on labels since that causes cut off text for large fonts used by those with impaired vision
-
- // System type
- String text = SystemWidgetHelpers.appendColon(SystemResources.RESID_PASSWORD_SYSTEMTYPE_LABEL);
- Label label = SystemWidgetHelpers.createLabel(composite_prompts, text);
- GridData gd = new GridData();
- label.setLayoutData(gd);
- label = SystemWidgetHelpers.createLabel(composite_prompts, connectorService.getHost().getSystemType().getLabel());
- gd = new GridData();
- label.setLayoutData(gd);
-
- // Host name
- text = SystemWidgetHelpers.appendColon(SystemResources.RESID_PASSWORD_HOSTNAME_LABEL);
- label = SystemWidgetHelpers.createLabel(composite_prompts, text);
- gd = new GridData();
- label.setLayoutData(gd);
- label = SystemWidgetHelpers.createLabel(composite_prompts, connectorService.getHostName());
- gd = new GridData();
- label.setLayoutData(gd);
-
- // UserId
- if (connectorService.supportsUserId()) {
- textUserId = SystemWidgetHelpers.createLabeledTextField(composite_prompts, this, SystemResources.RESID_PASSWORD_USERID_LABEL, SystemResources.RESID_PASSWORD_USERID_TIP);
- }
-
- // Password prompt
- if (connectorService.supportsPassword()) {
- String passwordLabel = SystemResources.RESID_PASSWORD_LABEL_OPTIONAL;
- if (connectorService.requiresPassword()) {
- passwordLabel = SystemResources.RESID_PASSWORD_LABEL;
- }
- textPassword = SystemWidgetHelpers.createLabeledTextField(composite_prompts, this, passwordLabel, SystemResources.RESID_PASSWORD_TIP);
- textPassword.setEchoChar('*');
- }
-
- // UserId_make_permanent checkbox
- // DY: align user ID checkbox with entry fields
- // yantzi:5.1 move checkboxes to be below entry fields
- if (connectorService.supportsUserId()) {
- SystemWidgetHelpers.createLabel(composite_prompts, ""); //$NON-NLS-1$
- userIdPermanentCB = SystemWidgetHelpers.createCheckBox(composite_prompts, 1, this, SystemResources.RESID_PASSWORD_USERID_ISPERMANENT_LABEL,
- SystemResources.RESID_PASSWORD_USERID_ISPERMANENT_TIP);
- userIdPermanentCB.setEnabled(false);
- }
-
- // Save signon information checkbox
- // DY: align password checkbox with entry fields
- if (connectorService.supportsPassword() && !connectorService.getDenyPasswordSave()) {
- SystemWidgetHelpers.createLabel(composite_prompts, ""); //$NON-NLS-1$
- savePasswordCB = SystemWidgetHelpers.createCheckBox(composite_prompts, 1, this, SystemResources.RESID_PASSWORD_SAVE_LABEL, SystemResources.RESID_PASSWORD_SAVE_TOOLTIP);
- savePasswordCB.setSelection(savePassword);
- }
-
- initializeInput();
-
- // add keystroke listeners...
- if (textUserId != null) {
- textUserId.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- processUserIdField();
- }
- });
- }
- if (textPassword != null) {
- textPassword.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- processPasswordField();
- }
- });
- }
-
- return composite;
- }
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl() {
- okButton.setEnabled(true);
- processUserIdField();
- if (textUserId != null) {
- if (userId.length() == 0 || textPassword == null) {
- return textUserId;
- }
- }
- if (textPassword != null) {
- textPassword.selectAll();
- return textPassword;
- }
- if (okButton.isEnabled()) return okButton;
- return cancelButton;
- }
-
- /**
- * Initialize values using input data
- */
- private void initializeInput() {
- originalUserId = connectorService.getUserId();
- userId = originalUserId;
- if (connectorService.supportsUserId() && (userId == null || userId.length() == 0)) {
- userId = RSEPreferencesManager.getUserId(connectorService.getHost().getSystemType().getId());
- }
- if (textUserId != null && userId != null) {
- textUserId.setText(userId);
- textUserId.setSelection(0, userId.length());
- }
- if (textPassword != null && password != null) {
- textPassword.setText(password);
- textPassword.setSelection(0, password.length());
- }
- }
-
- /**
- * Retrieves the userId entered by user
- */
- private void internalGetUserId() {
- if (textUserId != null) {
- userId = textUserId.getText().trim();
- }
- }
-
- /**
- * Retrieves the password entered by user
- */
- private void internalGetPassword() {
- if (textPassword != null) {
- password = textPassword.getText().trim();
- }
- }
-
- /**
- * Retrieves the value of the "save user id" checkbox
- */
- private void internalGetIsUserIdChangePermanent() {
- if (userIdPermanentCB != null) {
- userIdPermanent = userIdPermanentCB.isEnabled() && userIdPermanentCB.getSelection();
- }
- }
-
- /**
- * Retrieves the value of the "save password" checkbox
- */
- private void internalGetIsSavePassword() {
- if (savePasswordCB != null) {
- savePassword = savePasswordCB.isEnabled() && savePasswordCB.getSelection();
- }
- }
-
- /**
- * This method is called whenever the text changes in the user id input field.
- * Checks the user id field and if there are no errors, other fields on the dialog.
- * If an error was reported it is displayed on the message line.
- * @see #setUserIdValidator(ISystemValidator)
- */
- private void processUserIdField() {
- clearErrorMessage();
- SystemMessage m = checkUserId();
- if (m == null) {
- m = checkPassword();
- }
- if (m != null) {
- setErrorMessage(m);
- }
- okButton.setEnabled(m == null);
- if (userId == null || originalUserId == null) {
- userIdChanged = (userId != originalUserId);
- } else {
- userIdChanged = !userId.equals(originalUserId);
- }
- if (userIdPermanentCB != null) {
- userIdPermanentCB.setEnabled(userIdChanged);
- }
- }
-
- /**
- * Performs the actual validation check for the user id.
- * Delegates the request to an <code>ISystemValidator</code> object.
- * @return the message returned by the validator or null.
- */
- private SystemMessage checkUserId() {
- internalGetUserId();
- SystemMessage m = null;
- if (connectorService.supportsUserId() && validate) {
- if (userIdValidator != null) {
- m = userIdValidator.validate(userId);
- } else if (requiresUserId && userId.length() == 0) {
- m = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
- }
- }
- return m;
- }
-
- /**
- * This method is called whenever the text changes in the password input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- * @see #setPasswordValidator(ISystemValidator)
- */
- private void processPasswordField() {
- clearErrorMessage();
- SystemMessage m = checkPassword();
- if (m == null) {
- m = checkUserId();
- }
- if (m != null) {
- setErrorMessage(m);
- }
- okButton.setEnabled(m == null);
- if (savePasswordCB != null) {
- savePasswordCB.setEnabled(!(requiresPassword && password.length() == 0));
- }
- }
-
- /**
- * Checks the value of the password instance variable.
- */
- private SystemMessage checkPassword() {
- internalGetPassword();
- SystemMessage m = null;
- if (connectorService.supportsPassword() && validate) {
- if (passwordValidator != null) {
- m = passwordValidator.validate(password);
- } else if (requiresPassword && password.length() == 0) {
- m = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PASSWORD_EMPTY);
- }
- }
- return m;
- }
-
- /**
- * @return the userId entered by user
- */
- public String getUserId() {
- return userId;
- }
-
- /**
- * @return the password may have been modified by the user.
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * Sets the password, may be null if no password is available.
- * @param password the password to provide for the password field.
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
- /**
- * @return true if the user changed the user id
- */
- public boolean getIsUserIdChanged() {
- return userIdChanged;
- }
-
- /**
- * @return true if the user elected to make the changed user Id a permanent change.
- */
- public boolean getIsUserIdChangePermanent() {
- return userIdPermanent;
- }
-
- /**
- * @return true if the user elected to make the changed user Id a permanent change.
- */
- public boolean getIsSavePassword() {
- return savePassword;
- }
-
- /**
- * Preselect the save password checkbox. Default value is to not
- * select the save password checkbox.
- * @param save true if the save password box should be checked.
- */
- public void setSavePassword(boolean save) {
- savePassword = save;
- }
-
- /**
- * Verifies all input. Sets the error message if there are any conditions that are found.
- */
- private void verify() {
- Control controlInError = null;
- processUserIdField();
- if (getErrorMessage() != null) {
- controlInError = textUserId;
- } else {
- processPasswordField();
- if (getErrorMessage() != null) {
- controlInError = textPassword;
- }
- }
- if (controlInError != null) {
- controlInError.setFocus(); // validate methods already displayed error message
- }
- }
-
- /**
- * Called when user presses OK button.
- * @return true to close dialog, false to not close dialog.
- */
- protected boolean processOK() {
- setBusyCursor(true);
- internalGetPassword();
- internalGetUserId();
- internalGetIsUserIdChangePermanent();
- internalGetIsSavePassword();
- if (forceToUpperCase) {
- userId = userId.toUpperCase();
- password = password.toUpperCase();
- validate = false;
- textUserId.setText(userId);
- textPassword.setText(password);
- validate = true;
- }
-
- verify();
- setBusyCursor(false); // phil
-
- // If all inputs are OK then validate signon
- if (getErrorMessage() == null && (signonValidator != null)) {
- String hostName = connectorService.getHostName();
- IRSESystemType systemType = connectorService.getHost().getSystemType();
- ICredentials credentials = new SystemSignonInformation(hostName, userId, password, systemType);
- SystemMessage m = signonValidator.validate(credentials);
- // update the password in case an expired password was changed in validate - ry
- password = credentials.getPassword();
- setErrorMessage(m);
- }
- boolean closeDialog = (getErrorMessage() == null);
- return closeDialog;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java
deleted file mode 100644
index a268db818..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPromptDialog.java
+++ /dev/null
@@ -1,1849 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - API consistency.
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.wizard.ProgressMonitorPart;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.SystemControlEnableState;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.messages.SystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Cursor;
-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.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Base dialog class. Use this whenever more than a simple string
- * prompt is needed (which InputDialog gives you).
- * <p>
- * By default we configure the dialog as modal. If you do not want this,
- * call setBlockOnOpen(false) after instantiating.
- * <p>
- * This base class offers the following ease-of-use features:
- * <ul>
- * <li>automatic support for typical buttons OK, Browse and Cancel.
- * <ul>
- * <li>just override the processOk, processBrowse and processCancel methods to process them
- * <li>constructor option whether to enable Browse or not
- * <li>ability to override default labels for all three.
- * </ul>
- * <li>automatic support for a message line
- * <ul>
- * <li>can turn it off
- * <li>methods for writing messages to the message line
- * </ul>
- * <li>override just one method (<b>createInner</b>) to populate the client area
- * <li>support for automatically assigning unique mnemonics to all buttons
- * <ul>
- * <li>easier to code, easier to translate
- * <li>this is always done for you, so do not put your own mnemonics in your button text!
- * </ul>
- * <li>support for an input object for change mode vs "new" mode:
- * <ul>
- * <li>in change mode, callers pass this in via ctor or setInputObject method
- * <li>in your child class, get it via inherited getInputObject and cast to what it is you are expecting
- * </ul>
- * <li>support for output object:
- * <ul>
- * <li>when ok pressed, built up the output object and then call inherited setOutputObject object method
- * <li>dialog callers can then retrieve it via getOuputObject method.
- * </ul>
- * <li>support for {@link #wasCancelled()} method so callers can easily determine how user exited the dialog
- * <li>special affinity if you use an imbedded WorkWith widget:
- * <ul>
- * <li>call WorkWith's setPromptDialog(this) method to tell it the parent dialog is a PromptDialog
- * <li>WorkWith widget will use PromptDialog's message line vs its own
- * <li>WorkWith widget will know how to reassign mnemonics for its buttons when style is switched.
- * </ul>
- * <li>optional support (mri) for additional buttons (which your code handles):
- * <ul>
- * <li>Add
- * <li>Browse
- * <li>Test
- * <li>Details>>
- * </ul>
- * <li>optional support for a built-in progress monitor just like wizards have. Call {@link #setNeedsProgressMonitor(boolean)}
- * <li>a simple {@link #setBusyCursor(boolean)} method to toggle the cursor between busy and normal
- * </ul>
- *
- * <p>To use this class: </p>
- * <ol>
- * <li>Subclass it, specifying the dialog title in the constructor. Optionally, also call {@link #setHelp(String)} to set the dialog's help in the constructor.
- * <li>Override {@link #createInner(Composite)} to populate the contents
- * <li>Override {@link #processOK()} to process the pressing of the OK button
- * </ol>
- * <p>For error checking, add modify listeners to entry fields and if needed selection listeners to buttons, then in your event handler </p>
- * <ol>
- * <li>Call {@link #setErrorMessage(SystemMessage)} to display an error if detected. Pass null to clear previous error.
- * <li>Call {@link #setPageComplete(boolean)} with true if there are no errors and all required data is supplied. This enables/disables OK.
- * <li>The same two error-reporting strategies described in {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage} apply here.
- * </ol>
- */
-public abstract class SystemPromptDialog
- extends org.eclipse.jface.dialogs.Dialog
- implements Listener, ISystemPromptDialog,
- ISystemMessageLine, org.eclipse.jface.dialogs.IDialogPage, IRunnableContext, Runnable
-{
-
- protected boolean okPressed = false;
- protected boolean cancelAllPressed = false;
- protected boolean showBrowseButton = false;
- protected boolean showTestButton = false;
- protected boolean showAddButton = false;
- protected boolean showDetailsButton = false;
- protected boolean pack = false;
- protected boolean initialOKButtonEnabledState = true;
- protected boolean initialAddButtonEnabledState = false;
- protected boolean initialDetailsButtonEnabledState = true;
- protected boolean detailsButtonHideMode = false;
- protected boolean showOkButton = true;
- protected boolean showCancelAllButton = false;
- protected Shell overallShell = null;
- protected Composite parentComposite, dialogAreaComposite;
- protected Composite buttonsComposite;
- protected Button okButton, cancelButton, cancelAllButton, testButton, browseButton, addButton, detailsButton;
- protected String title, labelOk, labelBrowse, labelTest, labelCancel, labelCancelAll, labelAdd, labelDetailsShow, labelDetailsHide;
- protected String tipOk, tipBrowse, tipTest, tipCancel, tipCancelAll, tipAdd, tipDetailsShow, tipDetailsHide;
- protected boolean noShowAgainOption;
- protected Button noShowAgainButton;
- protected String detailsShowLabel;
- protected String detailsHideLabel;
- protected String helpId;
- //protected Hashtable helpIdPerControl;
- protected Image titleImage;
- protected Object inputObject, outputObject; // input and output objects
- protected SystemMessageLine fMessageLine;
- protected SystemMessage pendingMessage, pendingErrorMessage;
- protected int minWidth, minHeight;
- protected int marginWidth = 3;
- protected int marginHeight = 3;
- protected int verticalSpacing = 2;
- protected int horizontalSpacing = 3;
-
- //protected Composite parent;
- //protected Composite contentsComposite, buttonsComposite;
- protected Mnemonics dialogMnemonics; // list of all unique mnemonics used in this dialog
- protected ISystemValidator outputObjectValidator;
-
- protected long activeRunningOperations = 0;
- protected boolean operationCancelableState;
- protected boolean needsProgressMonitor;
- protected ProgressMonitorPart progressMonitorPart;
- protected Cursor waitCursor;
- protected Cursor arrowCursor;
- protected MessageDialog windowClosingDialog;
- protected SelectionAdapter cancelListener;
-
- // preference stuff for option to not show the dialog again
- protected IPreferenceStore prefStore;
- protected String prefId;
- protected boolean prefValAsSelected;
-
- private static final String FOCUS_CONTROL = "focusControl";//$NON-NLS-1$
-
- protected static final int BROWSE_ID = 50;
- protected static final int TEST_ID = 60;
- protected static final int ADD_ID = 70;
- protected static final int DETAILS_ID = 80;
- protected static final int CANCEL_ALL_ID = 90;
-
- protected static final boolean BROWSE_BUTTON_YES = true;
- protected static final boolean BROWSE_BUTTON_NO = false;
- protected static final boolean TEST_BUTTON_YES = true;
- protected static final boolean TEST_BUTTON_NO = false;
- protected static final boolean ADD_BUTTON_YES = true;
- protected static final boolean ADD_BUTTON_NO = false;
- protected static final boolean DETAILS_BUTTON_YES = true;
- protected static final boolean DETAILS_BUTTON_NO = false;
-
- /**
- * Constructor one: ok and cancel buttons
- * @param shell - parent window this dialog is modal to.
- * @param title - the title for the dialog. Typically translated.
- * @see #setInputObject(Object)
- */
- public SystemPromptDialog(Shell shell, String title)
- {
- this(shell, title, null, false);
- }
- /**
- * Constructor two: ok and cancel buttons and an icon for the dialog title area
- * @param shell - parent window this dialog is modal to.
- * @param title - the title for the dialog. Typically translated.
- * @param titleImage - the icon for the dialog's title area.
- * @see #setInputObject(Object)
- */
- public SystemPromptDialog(Shell shell, String title, Image titleImage)
- {
- this(shell, title, null, false, titleImage);
- }
- /**
- * Constructor three: ok and cancel buttons, plus explicit setting of input object
- * @param shell - parent window this dialog is modal to.
- * @param title - the title for the dialog. Typically translated.
- * @param inputObject - the contextual input data, which can be queried via {@link #getInputObject()}.
- */
- public SystemPromptDialog(Shell shell, String title, Object inputObject)
- {
- this(shell, title, inputObject, false);
- }
- /**
- * Constructor four: ok, browse and cancel buttons
- * @param shell - parent window this dialog is modal to.
- * @param title - the title for the dialog. Typically translated.
- * @param browse - true if to show a Browse button, false if no Browse button desired.
- * @see #setInputObject(Object)
- */
- public SystemPromptDialog(Shell shell, String title, boolean browse)
- {
- this(shell, title, null, browse);
- }
- /**
- * Constructor five: ok, browse and cancel buttons, plus explicit setting of input object
- * @param shell - parent window this dialog is modal to.
- * @param title - the title for the dialog. Typically translated.
- * @param inputObject - the contextual input data, which can be queried via {@link #getInputObject()}.
- * @param browse - true if to show a Browse button, false if no Browse button desired.
- */
- public SystemPromptDialog(Shell shell, String title, Object inputObject, boolean browse)
- {
- this(shell, title, inputObject, browse, null);
- }
- /**
- * Constructor six: ok, browse and cancel buttons, plus explicit setting of input object and
- * an icon for the dialog title area
- * @param shell - parent window this dialog is modal to.
- * @param title - the title for the dialog. Typically translated.
- * @param inputObject - the contextual input data, which can be queried via {@link #getInputObject()}.
- * @param browse - true if to show a Browse button, false if no Browse button desired.
- * @param titleImage - the icon for the dialog's title area.
- */
- public SystemPromptDialog(Shell shell, String title, Object inputObject, boolean browse,
- Image titleImage)
- {
- super(shell);
- setShellStyle(SWT.RESIZE | getShellStyle()); // dwd
- this.title = title;
- this.titleImage = titleImage;
- this.inputObject = inputObject;
- this.showBrowseButton = browse;
- super.setBlockOnOpen(true);
- }
- /**
- * Constructor six: an input object. true/false for browse button, true/false for test button, a title image
- */
- public SystemPromptDialog(Shell shell, String title, Object inputObject, boolean browse, boolean test,
- Image titleImage)
- {
- super(shell);
- setShellStyle(SWT.RESIZE | getShellStyle()); // dwd
- this.title = title;
- this.titleImage = titleImage;
- this.inputObject = inputObject;
- this.showBrowseButton = browse;
- this.showTestButton = test;
- super.setBlockOnOpen(true);
- }
-
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell)
- {
- super.configureShell(shell);
- overallShell = shell;
- if (title != null)
- shell.setText(title);
- //if (titleImage != null)
- // shell.setImage(titleImage); // ?correct method?
- //shell.setSize(300,200); // default w,h
- }
-
- /**
- * Specify if a progress monitor is desired in this dialog. Should be called right after instantiation.
- * The default is false. If true is specified, area on the dialog is reserved for the progress monitor,
- * and the monitor can be retrieved via {@link #getProgressMonitor()}.
- * <p>Support is patterned after WizardDialog in JFace.
- */
- public void setNeedsProgressMonitor(boolean needs)
- {
- this.needsProgressMonitor = needs;
- }
-
- /**
- * For setting the default overall help for the dialog.
- * This can be overridden per control by calling {@link #setHelp(Control, String)}.
- */
- public void setHelp(String helpId)
- {
- if (parentComposite != null)
- {
- SystemWidgetHelpers.setHelp(parentComposite, helpId);
- SystemWidgetHelpers.setHelp(buttonsComposite, helpId);
- //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
- //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId, helpIdPerControl);
- }
- this.helpId = helpId;
- }
- /**
- * For retrieving the help Id
- */
- public String getHelpContextId()
- {
- return helpId;
- }
- /**
- * For setting control-specific help for a control on the wizard page.
- * <p>
- * This overrides the default set in the call to {@link #setHelp(String)}.
- */
- public void setHelp(Control c, String helpId)
- {
- SystemWidgetHelpers.setHelp(c, helpId);
- //if (helpIdPerControl == null)
- // helpIdPerControl = new Hashtable();
- //helpIdPerControl.put(c, helpId);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#setInputObject(java.lang.Object)
- */
- public void setInputObject(Object inputObject)
- {
- this.inputObject = inputObject;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#getInputObject()
- */
- public Object getInputObject()
- {
- return inputObject;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#getOutputObject()
- */
- public Object getOutputObject()
- {
- return outputObject;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#wasCancelled()
- */
- public boolean wasCancelled()
- {
- return !okPressed;
- }
-
- public boolean wasCancelledAll() {
- return cancelAllPressed;
- }
-
- /**
- * If validation of the output object is desired, set the validator here.
- * It will be used when the child class calls setOutputObject().
- */
- public void setOutputObjectValidator(ISystemValidator outputObjectValidator)
- {
- this.outputObjectValidator = outputObjectValidator;
- }
-
- /**
- * Return the output object validator
- */
- public ICellEditorValidator getOutputObjectValidator()
- {
- return outputObjectValidator;
- }
-
- /**
- * Get the ISystemMessageLine control reference.
- */
- public ISystemMessageLine getMessageLine()
- {
- return fMessageLine;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#setOutputObject(java.lang.Object)
- * <p>
- * Note: Signature has changed to ensure overall API consistency!!! If used with return
- * value in specific product code (open source code does not reference this method!),
- * replace the old code:<pre>
- *
- * String xyz = "output object";
- * SystemMessage message = systemPromptDialog.setOutputObject(xyz);
- *
- * </pre>with the new code:<pre>
- *
- * String xyz = "output object";
- * systemPromptDialog.setOutputObject(xyz);
- * if (systemPromptDialog.getOutputObjectValidator() != null)
- * SystemMessage message = systemPromptDialog.getOutputObjectValidator().validate((String)systemPromptDialog.getOutputObject());
- * </pre>
- *
- */
- public void setOutputObject(Object outputObject) {
- this.outputObject = outputObject;
- }
-
- /**
- * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
- */
- public void setBusyCursor(boolean setBusy)
- {
- if (setBusy)
- {
- // Set the busy cursor to all shells.
- Display d = getShell().getDisplay();
- waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
- setDisplayCursor(waitCursor);
- }
- else
- {
- setDisplayCursor(null);
- if (waitCursor != null)
- waitCursor.dispose();
- waitCursor = null;
- }
- }
-
- // --------------------------
- // OK BUTTON CONFIGURATION...
- // --------------------------
- /**
- * Disable showing of Ok button
- */
- public void setShowOkButton(boolean showOk)
- {
- this.showOkButton = showOk;
- }
-
- /**
- * For explicitly setting ok button label
- */
- public void setOkButtonLabel(String label)
- {
- this.labelOk = label;
- }
-
- /**
- * For explicitly setting ok button tooltip text
- */
- public void setOkButtonToolTipText(String tip)
- {
- this.tipOk = tip;
- }
-
- /**
- * For explicitly enabling/disabling ok button.
- */
- public void enableOkButton(boolean enable)
- {
- if (okButton != null)
- okButton.setEnabled(enable);
- }
- /**
- * Return ok button widget
- */
- public Button getOkButton()
- {
- return okButton;
- }
- /**
- * Set initial enabled state of ok button.
- * Call this from createContents, which is called before the ok button is created.
- */
- public void setInitialOKButtonEnabledState(boolean enabled)
- {
- initialOKButtonEnabledState = enabled;
- }
- /**
- * To be overridden by children.
- * Called when user presses OK button.
- * Child dialog class should set output object.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- return true;
- }
-
- // ------------------------------
- // CANCEL BUTTON CONFIGURATION...
- // ------------------------------
- /**
- * For explicitly setting cancel button label
- */
- public void setCancelButtonLabel(String label)
- {
- this.labelCancel = label;
- }
- /**
- * For explicitly setting cancel button tooltip text
- */
- public void setCancelButtonToolTipText(String tip)
- {
- this.tipCancel = tip;
- }
- /**
- * For explicitly enabling/disabling cancel button.
- */
- public void enableCancelButton(boolean enable)
- {
- if (cancelButton != null)
- cancelButton.setEnabled(enable);
- }
- /**
- * Return cancel button widget.
- * Be careful <i>not</i> to call the deprecated inherited method getCancelButton()!
- */
- public Button getCancelOrCloseButton()
- {
- return cancelButton;
- }
- /**
- * To be overridden by children.
- * Called when user presses CANCEL button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processCancel()
- {
- return true;
- }
-
- // ------------------------------
- // CANCEL ALL BUTTON CONFIGURATION...
- // ------------------------------
- /**
- * Enable or disable showing of Cancel All button
- */
- public void setShowCancelAllButton(boolean showCancelAll)
- {
- this.showCancelAllButton = showCancelAll;
- }
-
- /**
- * For explicitly setting cancel button label
- */
- public void setCancelAllButtonLabel(String label)
- {
- this.labelCancelAll = label;
- }
- /**
- * For explicitly setting cancel button tooltip text
- */
- public void setCancelAllButtonToolTipText(String tip)
- {
- this.tipCancelAll = tip;
- }
- /**
- * For explicitly enabling/disabling cancel button.
- */
- public void enableCancelAllButton(boolean enable)
- {
- if (cancelAllButton != null)
- cancelAllButton.setEnabled(enable);
- }
- /**
- * Return cancel button widget.
- * Be careful <i>not</i> to call the deprecated inherited method getCancelButton()!
- */
- public Button getCancelAllButton()
- {
- return cancelAllButton;
- }
- /**
- * To be overridden by children.
- * Called when user presses CANCEL button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processCancelAll()
- {
- return true;
- }
-
- // ------------------------------
- // BROWSE BUTTON CONFIGURATION...
- // ------------------------------
- /**
- * Explicitly specify if Browse Button to be shown
- */
- public void setShowBrowseButton(boolean show)
- {
- this.showBrowseButton = show;
- }
- /**
- * For explicitly setting browse button label
- */
- public void setBrowseButtonLabel(String label)
- {
- this.labelBrowse = label;
- }
- /**
- * For explicitly setting Browse button tooltip text
- */
- public void setBrowseButtonToolTipText(String tip)
- {
- this.tipBrowse = tip;
- }
- /**
- * For explicitly enabling/disabling Browse button.
- */
- public void enableBrowseButton(boolean enable)
- {
- if (browseButton != null)
- browseButton.setEnabled(enable);
- }
- /**
- * Return browse button widget
- */
- public Button getBrowseButton()
- {
- return browseButton;
- }
- /**
- * To be overridden by children.
- * Called when user presses BROWSE button.
- * Return false always!
- */
- protected boolean processBrowse()
- {
- return false;
- }
-
- // ------------------------------
- // TEST BUTTON CONFIGURATION...
- // ------------------------------
- /**
- * Explicitly specify if Test Button to be shown
- */
- public void setShowTestButton(boolean show)
- {
- this.showTestButton = show;
- }
- /**
- * For explicitly setting test button label
- */
- public void setTestButtonLabel(String label)
- {
- this.labelTest = label;
- }
- /**
- * For explicitly setting Test button tooltip text
- */
- public void setTestButtonToolTipText(String tip)
- {
- this.tipTest = tip;
- }
- /**
- * For explicitly enabling/disabling Test button.
- */
- public void enableTestButton(boolean enable)
- {
- if (testButton != null)
- testButton.setEnabled(enable);
- }
- /**
- * Return test button widget
- */
- public Button getTestButton()
- {
- return testButton;
- }
- /**
- * To be overridden by children.
- * Called when user presses TEST button.
- * Return false always!
- */
- protected boolean processTest()
- {
- return false;
- }
-
- // ------------------------------
- // ADD BUTTON CONFIGURATION...
- // ------------------------------
- /**
- * Explicitly specify if Add Button to be shown
- */
- public void setShowAddButton(boolean show)
- {
- this.showAddButton = show;
- }
- /**
- * For explicitly setting Add button label
- */
- public void setAddButtonLabel(String label)
- {
- this.labelAdd = label;
- }
- /**
- * For explicitly setting Add button tooltip text
- */
- public void setAddButtonToolTipText(String tip)
- {
- this.tipAdd = tip;
- }
- /**
- * For explicitly enabling/disabling Add button.
- */
- public void enableAddButton(boolean enable)
- {
- if (addButton != null)
- addButton.setEnabled(enable);
- else
- initialAddButtonEnabledState = enable;
- }
- /**
- * Return Add button widget
- */
- public Button getAddButton()
- {
- return addButton;
- }
- /**
- * To be overridden by children.
- * Called when user presses ADD button.
- * Return false always!
- */
- protected boolean processAdd()
- {
- return false;
- }
-
- // ------------------------------
- // DETAILS BUTTON CONFIGURATION...
- // ------------------------------
- /**
- * Explicitly specify if Details Button to be shown.
- * There is support to automatically toggle the text.
- * @param show if the Details button is to be shown
- * @param hideMode if the button should initially be in "hide mode" versus "hide mode"
- */
- public void setShowDetailsButton(boolean show, boolean hideMode)
- {
- this.showDetailsButton = show;
- this.detailsButtonHideMode = hideMode;
- }
- /**
- * For explicitly setting Details button label
- */
- public void setDetailsButtonLabel(String showLabel, String hideLabel)
- {
- this.labelDetailsShow = showLabel;
- this.labelDetailsHide = hideLabel;
- }
- /**
- * For explicitly setting Details button tooltip text
- */
- public void setDetailsButtonToolTipText(String showTip, String hideTip)
- {
- this.tipDetailsShow = showTip;
- this.tipDetailsHide = hideTip;
- }
- /**
- * For explicitly enabling/disabling Details button.
- */
- public void enableDetailsButton(boolean enable)
- {
- if (detailsButton != null)
- detailsButton.setEnabled(enable);
- else
- initialDetailsButtonEnabledState = enable;
- }
- /**
- * Return Details button widget
- */
- public Button getDetailsButton()
- {
- return detailsButton;
- }
- /**
- * To be overridden by children.
- * Called when user presses DETAILS button.
- * <p>
- * Note the text is automatically toggled for you! You need only
- * do whatever the functionality is that you desire
- *
- * @param hideMode the current state of the details toggle, prior to this request. If you return true from
- * this method, this state and the button text will be toggled.
- *
- * @return true if the details state toggle was successful, false if it failed.
- */
- protected boolean processDetails(boolean hideMode)
- {
- return true;
- }
-
-
-
- /**
- * Get the list of all unique mnemonics used by buttons on this dialog. This is only
- * set at the time createButtonBar is called by the parent, and this is after the createContents
- * method call. It will return null until then. So, it is not available for you at constructor time.
- * Use setUniqueMnemonic(Button) on the returned object if you want to add a mnemonic to
- * button after the fact.
- */
- public Mnemonics getDialogMnemonics()
- {
- return dialogMnemonics;
- }
-
- /**
- * Create message line.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- //System.out.println("INSIDE CREATEMESSAGELINE");
- fMessageLine= new SystemMessageLine(c);
- fMessageLine.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- Display.getCurrent().asyncExec(this);
- return fMessageLine;
- }
- /**
- * For asynch exec we defer some operations until other pending events are processed.
- * For now, this is used to display pending error messages
- */
- public void run()
- {
- if (pendingErrorMessage != null)
- setErrorMessage(pendingErrorMessage);
- else if (pendingMessage != null)
- setMessage(pendingMessage);
- pendingErrorMessage = pendingMessage = null;
- }
-
- /**
- * Handles events generated by controls on this page.
- * Should be overridden by child.
- * Only public because of interface requirement!
- */
- public void handleEvent(Event e)
- {
- if (e.type == SWT.Selection) {
-
- if (e.widget == noShowAgainButton) {
- boolean isNoShowSelected = noShowAgainButton.getSelection();
-
- if ((prefStore != null) && (prefId != null)) {
-
- if (prefValAsSelected) {
- prefStore.setValue(prefId, isNoShowSelected);
- }
- else {
- prefStore.setValue(prefId, !isNoShowSelected);
- }
- }
- }
- }
- }
-
- /**
- * Called by createContents method.
- * Create this dialog's widgets inside a composite.
- * Child classes must override this.
- */
- protected abstract Control createInner(Composite parent);
-
- /**
- * Return the Control to be given initial focus.
- * Child classes must override this, but can return null.
- */
- protected abstract Control getInitialFocusControl();
-
-
-
- /**
- * Override of parent method.
- * Called by IDE when button is pressed.
- */
- protected void buttonPressed(int buttonId)
- {
- okPressed = false;
- if (buttonId == IDialogConstants.OK_ID)
- {
- //setReturnId(buttonId);
- setReturnCode(OK);
- if (processOK())
- {
- okPressed = true;
- close();
- }
- }
- /* Now handled by the cancelListener
- else if (buttonId == CANCEL_ID)
- {
- if (processCancel())
- super.buttonPressed(buttonId);
- }*/
- else if (buttonId == BROWSE_ID)
- {
- processBrowse();
- }
- else if (buttonId == TEST_ID)
- {
- processTest();
- }
- else if (buttonId == ADD_ID)
- {
- processAdd();
- }
- else if (buttonId == DETAILS_ID)
- {
- if (processDetails(detailsButtonHideMode))
- {
- detailsButtonHideMode = !detailsButtonHideMode;
- detailsButton.setText(detailsButtonHideMode ? detailsShowLabel : detailsHideLabel);
- if (detailsButtonHideMode && (tipDetailsShow != null))
- detailsButton.setToolTipText(tipDetailsShow);
- else if (!detailsButtonHideMode && (tipDetailsHide != null))
- detailsButton.setToolTipText(tipDetailsHide);
- }
- }
- else if (buttonId == CANCEL_ALL_ID) {
-
- if (processCancelAll()) {
- cancelAllPressed = true;
- close();
- }
- }
- }
-
- /**
- * Intercept of parent, so we can create the msg line above the button bar.
- */
- protected Control createButtonBar(Composite parent)
- {
- createMessageLine(parent);
- return super.createButtonBar(parent);
- }
-
- /**
- * Adjust the width hint of a button to account for the presumed addition of a mnemonic.
- * @param button the button whose width is to be adjusted.
- */
- protected void adjustButtonWidth(Button button) {
- String text = button.getText();
- // adjust the width hint to allow for a mnemonic to be added.
- if (text != null) {
- if (text.indexOf('&') < 0) {
- Object layoutData = button.getLayoutData();
- if (layoutData instanceof GridData) {
- GridData gd = (GridData) layoutData;
- if (gd.widthHint != SWT.DEFAULT) {
- gd.widthHint += convertWidthInCharsToPixels(3);
- }
- }
- }
- }
- }
-
- /**
- * Add buttons to the dialog's button bar.
- *
- * Subclasses may override.
- *
- * @param parent the button bar composite
- */
- protected void createButtonsForButtonBar(Composite parent)
- {
- //System.out.println("Inside createButtonsForButtonBar");
- //System.out.println("Vertical spacing="+((GridLayout)parent.getLayout()).verticalSpacing);
- //System.out.println("Margin height="+((GridLayout)parent.getLayout()).marginHeight);
- ((GridLayout)parent.getLayout()).verticalSpacing = verticalSpacing;
- //((GridLayout)parent.getLayout()).horizontalSpacing = horizontalSpacing;
- ((GridLayout)parent.getLayout()).marginWidth = marginWidth;
- ((GridLayout)parent.getLayout()).marginHeight = marginHeight;
- //System.out.println("INSIDE CREATEBUTTONSFORBUTTONBAR");
-
- // create requested buttons...
-
- if (showOkButton)
- {
- String okLabel = (labelOk!=null)?labelOk: IDialogConstants.OK_LABEL;
- okButton = createButton(parent, IDialogConstants.OK_ID, okLabel, true);
- okButton.setEnabled(initialOKButtonEnabledState);
- if (tipOk != null)
- okButton.setToolTipText(tipOk);
- }
- if (showBrowseButton)
- {
- String browseLabel = (labelBrowse!=null)?labelBrowse: SystemResources.BUTTON_BROWSE;
- browseButton = createButton(parent, BROWSE_ID, browseLabel, false);
- if (tipBrowse != null)
- browseButton.setToolTipText(tipBrowse);
- }
- if (showTestButton)
- {
- String testLabel = (labelTest!=null)?labelTest: SystemResources.BUTTON_TEST;
- testButton = createButton(parent, TEST_ID, testLabel, false);
- if (tipTest != null)
- testButton.setToolTipText(tipTest);
- }
- if (showAddButton)
- {
- String addLabel = (labelAdd!=null)?labelAdd: SystemResources.BUTTON_ADD;
- addButton = createButton(parent, ADD_ID, addLabel, !showOkButton);
- if (tipAdd != null)
- addButton.setToolTipText(tipAdd);
- addButton.setEnabled(initialAddButtonEnabledState);
- }
- if (showDetailsButton)
- {
- detailsShowLabel = Mnemonics.removeMnemonic((labelDetailsShow!=null)?labelDetailsShow: IDialogConstants.SHOW_DETAILS_LABEL);
- detailsHideLabel = Mnemonics.removeMnemonic((labelDetailsHide!=null)?labelDetailsHide: IDialogConstants.HIDE_DETAILS_LABEL);
- String detailsLabel = detailsButtonHideMode ? detailsShowLabel : detailsHideLabel;
- detailsButton = createButton(parent, DETAILS_ID, detailsLabel, false);
- adjustButtonWidth(detailsButton);
- if (detailsButtonHideMode && (tipDetailsShow != null))
- detailsButton.setToolTipText(tipDetailsShow);
- else if (!detailsButtonHideMode && (tipDetailsHide != null))
- detailsButton.setToolTipText(tipDetailsHide);
- detailsButton.setEnabled(initialDetailsButtonEnabledState);
- }
-
- String cancelLabel = (labelCancel!=null)?labelCancel: IDialogConstants.CANCEL_LABEL;
- cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, cancelLabel, false);
- if (tipCancel != null)
- cancelButton.setToolTipText(tipCancel);
- cancelListener= new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent e)
- {
- if (activeRunningOperations <= 0)
- {
- if (processCancel())
- doCancel();
- }
- else
- cancelButton.setEnabled(false);
- }
- };
- cancelButton.addSelectionListener(cancelListener);
-
- if (showCancelAllButton) {
- String cancelAllLabel = (labelCancelAll != null) ? labelCancelAll: SystemResources.BUTTON_CANCEL_ALL;
- cancelAllButton = createButton(parent, CANCEL_ALL_ID, cancelAllLabel, false);
-
- if (tipCancelAll != null) {
- cancelAllButton.setToolTipText(tipCancelAll);
- }
- }
-
- buttonsComposite = parent;
- if (helpId != null)
- SystemWidgetHelpers.setHelp(buttonsComposite, helpId);
- //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId);
- }
-
- private void doCancel()
- {
- super.buttonPressed(IDialogConstants.CANCEL_ID);
- }
-
- /**
- * Set minimum width and height for this dialog.
- * Pass zero for either to not affect it.
- */
- public void setMinimumSize(int width, int height)
- {
- minWidth = width;
- minHeight = height;
- }
- /**
- * Override of parent.
- */
- protected Control createContents(Composite parent)
- {
- //System.out.println("INSIDE SYSTEMPROMPTDIALOG#CREATECONTENTS");
-
- Control c = super.createContents(parent);
-
- this.parentComposite = (Composite)c;
- if (helpId != null)
- SystemWidgetHelpers.setHelp(parentComposite, helpId);
- //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
-
- // OK, parent method created dialog area and button bar.
- // Time now to do our thing...
-
- // Insert a progress monitor if requested
- if (needsProgressMonitor)
- {
-
- boolean showSeparators = false;
- // Build the first separator line
- Label separator = null;
- if (showSeparators)
- {
- separator= new Label(parentComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
- GridLayout pmlayout= new GridLayout();
- pmlayout.numColumns= 1;
-
- progressMonitorPart= new ProgressMonitorPart(parentComposite, pmlayout, SWT.DEFAULT);
- progressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- progressMonitorPart.setVisible(false);
-
- // Build the second separator line
- if (showSeparators)
- {
- separator= new Label(parentComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
- if (RSECorePlugin.isTheSystemRegistryActive())
- {
- RSEUIPlugin.getTheSystemRegistryUI().setRunnableContext(getShell(),this);
- // add a dispose listener for the shell
- getShell().addDisposeListener(new DisposeListener()
- {
- public void widgetDisposed(DisposeEvent e)
- {
- //System.out.println("Inside dispose for SystemPromptDialog");
- RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
- }
- });
- }
- }
-
- //createMessageLine((Composite)c); now done before buttons are created. d54501
-
- Control initialFocusControl = getInitialFocusControl();
- if (initialFocusControl != null)
- initialFocusControl.setFocus();
-
- //buttonsComposite = buttons; // remember the buttons part of the dialog so we can add mnemonics
- /*
- * OK now is a good time to add the mnemonics!
- * This is because both the contents and buttons have been created.
- */
- dialogMnemonics = SystemWidgetHelpers.setMnemonics((Composite)getButtonBar());
- applyMnemonics(dialogMnemonics, (Composite)getDialogArea());
-
- /*
- * OK, now that mnemonics for the buttons are set, query the mnemonic for the details button and its
- * two states... defect 42904
- */
- if (showDetailsButton)
- {
- if (detailsButtonHideMode)
- {
- detailsShowLabel = detailsButton.getText();
- char m = Mnemonics.getMnemonic(detailsShowLabel);
- detailsHideLabel = Mnemonics.applyMnemonic(detailsHideLabel, m);
- }
- else
- {
- detailsHideLabel = detailsButton.getText();
- char m = Mnemonics.getMnemonic(detailsHideLabel);
- detailsShowLabel = Mnemonics.applyMnemonic(detailsShowLabel, m);
- }
- }
- if (labelCancel != null)
- labelCancel = cancelButton.getText(); // reset to include the mnemonic, in case we need to restore it
-
- if (pack)
- {
- Shell shell = getShell();
- shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
- }
- // return composite created by call to parent's method
- return c;
- }
-
- /**
- * Apply mnemonic to the composite.
- * @param c the composite.
- */
- protected void applyMnemonics(Mnemonics mnemonics, Composite c) {
- SystemWidgetHelpers.setMnemonics(mnemonics, c);
- }
-
- /**
- * Called by parent.
- * Create overall dialog page layout.
- */
- protected Control createDialogArea(Composite parent)
- {
- //System.out.println("INSIDE CREATEDIALOGAREA");
- Composite c = new Composite(parent, SWT.NONE);
- this.dialogAreaComposite = c;
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginHeight= marginWidth;
- layout.marginWidth = marginHeight;
- layout.verticalSpacing = verticalSpacing;
- layout.horizontalSpacing= horizontalSpacing;
- c.setLayout(layout);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Control inner = createInner(c); // allows for child classes to override.
-
- // if user wants the option to not show the dialog again
- if (noShowAgainOption) {
- noShowAgainButton = createNoShowAgainButton(c);
- }
-
- /*
- * And now is the time to auto-size if so requested...
- */
- if (minWidth > 0)
- {
- boolean newData = false;
- GridData data = (GridData)inner.getLayoutData();
- if (data == null)
- {
- newData = true;
- data = new GridData();
- }
- data.widthHint = minWidth;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- if (newData)
- inner.setLayoutData(data);
- }
- if (minHeight > 0)
- {
- boolean newData = false;
- GridData data = (GridData)inner.getLayoutData();
- if (data == null)
- {
- newData = true;
- data = new GridData();
- }
- data.heightHint = minHeight;
- data.grabExcessVerticalSpace = true;
- data.verticalAlignment = GridData.FILL;
- if (newData)
- inner.setLayoutData(data);
- }
- //this.parent = c;
- //contentsComposite = c; // remember the contents part of the dialog so we can add mnemonics
- return c;
- }
-
- /**
- * Set option to not show this dialog again and specify the preference that should be set
- * according to whether the user selects to show the dialog again or no. The caller can
- * query this preference to find out what the user selection is.
- * @param noShowAgainOption <code>true</code> to show the option in the dialog, <code>false</code> to not show it.
- * @param prefStore the preference store.
- * @param prefId the preference id for which a boolean value will be stored according to the user's selection.
- * @param prefValAsSelected whether to mirror the user selection in the preference. If this is set to
- * <code>true</code>, then the value stored in the preference is <code>true</code> if the user selects the option,
- * and <code>false</code> if the user does not select the option. If this is set to <code>false</code>, then the
- * value stored in the preference will be <code>false</code> if the user selects the option, and <code>true</code>
- * if the user does not select the option
- */
- public void setNoShowAgainOption(boolean noShowAgainOption, IPreferenceStore prefStore, String prefId, boolean prefValAsSelected) {
- this.noShowAgainOption = noShowAgainOption;
- this.prefStore = prefStore;
- this.prefId = prefId;
- this.prefValAsSelected = prefValAsSelected;
- }
-
- /**
- * Creates a button to allow option to not show this dialog again.
- * @return the button that allows option to not show this dialog again.
- */
- protected Button createNoShowAgainButton(Composite c) {
- Button b = new Button(c, SWT.CHECK);
- b.setText(SystemResources.RESID_DO_NOT_SHOW_MESSAGE_AGAIN_LABEL);
- b.setToolTipText(SystemResources.RESID_DO_NOT_SHOW_MESSAGE_AGAIN_TOOLTIP);
- b.addListener(SWT.Selection, this);
- return b;
- }
-
- /**
- * Call this to disable the Apply button if the input is not complete or not valid.
- */
- public void setPageComplete(boolean complete)
- {
- if (okButton != null)
- okButton.setEnabled(complete);
- else
- initialOKButtonEnabledState = complete;
- }
-
- // -----------------
- // HELPER METHODS...
- // -----------------
- /**
- * Add a separator line. This is a physically visible line.
- */
- protected Label addSeparatorLine(Composite parent, int nbrColumns)
- {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(data);
- return separator;
- }
- /**
- * Add a spacer line
- */
- protected Label addFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- filler.setLayoutData(data);
- return filler;
- }
- /**
- * Add a spacer line that grows in height to absorb extra space
- */
- protected Label addGrowableFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.grabExcessVerticalSpace = true;
- filler.setLayoutData(data);
- return filler;
- }
-
- /**
- * Expose inherited protected method convertWidthInCharsToPixels as a publicly
- * excessible method
- */
- public int publicConvertWidthInCharsToPixels(int chars)
- {
- return convertWidthInCharsToPixels(chars);
- }
- /**
- * Expose inherited protected method convertHeightInCharsToPixels as a publicly
- * excessible method
- */
- public int publicConvertHeightInCharsToPixels(int chars)
- {
- return convertHeightInCharsToPixels(chars);
- }
-
- // -----------------------------
- // ISystemMessageLine METHODS...
- // -----------------------------
- /**
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- if (fMessageLine != null)
- fMessageLine.clearErrorMessage();
- }
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- if (fMessageLine != null)
- fMessageLine.clearMessage();
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage()
- {
- if (fMessageLine != null)
- return fMessageLine.getErrorMessage();
- else
- return null;
- }
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- if (fMessageLine != null)
- return fMessageLine.getSystemErrorMessage();
- else
- return null;
- }
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage()
- {
- if (fMessageLine != null)
- return fMessageLine.getMessage();
- else
- return null;
- }
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- if (fMessageLine != null)
- fMessageLine.setErrorMessage(message);
- else
- SystemMessageDialog.displayErrorMessage(getShell(),message);
- }
-
- /**
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- if (fMessageLine != null)
- {
- if (message != null)
- fMessageLine.setErrorMessage(message);
- else
- fMessageLine.clearErrorMessage();
- }
- else //if (message != null)
- {
- //(new SystemMessageDialog(getShell(),message)).open();
- pendingErrorMessage = message;
- }
- }
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- if (fMessageLine != null)
- {
- if (message != null)
- fMessageLine.setMessage(message);
- else
- fMessageLine.clearMessage();
- }
- }
-
- /**
- *If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- if (fMessageLine != null)
- fMessageLine.setMessage(message);
- else if (message != null)
- //(new SystemMessageDialog(getShell(),message)).open();
- pendingMessage = message;
- }
-
-
- /**
- * Convenience method to set an error message from an exception
- */
- public void setErrorMessage(Throwable exc)
- {
- if (fMessageLine != null)
- fMessageLine.setErrorMessage(exc);
- else
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
- msg.makeSubstitution(exc);
- (new SystemMessageDialog(getShell(),msg)).open();
- }
- }
-
- // -------------------------------------------------------------------------------
- // IDialogPage interface methods, which we only implement to enable dialog help...
- // -------------------------------------------------------------------------------
- public void setDescription(String description) {}
- public String getDescription() {return null;}
- public Image getImage() {return titleImage;}
- public void performHelp() {}
- public void setVisible(boolean visible) {}
- public void dispose() {}
- public Control getControl() {return parentComposite;}
- public void setControl(Control c) {}
- public void createControl(Composite parent) {}
- public void setImageDescriptor(ImageDescriptor id) {}
- /**
- * Get the dialog's title
- */
- public String getTitle()
- {
- return title;
- }
- /**
- * Set the dialog's title
- */
- public void setTitle(String title)
- {
- this.title = title;
- if (overallShell != null)
- overallShell.setText(title);
- }
-
-
- // --------------------------------------------
- // Methods to support a progress monitor...
- // using WizardDialog as an example.
- // --------------------------------------------
-
- /**
- * Returns the progress monitor for this dialog (if it has one).
- *
- * @return the progress monitor, or <code>null</code> if
- * this dialog does not have one
- */
- public IProgressMonitor getProgressMonitor()
- {
- return progressMonitorPart;
- }
-
- /**
- * About to start a long running operation tiggered through
- * the dialog. Shows the progress monitor and disables the dialog's
- * buttons and controls.
- *
- * @param enableCancelButton <code>true</code> if the Cancel button should
- * be enabled, and <code>false</code> if it should be disabled
- * @return the saved UI state
- */
- protected Object aboutToStart(boolean enableCancelButton)
- {
- Map savedState = null;
- operationCancelableState = enableCancelButton;
- if ((getShell() != null) && (activeRunningOperations <= 0))
- {
- // Save focus control
- Control focusControl = getShell().getDisplay().getFocusControl();
- if (focusControl != null && focusControl.getShell() != getShell())
- focusControl = null;
- cancelButton.removeSelectionListener(cancelListener);
- // Set the busy cursor to all shells.
- Display d = getShell().getDisplay();
- waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
- setDisplayCursor(waitCursor);
-
- // Set the arrow cursor to the cancel component.
- arrowCursor= new Cursor(d, SWT.CURSOR_ARROW);
- cancelButton.setCursor(arrowCursor);
-
- // Set the cancel button label to "Cancel" if it isn't already
- if (labelCancel != null)
- cancelButton.setText("&" + IDialogConstants.CANCEL_LABEL); //$NON-NLS-1$
-
- // Deactivate shell
- savedState = saveUIState(needsProgressMonitor && enableCancelButton);
- if (focusControl != null)
- savedState.put(FOCUS_CONTROL, focusControl);
-
- // Attach the progress monitor part to the cancel button
- if (needsProgressMonitor)
- {
- progressMonitorPart.attachToCancelComponent(cancelButton);
- progressMonitorPart.setVisible(true);
- }
- }
- return savedState;
- }
-
- /**
- * Creates and returns a new wizard closing dialog without opening it.
- */
- protected MessageDialog createWizardClosingDialog()
- {
- MessageDialog result= new MessageDialog(getShell(),
- JFaceResources.getString("WizardClosingDialog.title"),//$NON-NLS-1$
- null,
- JFaceResources.getString("WizardClosingDialog.message"),//$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL}, 0 );
- return result;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- public boolean close()
- {
- if (okToClose())
- return hardClose();
- else
- return false;
- }
- /**
- * Checks whether it is alright to close this wizard dialog
- * and perform standard cancel processing. If there is a
- * long running operation in progress, this method posts an
- * alert message saying that the wizard cannot be closed.
- *
- * @return <code>true</code> if it is alright to close this dialog, and
- * <code>false</code> if it is not
- */
- protected boolean okToClose()
- {
- if (activeRunningOperations > 0)
- {
- synchronized (this)
- {
- windowClosingDialog = createWizardClosingDialog();
- }
- windowClosingDialog.open();
- synchronized (this)
- {
- windowClosingDialog = null;
- }
- return false;
- }
- return true;
- }
-
- /**
- * Closes this window. Really closes it. Calls super.close()
- *
- * @return <code>true</code> if the window is (or was already) closed,
- * and <code>false</code> if it is still open
- */
- protected boolean hardClose()
- {
- return super.close();
- }
-
- /**
- * Restores the enabled/disabled state of the given control.
- *
- * @param w the control
- * @param h the map (key type: <code>String</code>, element type:
- * <code>Boolean</code>)
- * @param key the key
- * @see #saveEnableStateAndSet
- */
- protected void restoreEnableState(Control w, Map h, String key)
- {
- if (w != null) {
- Boolean b = (Boolean) h.get(key);
- if (b != null)
- w.setEnabled(b.booleanValue());
- }
- }
- /**
- * Restores the enabled/disabled state of the wizard dialog's
- * buttons and the tree of controls for the currently showing page.
- *
- * @param state a map containing the saved state as returned by
- * <code>saveUIState</code>
- * @see #saveUIState
- */
- protected void restoreUIState(Map state)
- {
- //protected Button okButton, cancelButton, testButton, browseButton, addButton, detailsButton;
- restoreEnableState(okButton, state, "ok"); //$NON-NLS-1$
- restoreEnableState(testButton, state, "test"); //$NON-NLS-1$
- restoreEnableState(browseButton, state, "browse"); //$NON-NLS-1$
- restoreEnableState(cancelButton, state, "cancel"); //$NON-NLS-1$
- restoreEnableState(addButton, state, "add"); //$NON-NLS-1$
- restoreEnableState(detailsButton,state, "details"); //$NON-NLS-1$
- SystemControlEnableState pageState = (SystemControlEnableState) state.get("page");//$NON-NLS-1$
- pageState.restore();
- }
-
- /**
- * Captures and returns the enabled/disabled state of the wizard dialog's
- * buttons and the tree of controls for the currently showing page. All
- * these controls are disabled in the process, with the possible excepton of
- * the Cancel button.
- *
- * @param keepCancelEnabled <code>true</code> if the Cancel button should
- * remain enabled, and <code>false</code> if it should be disabled
- * @return a map containing the saved state suitable for restoring later
- * with <code>restoreUIState</code>
- * @see #restoreUIState
- */
- protected Map saveUIState(boolean keepCancelEnabled)
- {
- Map savedState= new HashMap(10);
- saveEnableStateAndSet(okButton, savedState, "ok", false); //$NON-NLS-1$
- saveEnableStateAndSet(testButton, savedState, "test", false); //$NON-NLS-1$
- saveEnableStateAndSet(browseButton, savedState, "browse", false); //$NON-NLS-1$
- saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$
- saveEnableStateAndSet(addButton, savedState, "add", false); //$NON-NLS-1$
- saveEnableStateAndSet(detailsButton,savedState, "details",false); //$NON-NLS-1$
- //savedState.put("page", ControlEnableState.disable(getControl()));
- savedState.put("page", SystemControlEnableState.disable(dialogAreaComposite)); //$NON-NLS-1$
- return savedState;
- }
-
- /**
- * Saves the enabled/disabled state of the given control in the
- * given map, which must be modifiable.
- *
- * @param w the control, or <code>null</code> if none
- * @param h the map (key type: <code>String</code>, element type:
- * <code>Boolean</code>)
- * @param key the key
- * @param enabled <code>true</code> to enable the control,
- * and <code>false</code> to disable it
- * @see #restoreEnableState(Control,Map,String)
- */
- protected void saveEnableStateAndSet(Control w, Map h, String key, boolean enabled)
- {
- if (w != null) {
- h.put(key, new Boolean(w.isEnabled()));
- w.setEnabled(enabled);
- }
- }
-
- /**
- * Sets the given cursor for all shells currently active
- * for this window's display.
- *
- * @param c the cursor
- */
- protected void setDisplayCursor(Cursor c)
- {
- setDisplayCursor(getShell(), c);
- }
- /**
- * Sets the given cursor for all shells currently active for the given shell's display.
- *
- * @param c the cursor
- */
- public static void setDisplayCursor(Shell shell, Cursor c)
- {
- if (c == null)
- {
- // attempt to fix problem that the busy cursor sometimes stays. Phil
- // DKM - commenting this out since the attempt to fix problem didn't work
- // and it causes accessibility problems when expanding a system via keyboard
- // shell.forceActive();
- // shell.forceFocus();
- }
- if (shell != null && shell.getDisplay() != null)
- {
- Shell[] shells = shell.getDisplay().getShells();
- for (int i = 0; i < shells.length; i++)
- {
- shells[i].setCursor(c);
- }
- }
- }
-
-
- /**
- * For IRunnableContext.
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException
- {
- // The operation can only be cancelled if it is executed in a separate thread.
- // Otherwise the UI is blocked anyway.
- Object state = aboutToStart(fork && cancelable);
- activeRunningOperations++;
- if (activeRunningOperations > 1)
- {
- //System.out.println("Nested operation!");
- //(new Exception()).fillInStackTrace().printStackTrace();
- }
- try {
- ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
- } finally {
- activeRunningOperations--;
- stopped(state);
- }
- }
- /**
- * A long running operation triggered through the wizard
- * was stopped either by user input or by normal end.
- * Hides the progress monitor and restores the enable state
- * wizard's buttons and controls.
- *
- * @param savedState the saved UI state as returned by <code>aboutToStart</code>
- * @see #aboutToStart
- */
- private void stopped(Object savedState)
- {
- if ((getShell() != null) && (activeRunningOperations <= 0))
- {
- if (needsProgressMonitor)
- {
- progressMonitorPart.setVisible(false);
- progressMonitorPart.removeFromCancelComponent(cancelButton);
- }
- Map state = (Map)savedState;
- restoreUIState(state);
- cancelButton.addSelectionListener(cancelListener);
- setDisplayCursor(null);
- cancelButton.setCursor(null);
- if (labelCancel != null)
- cancelButton.setText(labelCancel);
- waitCursor.dispose();
- waitCursor = null;
- arrowCursor.dispose();
- arrowCursor = null;
- Control focusControl = (Control)state.get(FOCUS_CONTROL);
- if (focusControl != null)
- focusControl.setFocus();
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java
deleted file mode 100644
index 10d32b7e1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRemoteResourceDialog.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [190442] made SystemActionViewerFilter API
- * Kevin Doyle (IBM) - [198114] Allowed to move file into existing folder/archive on first attempt
- * Xuan Chen (IBM) - [220999] [api] Need to change class SystemSelectRemoteFileAction to use SystemRemoteFileDialog
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.ui.view.SystemResourceSelectionForm;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.IValidatorRemoteSelection;
-import org.eclipse.rse.ui.view.ISystemResourceSelectionInputProvider;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-public abstract class SystemRemoteResourceDialog extends SystemPromptDialog
-{
- private SystemResourceSelectionForm _form;
- private ISystemResourceSelectionInputProvider _inputProvider;
- private Object _preSelection;
- private IValidatorRemoteSelection _selectionValidator;
- private boolean _multipleSelectionMode;
- private boolean _showPropertySheet = false;
- //private IHost _outputConnection;
- private SystemActionViewerFilter _customViewerFilter;
- private String _message, _tip;
-
- /**
- * @since 3.0 replaced SystemResourceSelectionInputProvider by
- * ISystemResourceSelectionInputProvider
- */
- public SystemRemoteResourceDialog(Shell shell, String title,
- ISystemResourceSelectionInputProvider inputProvider)
- {
- super(shell, title);
- _inputProvider = inputProvider;
- }
-
- protected Control createInner(Composite parent)
- {
- _form = new SystemResourceSelectionForm(getShell(), parent, this, _inputProvider, getVerbiage(), _multipleSelectionMode, getMessageLine());
- initForm();
- _form.setPreSelection(_preSelection);
- createMessageLine(parent);
- return _form.getInitialFocusControl();
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- ISystemMessageLine msgLine = super.createMessageLine(c);
- _form.setMessageLine(msgLine);
- return fMessageLine;
- }
-
- public void initForm()
- {
-
- if (_customViewerFilter != null)
- {
- _form.applyViewerFilter(_customViewerFilter);
- }
- else
- {
- _form.applyViewerFilter(getViewerFilter());
- }
- _form.setSelectionValidator(_selectionValidator);
- _form.setPreSelection(_preSelection);
- _form.setShowPropertySheet(_showPropertySheet);
- _form.setSelectionTreeToolTipText(getTreeTip());
- if (_message != null)
- _form.setMessage(_message);
- if (_tip != null)
- _form.setSelectionTreeToolTipText(_tip);
- }
-
- public void setDefaultSystemConnection(IHost connection, boolean onlyConnection)
- {
- _inputProvider.setSystemConnection(connection, onlyConnection);
- }
-
- public void setSystemTypes(IRSESystemType[] types)
- {
- _inputProvider.setSystemTypes(types);
- }
-
- protected Control getInitialFocusControl()
- {
- return _form.getInitialFocusControl();
- }
-
- public void setPreSelection(Object selection)
- {
- _preSelection = selection;
- if (_form != null)
- {
- _form.setPreSelection(selection);
- }
- }
-
- public void setSelectionValidator(IValidatorRemoteSelection validator)
- {
- _selectionValidator = validator;
- }
-
- public void setCustomViewerFilter(SystemActionViewerFilter viewerFilter)
- {
- _customViewerFilter = viewerFilter;
- }
-
- /**
- * Set multiple selection mode. Default is single selection mode
- * <p>
- * If you turn on multiple selection mode, you must use the getSelectedObjects()
- * method to retrieve the list of selected objects.
- * <p>
- * Further, if you turn this on, it has the side effect of allowing the user
- * to select any remote object. The assumption being if you are prompting for
- * files, you also want to allow the user to select a folder, with the meaning
- * being that all files within the folder are implicitly selected.
- *
- * @see #getSelectedObjects()
- */
- public void setMultipleSelectionMode(boolean multiple)
- {
- _multipleSelectionMode = multiple;
-
- }
-
- /**
- * Set the message shown at the top of the form
- */
- public void setMessage(String message)
- {
- _message = message;
- if (_form != null)
- {
- _form.setMessage(message);
- }
- }
- /**
- * Set the tooltip text for the remote systems tree from which an item is selected.
- */
- public void setSelectionTreeToolTipText(String tip)
- {
- _tip = tip;
- if (_tip != null)
- {
- _form.setSelectionTreeToolTipText(tip);
- }
- }
-
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- * <p>
- * This overload always shows the property sheet
- * <p>
- * Default is false
- */
- public void setShowPropertySheet(boolean show)
- {
- _showPropertySheet = show;
- }
- /**
- * Show the property sheet on the right hand side, to show the properties of the
- * selected object.
- * <p>
- * This overload shows a Details>>> button so the user can decide if they want to see the
- * property sheet.
- * <p>
- * @param show True if show the property sheet within the dialog
- * @param initialState True if the property is to be initially displayed, false if it is not
- * to be displayed until the user presses the Details button.
- */
- public void setShowPropertySheet(boolean show, boolean initialState)
- {
- if (show)
- {
- _showPropertySheet = initialState;
- setShowDetailsButton(true, !initialState);
- }
- }
-
- /**
- * Return selected file or folder
- */
- public Object getSelectedObject()
- {
- if (getOutputObject() instanceof Object[])
- return ((Object[])getOutputObject())[0];
- else
- return getOutputObject();
- }
- /**
- * Return all selected objects. This method will return an array of one
- * unless you have called setMultipleSelectionMode(true)!
- * @see #setMultipleSelectionMode(boolean)
- */
- public Object[] getSelectedObjects()
- {
- if (getOutputObject() instanceof Object[])
- return (Object[])getOutputObject();
- else if (getOutputObject() != null)
- return new Object[] {getOutputObject()};
- else
- return null;
- }
-
- public IHost getSelectedConnection()
- {
- return _form.getSelectedConnection();
- }
-
- /**
- * Private method.
- * <p>
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- boolean closeDialog = _form.verify();
- if (closeDialog)
- {
- //_outputConnection = _form.getSelectedConnection();
- if (_multipleSelectionMode)
- setOutputObject(_form.getSelectedObjects());
- else
- setOutputObject(_form.getSelectedObject());
- }
- else
- setOutputObject(null);
- return closeDialog;
- }
-
- /** @since 3.0 */
- public void setShowNewConnectionPrompt(boolean showNewConnectionPrompt)
- {
- _inputProvider.setAllowNewConnection(showNewConnectionPrompt);
- }
-
- /**
- * Private method.
- * <p>
- * Called when user presses DETAILS button.
- * <p>
- * Note the text is automatically toggled for us! We need only
- * do whatever the functionality is that we desire
- *
- * @param hideMode the current state of the details toggle, prior to this request. If we return true from
- * this method, this state and the button text will be toggled.
- *
- * @return true if the details state toggle was successful, false if it failed.
- */
- protected boolean processDetails(boolean hideMode)
- {
- _form.toggleShowPropertySheet(getShell(), getContents());
- return true;
- }
-
- /**
- * Returns the system tree
- *
- * @return the system tree
- * @since 3.0
- */
- public ISystemTree getSystemTree()
- {
- return _form.getSystemTree();
- }
-
- /**
- * Indicates whether the page for the form is complete or not.
- *
- * @return true if the page associated with the form is complete
- * @since 3.0
- */
- public boolean isPageComplete()
- {
- return _form.isPageComplete();
- }
-
- public abstract SystemActionViewerFilter getViewerFilter();
- public abstract String getVerbiage();
- public abstract String getTreeTip();
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameSingleDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameSingleDialog.java
deleted file mode 100644
index ee225a48d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemRenameSingleDialog.java
+++ /dev/null
@@ -1,754 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Rupen Mardirossian (IBM) - [208435] When validating name, check for previously used names for multiple renaming instances
- * David Dykstal (IBM) - [231828] make rename dialog a bit wider
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ISystemValidatorUniqueString;
-import org.eclipse.rse.ui.validators.ValidatorConnectionName;
-import org.eclipse.rse.ui.validators.ValidatorUniqueString;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.rse.ui.view.SystemAdapterHelpers;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-
-
-
-/**
- * Dialog for renaming a single resource. Used when only one item selected.
- * <p>
- * This is a re-usable dialog that you can use directly, or via the {@link org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction}
- * action.
- * <p>
- * To use this dialog, you must call setInputObject with a StructuredSelection of the objects to be renamed.
- * If those objects adapt to {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter} or
- * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}, the dialog will offer built-in error checking.
- * <p>
- * If the input object does not adapt to org.eclipse.rse.ui.view.ISystemRemoteElementAdapter or ISystemViewElementAdapter, then you
- * should call {@link #setNameValidator(org.eclipse.rse.ui.validators.ISystemValidator)} to
- * specify a validator that is called to verify the user-typed new name is valid. Further, to show the type value
- * of the input object, it should implement {@link org.eclipse.rse.ui.dialogs.ISystemTypedObject}.
- * <p>
- * This dialog does not do the actual renames. Rather, it will return the user-typed new name. This is
- * queriable via {@link #getNewName()}, after testing that {@link #wasCancelled()} is false.
- *
- * @see org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction
- */
-public class SystemRenameSingleDialog extends SystemPromptDialog
- implements
- Runnable
-{
-
- public static final boolean COLLISION_MODE = true;
-
- private Button overwriteRadio;
- //private Button renameRadio;
- private boolean overwriteMode = true;
-
- private Composite renameGroup;
-
- private Text newName;
- private String promptLabel;
- private String promptTip;
- private String newNameString;
- private String inputName = ""; //$NON-NLS-1$
- private Label resourceTypePrompt, resourceTypeValue, verbiageLabel, renameLabel;
- private SystemMessage errorMessage;
- private ISystemValidator nameValidator;
- private ValidatorUniqueString uniqueNameValidator;
- private boolean initialized = false;
- private boolean copyCollisionMode = false;
- private boolean isRemote = true;
- private ISystemViewElementAdapter adapter = null;
- private Object inputElement = null;
- private String description = null;
- private List _namesInUse = new ArrayList();
-
- /**
- * Constructor
- */
- public SystemRenameSingleDialog(Shell shell)
- {
- this(shell, SystemResources.RESID_RENAME_TITLE);
- String singleTitle = SystemResources.RESID_RENAME_SINGLE_TITLE;
- if (!singleTitle.startsWith("Missing")) // TODO: remove test after next mri rev //$NON-NLS-1$
- setTitle(singleTitle);
- }
- /**
- * Constructor with a title
- */
- public SystemRenameSingleDialog(Shell shell, String title)
- {
- super(shell, title);
-
- //pack();
- setBlockOnOpen(true);
- setHelp(RSEUIPlugin.HELPPREFIX+"drns0000"); //$NON-NLS-1$
- }
-
- /**
- * Constructor with an input object and validator
- * This constructor is in copy/move dialogs when there is a collision
- * @param shell The parent dialog
- * @param copyCollisionMode true if this is being called because of a name collision on a copy or move operation
- * @param inputObject The object that is being renamed, or on a copy/move the object in the target container which already exists. Used to get the old name and the name validator
- * @param nameValidator The name validator to use. Can be null, in which case it is queried from the adapter of the input object
- */
- public SystemRenameSingleDialog(Shell shell, boolean copyCollisionMode, Object inputObject, ISystemValidator nameValidator)
- {
- this(shell);
- setInputObject(inputObject);
- setCopyCollisionMode(copyCollisionMode);
- setNameValidator(nameValidator);
-
- }
- /**
- * Constructor with an input object and validator This constructor is in
- * copy/move dialogs when there is a collision
- *
- * @param shell The parent dialog
- * @param copyCollisionMode true if this is being called because of a name
- * collision on a copy or move operation
- * @param inputObject The object that is being renamed, or on a copy/move
- * the object in the target container which already exists. Used
- * to get the old name and the name validator
- * @param nameValidator The name validator to use. Can be null, in which
- * case it is queried from the adapter of the input object
- * @param nameInUse the List of names that have been previously selected for
- * other files that are to be renamed for multiple file renaming.
- * @since 3.0 added nameInUse argument
- */
- public SystemRenameSingleDialog(Shell shell, boolean copyCollisionMode, Object inputObject, ISystemValidator nameValidator, List nameInUse)
- {
- this(shell);
- setInputObject(inputObject);
- setCopyCollisionMode(copyCollisionMode);
- setNameValidator(nameValidator);
- _namesInUse = nameInUse;
-
- }
- /**
- * Set the label and tooltip of the prompt. The default is "New name:"
- */
- public void setPromptLabel(String label, String tooltip)
- {
- this.promptLabel = label;
- this.promptTip = tooltip;
- }
-
- /**
- * Indicate this dialog is the result of a copy/move name collision.
- * Affects the title, verbiage at the top of the dialog, and context help.
- */
- public void setCopyCollisionMode(boolean copyCollisionMode)
- {
- if (copyCollisionMode)
- {
- if (this.inputObject != null && this.inputObject instanceof IHost)
- {
- setHelp(RSEUIPlugin.HELPPREFIX+"dccc0000"); //$NON-NLS-1$
- }
- else
- {
- setHelp(RSEUIPlugin.HELPPREFIX+"drns0001"); //$NON-NLS-1$
- }
- setTitle(SystemResources.RESID_COLLISION_RENAME_TITLE);
- }
- else if (this.copyCollisionMode) // from true to false
- {
- setHelp(RSEUIPlugin.HELPPREFIX+"drns0000"); //$NON-NLS-1$
- String singleTitle = SystemResources.RESID_RENAME_SINGLE_TITLE;
- if (!singleTitle.startsWith("Missing")) // TODO: remove test after next mri rev //$NON-NLS-1$
- setTitle(singleTitle);
- else
- setTitle(SystemResources.RESID_RENAME_TITLE); // older string we know exists
- }
- this.copyCollisionMode = copyCollisionMode;
- }
- /**
- * Query if this dialog is the result of a copy/move name collision.
- * Affects the title, verbiage at the top of the dialog, and context help.
- */
- public boolean getCopyCollisionMode()
- {
- return copyCollisionMode;
- }
-
-
- /**
- * Set the validator for the new name,as supplied by the adaptor for name checking.
- * Overrides the default which is to query it from the object's adapter.
- */
- public void setNameValidator(ISystemValidator nameValidator)
- {
- this.nameValidator = nameValidator;
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- /*ISystemMessageLine msgLine =*/ super.createMessageLine(c);
- //form.setMessageLine(msgLine);
- return fMessageLine;
- }
-
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- //uSystem.out.println("here! " + (newName == null));
- return newName;
- }
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 1;
- Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- Object inputObject = getInputObject();
-
- if (copyCollisionMode)
- {
- // VERBIAGE
- verbiageLabel = SystemWidgetHelpers.createLabel(composite, " ", nbrColumns); //$NON-NLS-1$
- SystemWidgetHelpers.createLabel(composite, " ", nbrColumns); //filler //$NON-NLS-1$
- }
- else if (description != null)
- {
- // VERBIAGE
- verbiageLabel = SystemWidgetHelpers.createLabel(composite, description, nbrColumns);
- SystemWidgetHelpers.createLabel(composite, " ", nbrColumns); //filler //$NON-NLS-1$
- }
-
- if (copyCollisionMode)
- {
- overwriteRadio = SystemWidgetHelpers.createRadioButton(composite, this, SystemResources.RESID_SIMPLE_RENAME_RADIO_OVERWRITE_LABEL, SystemResources.RESID_SIMPLE_RENAME_RADIO_OVERWRITE_TOOLTIP);
- overwriteRadio.setSelection(true);
- /*renameRadio =*/ SystemWidgetHelpers.createRadioButton(composite, this, SystemResources.RESID_SIMPLE_RENAME_RADIO_RENAME_LABEL, SystemResources.RESID_SIMPLE_RENAME_RADIO_RENAME_TOOLTIP);
- }
-
- int nbrRenameColumns = 2;
- // BEGIN RENAME
- renameGroup = SystemWidgetHelpers.createComposite(composite, nbrRenameColumns);
-
- // RESOURCE TYPE
- resourceTypePrompt = SystemWidgetHelpers.createLabel(renameGroup, SystemResources.RESID_SIMPLE_RENAME_RESOURCEPROMPT_LABEL);
- resourceTypeValue = SystemWidgetHelpers.createLabel(renameGroup, ""); //$NON-NLS-1$
- resourceTypeValue.setToolTipText(SystemResources.RESID_SIMPLE_RENAME_RESOURCEPROMPT_TOOLTIP);
-
-
- // PROMPT
- if (promptLabel == null)
- {
- String labelText = copyCollisionMode ? SystemResources.RESID_COLLISION_RENAME_LABEL : SystemResources.RESID_SIMPLE_RENAME_PROMPT_LABEL;
- labelText = SystemWidgetHelpers.appendColon(labelText);
- renameLabel = SystemWidgetHelpers.createLabel(renameGroup, labelText);
- }
- else
- {
- renameLabel = SystemWidgetHelpers.createLabel(renameGroup, promptLabel);
- }
- newName = SystemWidgetHelpers.createTextField(renameGroup, null);
- ((GridData)newName.getLayoutData()).widthHint = 300; // make this wider than usual so error messages are not truncated
- if (promptTip != null) {
- newName.setToolTipText(promptTip);
- }
-
- // END RENAME
-
-
-
- if (inputObject != null)
- {
- initializeInput();
- }
-
- // init ok to disabled, until they type a new name
- setPageComplete(false);
-
- // add keystroke listeners...
- newName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateNameInput();
- }
- }
- );
-
- if (copyCollisionMode)
- {
- enableRename(false);
- }
-
-
- return composite;
- }
-
-
- /**
- * Override of parent. Must pass selected object onto the form for initializing fields.
- * Called by SystemDialogAction's default run() method after dialog instantiated.
- */
- public void setInputObject(Object inputObject)
- {
- //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject + ", "+inputObject.getClass().getName());
- super.setInputObject(inputObject);
- if (newName != null)
- {
- initializeInput();
- }
- }
-
- private void initializeInput()
- {
- if (!initialized)
- {
- inputElement = getInputElement(inputObject);
- adapter = getViewAdapter(inputElement);
- if (adapter != null)
- inputName = adapter.getName(inputElement);
- else if (inputElement instanceof ISystemTypedObject)
- inputName = ((ISystemTypedObject)inputElement).getName();
- else if (inputElement instanceof IResource)
- inputName = ((IResource)inputElement).getName();
- else if (inputElement instanceof String)
- inputName = (String)inputElement;
- newName.setText(inputName);
-
- if (copyCollisionMode)
- {
- verbiageLabel.setText(SystemMessage.sub(SystemResources.RESID_COLLISION_RENAME_VERBIAGE, "&1", inputName)); //$NON-NLS-1$
- }
-
-
-
- if ((nameValidator == null) && (adapter != null))
- nameValidator = adapter.getNameValidator(inputElement);
- if (nameValidator != null)
- {
- int maxLen = nameValidator.getMaximumNameLength();
- if (maxLen != -1)
- newName.setTextLimit(maxLen);
- }
- // test if we need a unique name validator
- Shell shell = getShell();
- Display display = shell.getDisplay();
- if (display != null)
- display.asyncExec(this);
- else
- run();
-
- // the rename action for system filter pool reference selections is really
- // a rename of the actual pool, versus the reference...
- if (inputElement instanceof ISystemFilterPoolReference)
- {
- inputElement = ((ISystemFilterPoolReference)inputElement).getReferencedFilterPool();
- adapter = getViewAdapter(inputElement);
- }
-
- if (adapter != null)
- resourceTypeValue.setText(adapter.getType(inputElement));
- else if (inputElement instanceof ISystemTypedObject)
- resourceTypeValue.setText(((ISystemTypedObject)inputElement).getType());
- else if (inputElement instanceof IResource)
- {
- if ((inputElement instanceof IFolder) || (inputElement instanceof IProject))
- resourceTypeValue.setText(SystemViewResources.RESID_PROPERTY_FILE_TYPE_FOLDER_VALUE);
- else
- resourceTypeValue.setText(SystemViewResources.RESID_PROPERTY_FILE_TYPE_FILE_VALUE);
- }
- initialized = true;
- }
- }
-
- /**
- * Runnable method
- */
- public void run()
- {
- uniqueNameValidator = getUniqueNameValidator(inputElement, nameValidator);
- }
-
- /**
- * Given an input element and externally-suppplied name validator for it, determine if we
- * need to augment that validator with one that will check for uniqueness, and if so
- * create and return that uniqueness validator
- */
- protected ValidatorUniqueString getUniqueNameValidator(Object inputElement, ISystemValidator nameValidator)
- {
- ValidatorUniqueString uniqueNameValidator = null;
- ISystemRemoteElementAdapter ra = getRemoteAdapter(inputElement);
- if (ra != null)
- {
- isRemote = true;
- String[] names = null;
- boolean debug = false;
- boolean caseSensitive = ra.getSubSystem(inputElement).getSubSystemConfiguration().isCaseSensitive();
- boolean needUniqueNameValidator = !(nameValidator instanceof ISystemValidatorUniqueString);
- if (!needUniqueNameValidator)
- {
- String[] existingNames = ((ISystemValidatorUniqueString)nameValidator).getExistingNamesList();
- needUniqueNameValidator = ((existingNames == null) || (existingNames.length==0));
- }
- if (needUniqueNameValidator)
- {
- // Set the busy cursor to all shells.
- super.setBusyCursor(true);
- try {
- Shell shell = getShell();
- IRunnableContext irc = RSEUIPlugin.getTheSystemRegistryUI().getRunnableContext();
- RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
- names = ra.getRemoteParentNamesInUse(inputElement, null);
- RSEUIPlugin.getTheSystemRegistryUI().setRunnableContext(shell, irc);
- } catch (Exception exc) {SystemBasePlugin.logError("Exception getting parent's child names in rename dialog",exc);} //$NON-NLS-1$
- if ((names != null) && (names.length>0))
- {
- uniqueNameValidator = new ValidatorUniqueString(names,caseSensitive);
- uniqueNameValidator.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- if (debug)
- {
- System.out.println("Name validator set. Names = "); //$NON-NLS-1$
- for (int idx=0; idx<names.length; idx++)
- System.out.println("..."+idx+": "+names[idx]); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- // Restore cursor
- super.setBusyCursor(false);
- }
- }
- else
- isRemote = false;
- newName.setFocus();
- return uniqueNameValidator;
- }
-
- /**
- * Returns the selected element given the current input, which is
- * an IStructuredSelection.
- */
- protected Object getInputElement(Object inputObject)
- {
- if (inputObject instanceof IStructuredSelection)
- {
- inputObject = ((IStructuredSelection)inputObject).getFirstElement();
- }
- if (inputObject instanceof SystemSimpleContentElement)
- {
- inputObject = ((SystemSimpleContentElement)inputObject).getData();
- }
- return inputObject;
- }
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-
- /**
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- newNameString = newName.getText();
- if (!isRemote)
- newNameString = newNameString.trim();
- else
- newNameString = trimTrailing(newNameString); // defect 43173
- boolean closeDialog = verify();
- if (closeDialog)
- {
- if (inputElement instanceof IHost)
- {
- closeDialog = ValidatorConnectionName.validateNameNotInUse(newNameString, getShell());
- if (!closeDialog)
- newName.setFocus();
- }
- }
- if (closeDialog)
- {
- setOutputObject(newNameString);
- }
- return closeDialog;
- }
- /**
- * Trim leading blanks
- */
- public static String trimTrailing(String text)
- {
- return ("."+text).trim().substring(1); //$NON-NLS-1$
- }
-
- /**
- * Verifies all input.
- * @return true if there are no errors in the user input
- */
- public boolean verify()
- {
- if (copyCollisionMode && overwriteMode)
- return true;
-
- SystemMessage errMsg = null;
- Control controlInError = null;
- clearErrorMessage();
- errMsg = validateNameInput(newNameString);
- if (errMsg != null) {
- controlInError = newName;
- controlInError.setFocus();
- }
- else if (isRemote && checkIfWillBeFilteredOut(inputElement, newNameString)) {
- return false;
- }
- return (errMsg == null);
- }
-
- /**
- * If renaming a remote object, which is listed in a tree view under an expanded filter,
- * this tests to see if the rename will cause that object to suddenly not meet the filtering
- * criteria of the parent filter, and hence disappear. If so, issue warning message before
- * proceeding.
- * @return true if will be filtered out and user chose to cancel operation
- */
- protected boolean checkIfWillBeFilteredOut(Object remoteObject, String newName)
- {
- // after breaking my pick on this, I have decide it simply is too much work, and
- // too error-prone, to do. The reason is that we really cannot accurately determine
- // if the new name will meet the criteria of the filter, short of re-resolving the
- // filter and looking for the new name. That is just too expensive, I think. Phil.
- // See defect 42094.
- return false;
- /*
- boolean ok = false;
- // step 1: check if we are invoked from a tree view
- if (inputTreeViewer == null)
- return false;
- // step 2: check if the parent of the selected object is a filter
- if (inputTreeViewer.getSelectedParent() instanceof SystemFilterReference)
- {
- SystemFilterReference parentFilterRef = (SystemFilterReference)inputTreeViewer.getSelectedParent();
- SystemFilter parentFilter = parentFilterRef.getReferencedFilter();
- // step 3: check if the new name meets the criteria of the filter
- SubSystem ss = getRemoteAdapter(remoteObject).getSubSystem(remoteObject);
- boolean matches = ss.doesFilterMatch(parentFilter, newName);
- if (!matches)
- {
- // todo: issue warning msg 1311, and allow user to cancel operation
- }
- }
- return ok;
- */
- }
-
- /**
- * Called directly as user types.
- */
- protected SystemMessage validateNameInput()
- {
- newNameString = newName.getText();
- if (!isRemote)
- newNameString = newNameString.trim();
- else
- newNameString = trimTrailing(newNameString); // defect 43173
-
-
- return validateNameInput(newNameString);
- }
- /**
- * Called directly from verify.
- */
- protected SystemMessage validateNameInput(String theNewName)
- {
- errorMessage= null;
-
- if (theNewName == null)
- {
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY);
- }
- else
- {
- if (nameValidator != null)
- errorMessage= nameValidator.validate(theNewName);
- else if (theNewName.length() == 0)
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY);
- if (errorMessage == null)
- {
- if (adapter != null && adapter.namesAreEqual(inputElement, theNewName))
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_RENAME_OLDEQUALSNEW).makeSubstitution(inputName);
- }
- }
-
- if ((errorMessage == null) && (uniqueNameValidator != null))
- errorMessage = uniqueNameValidator.validate(theNewName);
- if(_namesInUse != null && _namesInUse.size()>0)
- {
- for(int i=0;i<_namesInUse.size();i++)
- {
- if(theNewName.equals(_namesInUse.get(i)))
- {
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_NOTUNIQUE);
- }
- }
- }
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- else
- clearErrorMessage();
- setPageComplete();
- return errorMessage;
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = false;
-
- if (copyCollisionMode && overwriteMode)
- {
- return true;
- }
-
-
- if (errorMessage == null)
- {
- String theNewName = newName.getText().trim();
- pageComplete = (theNewName.length() > 0);
- if (pageComplete && adapter != null)
- {
- pageComplete = !adapter.namesAreEqual(inputElement, theNewName);
- //System.out.println("back from namesAreEqual: " + pageComplete);
-
- }
- }
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
-
- /**
- * Returns the user-entered new name
- */
- public String getNewName()
- {
- return newNameString;
- }
-
- /**
- * Returns the user-entered new name as an array for convenience to ISystemRenameTarget hosts.
- */
- public String[] getNewNameArray()
- {
- String[] newNames = new String[1];
- newNames[0] = newNameString;
- return newNames;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- public String getDescription()
- {
- return this.description;
- }
-
- public void handleEvent(Event e)
- {
- Widget source = e.widget;
- if (source == overwriteRadio)
- {
- enableRename(!overwriteRadio.getSelection());
- }
- }
-
- private void enableRename(boolean flag)
- {
- if (newName != null)
- {
- renameLabel.setEnabled(flag);
- newName.setEnabled(flag);
-
- resourceTypePrompt.setEnabled(flag);
- resourceTypeValue.setEnabled(flag);
-
- overwriteMode = !flag;
- setPageComplete();
-
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java
deleted file mode 100644
index 0e2ed8ea9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectAnythingDialog.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [187543] added setViewerFilter() method
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.internal.ui.view.SystemViewForm;
-import org.eclipse.rse.ui.SystemActionViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-public class SystemSelectAnythingDialog extends SystemPromptDialog
- implements ISelectionChangedListener
-{
- private SystemViewForm _view = null;
- private Object _selected = null;
- private SystemActionViewerFilter _filter = null;
-
- public SystemSelectAnythingDialog(Shell shell, String title)
- {
- super(shell, title);
- }
-
- public Control createInner(Composite parent)
- {
-
- _view = new SystemViewForm(getShell(), parent, SWT.NONE, getInputProvider(), true, this);
- _view.getSystemTree().addSelectionChangedListener(this);
-
- if (_filter != null){
- _view.getSystemTree().addFilter(_filter);
- }
-
- return _view.getTreeControl();
- }
-
- public boolean close()
- {
- _view.removeSelectionChangedListener(this);
- _view.dispose();
- return super.close();
- }
-
- /**
- * Returns the initial input provider for the viewer.
- * Tries to deduce the appropriate input provider based on current input.
- */
- protected ISystemViewInputProvider getInputProvider()
- {
- ISystemViewInputProvider inputProvider = RSECorePlugin.getTheSystemRegistry();
-
- return inputProvider;
- }
-
- public Control getInitialFocusControl()
- {
- return _view.getTreeControl();
- }
-
- public Object getSelectedObject()
- {
- //IStructuredSelection selection = (IStructuredSelection)_view.getSelection();
- //return selection.getFirstElement();
- return _selected;
- }
-
- public void selectionChanged(SelectionChangedEvent e)
- {
- IStructuredSelection selection = (IStructuredSelection)e.getSelection();
-
- _selected = selection.getFirstElement();
- }
-
-
- /**
- * Use this method to limit the objects that are seen in the view of this
- * dialog.
- *
- * @param filter the filter that limits the visible objects
- * @since 3.0
- */
- public void setViewerFilter(SystemActionViewerFilter filter)
- {
- _filter = filter;
- if (_view != null)
- {
- _view.getSystemTree().addFilter(filter);
- }
-
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java
deleted file mode 100644
index aeaf56e9a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSelectFileTypesDialog.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.rse.internal.ui.GenericMessages;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-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.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FileEditorMappingContentProvider;
-import org.eclipse.ui.dialogs.FileEditorMappingLabelProvider;
-
-
-/**
- * A public implementation of the eclipse Select Types dialog.
- * <p>
- * File types are extension names without the dot.
- * For example "java" and "class".
- * <p>
- * Call getResult() to get the array of selected types.
- */
-public class SystemSelectFileTypesDialog
- extends SystemPromptDialog
- //extends TypeFilteringDialog
- implements ISystemMessageLine
-{
-
- protected Collection initialSelections;
-
- // instruction to show user
- protected String instruction;
-
- // the final collection of selected elements, or null if this dialog was cancelled
- protected Object[] result;
-
- // the visual selection widget group
- protected CheckboxTableViewer listViewer;
-
- // sizing constants
- protected final static int SIZING_SELECTION_WIDGET_HEIGHT = 250;
- protected final static int SIZING_SELECTION_WIDGET_WIDTH = 300;
-
- // TODO: Cannot use WorkbenchMessages -- it's internal
- protected final static String TYPE_DELIMITER = GenericMessages.TypesFiltering_typeDelimiter;
- protected Text userDefinedText;
-
- protected IFileEditorMapping[] currentInput;
-
- /**
- * Constructor when there are no existing types
- * @param shell The window hosting this dialog
- */
- public SystemSelectFileTypesDialog(Shell shell)
- {
- this(shell, new ArrayList());
- }
-
- /**
- * Constructor when there are existing types.
- * @param shell The window hosting this dialog
- * @param currentTypes The current types as a java.util.Collection. Typically ArrayList is used
- */
- public SystemSelectFileTypesDialog(Shell shell, Collection currentTypes)
- {
- // TODO: Cannot use WorkbenchMessages -- it's internal
- super(shell, GenericMessages.TypesFiltering_title);
- this.initialSelections = currentTypes;
- // TODO: Cannot use WorkbenchMessages -- it's internal
- setInstruction(GenericMessages.TypesFiltering_message);
-
- // TODO - hack to make this work in 3.1
- String id = PlatformUI.PLUGIN_ID + ".type_filtering_dialog_context"; //$NON-NLS-1$
- setHelp(id);
- }
-
- /**
- * Constructor when there are existing types.
- * @param shell The window hosting this dialog
- * @param currentTypes The current types as an array of Strings
- */
- public SystemSelectFileTypesDialog(Shell shell, String[] currentTypes)
- {
- this(shell, Arrays.asList(currentTypes));
- }
-
- /**
- * Method declared on Dialog.
- */
- protected Control createInner(Composite parent)
- {
- // page group
- Composite composite = (Composite)createInnerComposite(parent);
- createInstructionArea(composite);
-
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- listViewer.getTable().setLayoutData(data);
-
- listViewer.setLabelProvider(FileEditorMappingLabelProvider.INSTANCE);
- listViewer.setContentProvider(FileEditorMappingContentProvider.INSTANCE);
-
- addSelectionButtons(composite);
- createUserEntryGroup(composite);
- initializeViewer();
-
- // initialize page
- if (this.initialSelections != null && !this.initialSelections.isEmpty())
- checkInitialSelections();
-
- return composite;
- }
- /**
- * Return the Control to be given initial focus.
- * Child classes must override this, but can return null.
- */
- protected Control getInitialFocusControl()
- {
- return listViewer.getControl();
- }
-
- private Control createInnerComposite(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());
- return composite;
- }
-
- /**
- * Sets the instruction text for this dialog.
- *
- * @param instr the instruction text
- */
- public void setInstruction(String instr)
- {
- this.instruction = instr;
- }
- /**
- * Creates the message area for this dialog.
- * <p>
- * This method is provided to allow subclasses to decide where the message
- * will appear on the screen.
- * </p>
- *
- * @param composite the parent composite
- * @return the message label
- */
- protected Label createInstructionArea(Composite composite)
- {
- Label label = new Label(composite,SWT.NONE);
- label.setText(instruction);
- return label;
- }
-
- /**
- * Add the selection and deselection buttons to the dialog.
- * @param composite org.eclipse.swt.widgets.Composite
- */
- private void addSelectionButtons(Composite composite)
- {
- Composite buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
- data.grabExcessHorizontalSpace = true;
- composite.setData(data);
-
- //Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, GenericMessages.getString("WizardTransferPage.selectAll"), false); //$NON-NLS-1$
- Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
- SystemResources.RESID_SELECTFILES_SELECTALL_BUTTON_ROOT_LABEL, false);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- }
- };
- selectButton.addSelectionListener(listener);
-
-
- //Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, GenericMessages.getString("WizardTransferPage.deselectAll"), false); //$NON-NLS-1$
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
- SystemResources.RESID_SELECTFILES_DESELECTALL_BUTTON_ROOT_LABEL, false);
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
- }
- };
- deselectButton.addSelectionListener(listener);
- }
- /**
- * Add the currently-specified extensions.
- */
- protected void addUserDefinedEntries(java.util.List result)
- {
- StringTokenizer tokenizer = new StringTokenizer(userDefinedText.getText(), TYPE_DELIMITER);
- //Allow the *. and . prefix and strip out the extension
- while (tokenizer.hasMoreTokens())
- {
- String currentExtension = tokenizer.nextToken().trim();
- if (!currentExtension.equals("")) //$NON-NLS-1$
- {
- if (currentExtension.startsWith("*."))//$NON-NLS-1$
- result.add(currentExtension.substring(2));
- else
- {
- if (currentExtension.startsWith("."))//$NON-NLS-1$
- result.add(currentExtension.substring(1));
- else
- result.add(currentExtension);
- }
- }
- }
- }
- /**
- * Visually checks the previously-specified elements in this dialog's list
- * viewer.
- */
- protected void checkInitialSelections()
- {
-
- IFileEditorMapping editorMappings[] =
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- ArrayList selectedMappings = new ArrayList();
-
- for (int i = 0; i < editorMappings.length; i++)
- {
- IFileEditorMapping mapping = editorMappings[i];
- if (this.initialSelections.contains(mapping.getExtension()))
- {
- listViewer.setChecked(mapping, true);
- selectedMappings.add(mapping.getExtension());
- }
- }
-
- //Now add in the ones not selected to the user defined list
- Iterator initialIterator = this.initialSelections.iterator();
- StringBuffer entries = new StringBuffer();
- while(initialIterator.hasNext())
- {
- String nextExtension = (String) initialIterator.next();
- if(!selectedMappings.contains(nextExtension))
- {
- entries.append(nextExtension);
- entries.append(',');
- }
- }
- this.userDefinedText.setText(entries.toString());
- }
-
- /**
- * Create the group that shows the user defined entries for the dialog.
- * @param parent the parent this is being created in.
- */
- private void createUserEntryGroup(Composite parent)
- {
- // destination specification group
- Composite userDefinedGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- userDefinedGroup.setLayout(layout);
- userDefinedGroup.setLayoutData(
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
-
- // TODO: Cannot use WorkbenchMessages -- it's internal
- new Label(userDefinedGroup, SWT.NONE).setText(GenericMessages.TypesFiltering_otherExtensions);
-
- // user defined entry field
- userDefinedText = new Text(userDefinedGroup, SWT.SINGLE | SWT.BORDER);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- userDefinedText.setLayoutData(data);
-
- userDefinedText.addModifyListener(new ModifyListener()
- {
- public void modifyText(ModifyEvent event)
- {
- if (event.widget == userDefinedText)
- {
- //okButton.setEnabled(validateFileType(userDefinedText.getText().trim()));
- setPageComplete(validateFileType(userDefinedText.getText().trim()));
- }
- }
- });
-
- }
- /**
- * Return the input to the dialog.
- */
- protected IFileEditorMapping[] getInput()
- {
- //Filter the mappings to be just those with a wildcard extension
- if (currentInput == null)
- {
- java.util.List wildcardEditors = new ArrayList();
- IFileEditorMapping [] allMappings =
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- for (int i = 0; i < allMappings.length; i++)
- {
- if (allMappings[i].getName().equals("*"))//$NON-NLS-1$
- wildcardEditors.add(allMappings[i]);
- }
- currentInput = new IFileEditorMapping[wildcardEditors.size()];
- wildcardEditors.toArray(currentInput);
- }
- return currentInput;
- }
- /**
- * Initializes this dialog's viewer after it has been laid out.
- */
- private void initializeViewer()
- {
- listViewer.setInput(getInput());
- }
- /**
- * User pressed OK.
- */
- protected boolean processOK()
- {
- if (!validateFileType(userDefinedText.getText().trim()))
- return false;
-
- // Get the input children.
- IFileEditorMapping[] children = getInput();
- java.util.List list = new ArrayList();
- // Build a list of selected children.
- for (int i = 0; i < children.length; ++i)
- {
- IFileEditorMapping element = children[i];
- if (listViewer.getChecked(element))
- list.add(element.getExtension());
- }
- addUserDefinedEntries(list);
- setResult(list);
- return true;
- }
- /**
- * Set the selections made by the user, or <code>null</code> if
- * the selection was cancelled.
- *
- * @param newResult list of selected elements, or <code>null</code> if Cancel was
- * pressed
- */
- protected void setResult(java.util.List newResult)
- {
- if (newResult == null)
- {
- result = null;
- }
- else
- {
- result = new Object[newResult.size()];
- newResult.toArray(result);
- }
- }
-
- /**
- * Validate the user input for a file type
- */
- protected boolean validateFileType(String filename)
- {
- // We need kernel api to validate the extension or a filename
-
- // check for empty name and extension
- if (filename.length() == 0)
- {
- clearErrorMessage();
- return true;
- }
-
- // check for empty extension if there is no name
- int index = filename.indexOf('.');
- if (index == filename.length() - 1)
- {
- if (index == 0 || (index == 1 && filename.charAt(0) == '*'))
- {
- // TODO: Cannot use WorkbenchMessages -- it's internal
- setErrorMessage(GenericMessages.FileExtension_extensionEmptyMessage);
- return false;
- }
- }
-
- int startScan = 0;
- if (filename.startsWith("*.")) //$NON-NLS-1$
- startScan = 2;
-
- // check for characters before *
- // or no other characters
- // or next character not '.'
- index = filename.indexOf('*', startScan);
- if (index > -1)
- {
- if (filename.length() == 1)
- {
- // TODO: Cannot use WorkbenchMessages -- it's internal
- setErrorMessage(GenericMessages.FileExtension_extensionEmptyMessage);
- return false;
- }
- if (index != 0 || filename.charAt(1) != '.')
- {
- // TODO: Cannot use WorkbenchMessages -- it's internal
- setErrorMessage(GenericMessages.FileExtension_fileNameInvalidMessage);
- return false;
- }
- }
-
- clearErrorMessage();
- return true;
- }
-
- /**
- * Returns the list of selections made by the user, or <code>null</code> if
- * the selection was cancelled.
- *
- * @return the array of selected elements, or <code>null</code> if Cancel was
- * pressed
- */
- public Object[] getResult()
- {
- return result;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java
deleted file mode 100644
index 61d3bd210..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentElement.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import java.util.Vector;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-/**
- * When we populate a TreeViewer in a dialog, we need a simple
- * representation of the objects to populate the tree.
- * <p>
- * Works in concert with {@link org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider}
- * @see org.eclipse.rse.ui.dialogs.SystemSimpleContentElement
- * @see org.eclipse.rse.ui.dialogs.SystemSimpleSelectDialog
- */
-public class SystemSimpleContentElement
-{
- private String name;
- private Object data;
- private SystemSimpleContentElement parent;
- private SystemSimpleContentElement[] children;
- private ImageDescriptor imageDescriptor;
- private boolean selected = false;
- private boolean isDeletable = true;
- private boolean isRenamable = true;
- private boolean isReadonly = false;
-
- /**
- * Constructor when given children as an array.
- * @param name - the display name to show for this element
- * @param data - the real object which is to be contained by this element
- * @param parent - the parent element of this element. Pass null for the root.
- * @param children - an array of SystemSimpleContentElement objects that are to be the children of this element. Can be null.
- */
- public SystemSimpleContentElement(String name, Object data,
- SystemSimpleContentElement parent, SystemSimpleContentElement[] children)
- {
- setName(name);
- setData(data);
- setParent(parent);
- setChildren(children);
- }
- /**
- * Constructor when given children as a vector.
- * @param name - the display name to show for this element
- * @param data - the real object which is to be contained by this element
- * @param parent - the parent element of this element. Pass null for the root.
- * @param children - a vector of SystemSimpleContentElement objects that are to be the children of this element. Can be null.
- */
- public SystemSimpleContentElement(String name, Object data,
- SystemSimpleContentElement parent, Vector children)
- {
- setName(name);
- setData(data);
- setParent(parent);
- setChildren(children);
- }
-
- /**
- * Return the display name for this element
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Set the display name for this element
- */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /**
- * Return the real object which this element wraps or represents
- */
- public Object getData()
- {
- return data;
- }
-
- /**
- * Set the real object which this element wraps or represents
- */
- public void setData(Object data)
- {
- this.data = data;
- }
-
- /**
- * Get the parent element
- */
- public SystemSimpleContentElement getParent()
- {
- return parent;
- }
-
- /**
- * Set the parent element
- */
- public void setParent(SystemSimpleContentElement parent)
- {
- this.parent = parent;
- }
-
- /**
- * Walk up the parent tree until we find the root
- */
- public SystemSimpleContentElement getRoot()
- {
- SystemSimpleContentElement currParent = parent;
- while (currParent.getParent() != null)
- currParent = currParent.getParent();
- return currParent;
- }
-
- /**
- * Return the child elements, or null if no children
- */
- public SystemSimpleContentElement[] getChildren()
- {
- return children;
- }
-
- /**
- * Return true if this element has children
- */
- public boolean hasChildren()
- {
- return ((children!=null) && (children.length>0));
- }
-
- /**
- * Set the child elements of this element, as an array of SystemSimpleContentElement elements
- */
- public void setChildren(SystemSimpleContentElement[] children)
- {
- this.children = children;
- }
-
- /**
- * Set the child elements of this element, as a vector of SystemSimpleContentElement elements
- */
- public void setChildren(Vector childrenVector)
- {
- if (childrenVector != null)
- {
- children = new SystemSimpleContentElement[childrenVector.size()];
- for (int idx=0; idx<childrenVector.size(); idx++)
- children[idx] = (SystemSimpleContentElement)childrenVector.elementAt(idx);
- }
- else
- children = null;
- }
-
- /**
- * Set selected state.
- * Used in SimpleSimpleSelectDialog to pre-check item in CheckboxTreeViewer
- */
- public void setSelected(boolean selected)
- {
- this.selected = selected;
- }
- /**
- * Return true if this element has been flagged as selected.
- */
- public boolean isSelected()
- {
- return selected;
- }
-
- /**
- * Set whether this item is renamable or not. Default is true.
- * Used to enable/disable rename action.
- */
- public void setRenamable(boolean renamable)
- {
- this.isRenamable = renamable;
- }
- /**
- * Return true if this item is renamable or not. Default is true.
- */
- public boolean isRenamable()
- {
- return isRenamable;
- }
-
- /**
- * Set whether this item is deletable or not. Default is true.
- * Used to enable/disable rename action.
- */
- public void setDeletable(boolean deletable)
- {
- this.isDeletable = deletable;
- }
- /**
- * Return true if this item is deletable. Will be true unless setDeletable(false) has been called.
- */
- public boolean isDeletable()
- {
- return isDeletable;
- }
-
- /**
- * Set whether this node is readonly or not. If readonly, users cannot change its selected state.
- */
- public void setReadOnly(boolean readonly)
- {
- this.isReadonly = readonly;
- }
- /**
- * Return whether this node is readonly or not. Readonly nodes cannot be selected/deselected by the user.
- */
- public boolean isReadOnly()
- {
- return isReadonly;
- }
-
- /**
- * Set the image to display for this element, in the tree viewer
- */
- public void setImageDescriptor(ImageDescriptor imageDescriptor)
- {
- this.imageDescriptor = imageDescriptor;
- }
-
- /**
- * Get the image to display for this element, in the tree viewer
- */
- public ImageDescriptor getImageDescriptor()
- {
- if (imageDescriptor != null)
- return imageDescriptor;
- else
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FOLDER_ID);
- //return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
-
- /**
- * Delete the given child element.
- */
- public void deleteChild(SystemSimpleContentElement child)
- {
- if (children != null)
- {
- int nbrChildren = children.length;
- if ((nbrChildren == 1) && (child.equals(children[0])))
- children = null;
- else
- {
- SystemSimpleContentElement[] newChildren = new SystemSimpleContentElement[nbrChildren-1];
- int newIdx = 0;
- for (int idx=0; idx<children.length; idx++)
- if (!(children[idx].equals(child)))
- newChildren[newIdx++] = children[idx];
- children = newChildren;
- }
- }
- }
-
- /**
- * Add the given child element at the given zero-based position
- */
- public void addChild(SystemSimpleContentElement child, int pos)
- {
- if (children == null)
- {
- children = new SystemSimpleContentElement[1];
- children[0] = child;
- }
- else
- {
- int newNbr = children.length + 1;
- SystemSimpleContentElement[] newChildren = new SystemSimpleContentElement[newNbr];
- int oldIdx = 0;
- for (int idx=0; idx<newNbr; idx++)
- if (idx == pos)
- newChildren[idx] = child;
- else
- newChildren[idx] = children[oldIdx++];
- children = newChildren;
- }
- }
-
- /**
- * Maps to getName()
- */
- public String toString()
- {
- return getName();
- }
-
- /**
- * Find element corresponding to given data
- */
- public static SystemSimpleContentElement getDataElement(SystemSimpleContentElement root, Object data)
- {
- SystemSimpleContentElement[] children = root.getChildren();
- SystemSimpleContentElement match = null;
- if ((children!=null)&&(children.length>0))
- {
- for (int idx=0; (match==null)&&(idx<children.length); idx++)
- if (children[idx].getData() == data)
- match = children[idx];
- }
- if ((match==null)&&(children!=null)&&(children.length>0))
- {
- for (int idx=0; (match==null)&&(idx<children.length); idx++)
- match = getDataElement(children[idx], data);
- }
- return match;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentProvider.java
deleted file mode 100644
index 038d890c5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleContentProvider.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * When we need to populate a TreeViewer in a dialog,
- * we can use the {@link org.eclipse.rse.ui.dialogs.SystemSimpleContentElement} class to
- * represent each element, and then use this provider
- * to drive the tree.
- * @see org.eclipse.rse.ui.dialogs.SystemSimpleContentElement
- * @see org.eclipse.rse.ui.dialogs.SystemSimpleSelectDialog
- */
-public class SystemSimpleContentProvider extends LabelProvider
- implements ITreeContentProvider, ILabelProvider
-{
- private Map imageTable = new Hashtable(5);
-
- /**
- * Constructor for SystemSelectFilterPoolContentProvider
- */
- public SystemSimpleContentProvider()
- {
- super();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
- */
- public Object[] getChildren(Object element)
- {
- return getElement(element).getChildren();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object)
- */
- public Object getParent(Object element)
- {
- return getElement(element).getParent();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element)
- {
- Object[] children = getChildren(element);
- if (children == null)
- return false;
- else
- return children.length > 0;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object element)
- {
- return getChildren(element);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose()
- {
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- }
-
-
- // -------------------------
- // ILabelProvider methods...
- // -------------------------
- /**
- * Returns the image for the given object.
- */
- public Image getImage(Object element)
- {
- ImageDescriptor descriptor = getElement(element).getImageDescriptor();
- if (descriptor == null)
- return null;
- Image image = (Image) imageTable.get(descriptor);
- if (image == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- return image;
- }
- /**
- * Returns the label text for the given object.
- */
- public String getText(Object element)
- {
- return getElement(element).getName();
- }
-
-
- // -------------------------
- // Local/private methods...
- // -------------------------
- /**
- * Casts the given object to SystemSimpleContentElement
- */
- protected SystemSimpleContentElement getElement(Object element)
- {
- return (SystemSimpleContentElement)element;
- }
-
- /**
- * Returns the image for the given object, given its image descriptor
- */
- protected Image getImageFromDescriptor(ImageDescriptor descriptor)
- {
- if (descriptor == null)
- return null;
- //obtain the cached image corresponding to the descriptor
- Image image = (Image) imageTable.get(descriptor);
- if (image == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- return image;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleCopyDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleCopyDialog.java
deleted file mode 100644
index 330472d25..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleCopyDialog.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.ISystemCopyTargetSelectionCallback;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * Dialog for selecting a target location on a copy operation.
- */
-public class SystemSimpleCopyDialog
- extends SystemPromptDialog
- implements //ISystemPropertyConstants,
- ISelectionChangedListener
-{
- private String promptString;
- //private Label prompt;
- private TreeViewer tree;
- private SystemSimpleContentProvider provider = new SystemSimpleContentProvider();
- private SystemSimpleContentElement copyTreeContent, initialSelection;
- private ISystemCopyTargetSelectionCallback caller = null;
- public static final int MODE_COPY = 0;
- public static final int MODE_MOVE = 1;
- private Object targetContainer = null;
-
- /**
- * Constructor
- */
- public SystemSimpleCopyDialog(Shell shell, String prompt, int mode, ISystemCopyTargetSelectionCallback caller,
- SystemSimpleContentElement copyTreeContent, SystemSimpleContentElement selection)
- {
- //super(shell, title);
- super(shell, (mode==MODE_COPY ? SystemResources.RESID_COPY_TITLE : SystemResources.RESID_MOVE_TITLE));
- this.caller = caller;
- if (prompt == null)
- if (mode == MODE_COPY)
- prompt = SystemResources.RESID_COPY_PROMPT;
- else
- prompt = SystemResources.RESID_MOVE_PROMPT;
- promptString = prompt;
- this.copyTreeContent = copyTreeContent;
- this.initialSelection = selection;
- //setCancelButtonLabel(RSEUIPlugin.getString(BUTTON_CLOSE));
- //pack();
- }
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- /*ISystemMessageLine msgLine =*/ super.createMessageLine(c);
- return fMessageLine;
- }
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return tree.getControl();
- }
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 1;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // PROMPT
- /*prompt =*/ SystemWidgetHelpers.createLabel(composite_prompts, promptString);
-
- // WORK-WITH TREE
- tree = new TreeViewer(new Tree(composite_prompts, SWT.SINGLE | SWT.BORDER));
- GridData treeData = new GridData();
- treeData.horizontalAlignment = GridData.FILL;
- treeData.grabExcessHorizontalSpace = true;
- treeData.widthHint = 300;
- treeData.heightHint= 200;
- treeData.verticalAlignment = GridData.CENTER;
- treeData.grabExcessVerticalSpace = true;
- tree.getTree().setLayoutData(treeData);
-
- tree.setContentProvider(provider);
- tree.setLabelProvider(provider);
-
- // populate tree
- if (copyTreeContent != null)
- tree.setInput(copyTreeContent);
-
- // expand and pre-check
- if (initialSelection != null)
- tree.setSelection(new StructuredSelection(initialSelection),true);
-
- // preset the OK button
- setPageComplete();
-
- // add selection listener to tree
- tree.addSelectionChangedListener(this);
-
-
- //ActionContributionItem[] actionItems = createActionContributionItems();
- //Composite buttons = createButtonBar(composite_prompts, actionItems);
-
- //RSECorePlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
-
- return composite_prompts;
- }
-
- /**
- * ISelectionChangedListener method. Called when user changes selection in tree
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- SystemSimpleContentElement element = (SystemSimpleContentElement)sel.getFirstElement();
- element.setSelected(true);
- setPageComplete();
- }
-
- /**
- * Return current selection
- */
- public SystemSimpleContentElement getSelectedElement()
- {
- IStructuredSelection sel = (IStructuredSelection)tree.getSelection();
- if ((sel == null) || sel.isEmpty())
- return null;
- else
- return (SystemSimpleContentElement)sel.getFirstElement();
- }
- /**
- * Return true if something selected
- */
- public boolean isSelectionEmpty()
- {
- IStructuredSelection sel = (IStructuredSelection)tree.getSelection();
- return sel.isEmpty();
- }
-
- public void clearSelection()
- {
- tree.setSelection((ISelection)null);
- }
-
-
- /**
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- boolean closeDialog = verify();
- if (closeDialog)
- {
- SystemSimpleContentElement seldObj = getSelectedElement();
- if (seldObj != null)
- {
- targetContainer = seldObj.getData();
- setOutputObject(targetContainer);
- }
- else
- {
- closeDialog = false;
- setPageComplete(false);
- }
- }
- return closeDialog;
- }
-
- public boolean close()
- {
- //RSECorePlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
- return super.close();
- }
- /**
- * Verifies all input.
- * @return true if there are no errors in the user input
- */
- public boolean verify()
- {
-
- clearErrorMessage();
-/*
- if (errMsg != null)
- controlInError.setFocus();
- return (errMsg == null);
- */
- return true;
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = !isSelectionEmpty();
- if (pageComplete)
- {
- pageComplete = caller.isValidTargetParent(getSelectedElement());
- }
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
-
- /**
- * Callback from new action to get index of initial manager to select
- *
- public int getFilterPoolManagerSelection()
- {
- int selection = 0;
- SystemSimpleContentElement element = getSelectedElement();
- Object elementData = element.getData();
- if (elementData != null)
- {
- if (elementData instanceof SystemFilterPoolManager)
- selection = getManagerIndex((SystemFilterPoolManager)elementData);
- else if (elementData instanceof SystemFilterPool)
- selection = getManagerIndex(((SystemFilterPool)elementData).getSystemFilterPoolManager());
- }
- //System.out.println("In getFilterPoolManagerSelection(). Returning "+selection);
- return selection;
- }
- */
-
- // -----------------
- // OUTPUT METHODS...
- // -----------------
- /**
- * Get the selected target container
- */
- public Object getTargetContainer()
- {
- return targetContainer;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleSelectDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleSelectDialog.java
deleted file mode 100644
index 31dc8f31d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemSimpleSelectDialog.java
+++ /dev/null
@@ -1,489 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-
-/**
- * Dialog that uses a checkbox tree viewer to prompt users to select hierarchical items.
- * Works in concert with {@link org.eclipse.rse.ui.dialogs.SystemSimpleContentElement}
- * and {@link org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider}.
- * <p>
- * The {@link #setInputObject(SystemSimpleContentElement)} method is used to populate the selection tree:
- * <ul>
- * <li>The passed object must be of type SystemSimpleContentElement
- * <li>The method getChildren will be called on that object to get initial visible elements
- * <li>As user expands each item, getChildren() is progressively called
- * <li>The initial selection state of each item is determined by calling isSelected on that item
- * </ul>
- * <p>
- * The trick to using this is to first populate a hierarchy of SystemSimpleContentElement elements,
- * each one wrapping one of your own model objects, and then passing to this constructor the root
- * element.
- * <p>
- * Upon successful completion of this dialog (wasCancelled() returns false), the model is
- * updated to reflect the selections. Call getUpdatedContent() to return the root node, if need be,
- * and then walk the nodes. The selected items are those that return true
- * to {@link org.eclipse.rse.ui.dialogs.SystemSimpleContentElement#isSelected()}.
- *
- * @see org.eclipse.rse.ui.dialogs.SystemSimpleContentElement
- * @see org.eclipse.rse.ui.dialogs.SystemSimpleContentProvider
- */
-public class SystemSimpleSelectDialog extends SystemPromptDialog
- implements ICheckStateListener
-{
- private String promptString;
- //private Label prompt;
- private CheckboxTreeViewer tree;
- private SystemSimpleContentProvider provider = new SystemSimpleContentProvider();
- private SystemSimpleContentElement preSelectedRoot = null;
- private boolean initialized = false;
-
- /**
- * Constructor
- */
- public SystemSimpleSelectDialog(Shell shell, String title, String prompt)
- {
- super(shell, title);
- promptString = prompt;
- //pack();
- }
-
- /**
- * Set the root to preselect
- */
- public void setRootToPreselect(SystemSimpleContentElement preSelectedRoot)
- {
- this.preSelectedRoot = preSelectedRoot;
- }
-
- /**
- * Create message line. Intercept so we can set msg line of form.
- */
- protected ISystemMessageLine createMessageLine(Composite c)
- {
- /*ISystemMessageLine msgLine =*/ super.createMessageLine(c);
- //form.setMessageLine(msgLine);
- return fMessageLine;
- }
-
- /**
- * @see SystemPromptDialog#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- //checkNewTreeElements(provider.getElements(getInputObject()));
- //select the first element in the list
- //Object[] elements = (provider.getElements(getInputObject());
- //Object primary= elements.length > 0 ? elements[0] : null;
- //if (primary != null)
- // tree.setSelection(new StructuredSelection(primary));
-
- return tree.getControl();
- }
-
- /**
- * @see SystemPromptDialog#createInner(Composite)
- */
- protected Control createInner(Composite parent)
- {
- // Inner composite
- int nbrColumns = 1;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // PROMPT
- /*prompt =*/ SystemWidgetHelpers.createLabel(composite_prompts, promptString);
-
- // CHECKBOX SELECT TREE
- tree = new CheckboxTreeViewer(new Tree(composite_prompts, SWT.CHECK | SWT.BORDER));
- GridData treeData = new GridData();
- treeData.horizontalAlignment = GridData.FILL;
- treeData.grabExcessHorizontalSpace = true;
- treeData.widthHint = 300;
- treeData.heightHint= 300;
- treeData.verticalAlignment = GridData.FILL;
- treeData.grabExcessVerticalSpace = true;
- tree.getTree().setLayoutData(treeData);
-
- tree.setContentProvider(provider);
- tree.setLabelProvider(provider);
-
- // populate tree
- Object inputObject = getInputObject();
- if (inputObject != null)
- initializeInput((SystemSimpleContentElement)inputObject);
-
- // expand and pre-check
- tree.expandAll();
- tree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
-
- if (preSelectedRoot != null)
- tree.reveal(preSelectedRoot);
-
- // add selection listener to tree
- tree.addCheckStateListener(this);
-
- return composite_prompts;
- }
-
- /**
- * ICheckStateChangedListener method. Called when user changes selection in tree
- */
- public void checkStateChanged(CheckStateChangedEvent event)
- {
- SystemSimpleContentElement element = (SystemSimpleContentElement)event.getElement();
-
- if (element.isReadOnly())
- {
- tree.setChecked(element, element.isSelected());
- return;
- }
-
- boolean checked = event.getChecked();
- element.setSelected(checked);
-
- SystemSimpleContentElement parent = element.getParent();
- if (parent != null)
- {
- boolean gray = getShouldBeGrayed(parent);
- boolean check= getShouldBeChecked(parent);
- tree.setChecked(parent, check);
- tree.setGrayed(parent, gray);
- //System.out.println("...setting parent grayed, checked to " + gray + ", " + check);
- }
-
-
- // On check, check all children
- if (checked)
- {
- tree.setSubtreeChecked(element, true);
- checkSubtreeModel(element, true);
- //System.out.println("...setting setSubtreeChecked true for " + element);
- return;
- }
- // On uncheck & gray, remain check but ungray
- // and check all its children
- if (tree.getGrayed(element))
- {
- tree.setChecked(element, true);
- tree.setGrayed(element, false);
- tree.setSubtreeChecked(element, true);
- checkSubtreeModel(element, true);
- //System.out.println("...setting setChecked(true), setGrayed(false) for " + element);
- //System.out.println("...setting setSubtreeChecked true for " + element);
- return;
- }
- // On uncheck & not gray, uncheck all its children
- tree.setSubtreeChecked(element, false);
- checkSubtreeModel(element, false);
- //System.out.println("...setting setSubtreeChecked false for " + element);
- }
-
- private void checkSubtreeModel(SystemSimpleContentElement parent, boolean check)
- {
- parent.setSelected(check);
- SystemSimpleContentElement[] childElements = parent.getChildren();
- if (childElements != null)
- {
- for (int idx=0; idx<childElements.length; idx++)
- {
- //childElements[idx].setSelected(check);
- checkSubtreeModel(childElements[idx],check);
- }
- }
- }
-
-
- /**
- * Override of parent. We only support a specific type of input, so we test for it and
- * throw it out if we don't get it. This is necessary to defeat some default action.
- * Called by SystemDialogAction's default run() method after dialog instantiated.
- */
- public void setInputObject(Object inputObject)
- {
- if (inputObject instanceof SystemSimpleContentElement)
- setInputObject((SystemSimpleContentElement)inputObject);
- else
- System.out.println("UNEXPECTED INPUT IN SYSTEMSELECTINPUTDIALOG: "+inputObject); //$NON-NLS-1$
- }
-
- /**
- * Override of parent. Must pass selected object onto the form for initializing fields.
- * Called by SystemDialogAction's default run() method after dialog instantiated.
- */
- public void setInputObject(SystemSimpleContentElement inputObject)
- {
- //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject + ", "+inputObject.getClass().getName());
- super.setInputObject(inputObject);
- initializeInput(inputObject);
- }
-
- /**
- * Set the tree input, initialize checked state
- */
- private void initializeInput(SystemSimpleContentElement inputObject)
- {
- if ((tree != null) && !initialized)
- {
- tree.setInput(inputObject);
- SystemSimpleContentElement[] gray = getPreGrayedElements(inputObject,null);
- SystemSimpleContentElement[] check= getPreSelectedElements(inputObject,null);
- SystemSimpleContentElement[] disable= getReadOnlyElements(inputObject,null);
- tree.setCheckedElements(check);
- tree.setGrayedElements(gray);
- if ((disable != null) && (disable.length>0))
- {
- for (int idx=0; idx<disable.length; idx++)
- {
- SystemSimpleContentElement currElement = disable[idx];
- tree.setGrayed(currElement, true); // so it appears readonly
- }
- }
-
- if (preSelectedRoot != null)
- tree.setSelection(new StructuredSelection(preSelectedRoot), true);
-
- initialized = true;
- }
- }
-
- /**
- * Determine, recursively, the tree elements pre-determined to be read-only
- */
- private SystemSimpleContentElement[] getReadOnlyElements(SystemSimpleContentElement input, Vector oldV)
- {
- Vector v = (oldV==null) ? new Vector() : oldV;
- SystemSimpleContentElement[] children = (SystemSimpleContentElement[])provider.getElements(input);
- if (children != null)
- for (int idx = 0; idx<children.length; idx++)
- {
- if (children[idx].isReadOnly())
- {
- v.addElement(children[idx]);
- //System.out.println("Adding readOnly element: " + children[idx]);
- }
- getReadOnlyElements(children[idx], v);
- }
-
- if (oldV != null)
- return null;
-
- SystemSimpleContentElement[] readonlyArray = new SystemSimpleContentElement[v.size()];
- for (int idx=0; idx<readonlyArray.length; idx++)
- readonlyArray[idx] = (SystemSimpleContentElement)v.elementAt(idx);
- return readonlyArray;
- }
-
- /**
- * Determine, recursively, the tree elements pre-determined for selection
- */
- private SystemSimpleContentElement[] getPreSelectedElements(SystemSimpleContentElement input, Vector oldV)
- {
- Vector v = (oldV==null) ? new Vector() : oldV;
- SystemSimpleContentElement[] children = (SystemSimpleContentElement[])provider.getElements(input);
- if (children != null)
- for (int idx = 0; idx<children.length; idx++)
- {
- if (children[idx].isSelected())
- {
- v.addElement(children[idx]);
- //System.out.println("Adding checked element: " + children[idx]);
- }
- getPreSelectedElements(children[idx], v);
- }
-
- if (oldV != null)
- return null;
-
- SystemSimpleContentElement[] selected = new SystemSimpleContentElement[v.size()];
- for (int idx=0; idx<selected.length; idx++)
- selected[idx] = (SystemSimpleContentElement)v.elementAt(idx);
- return selected;
- }
-
- /**
- *
- */
- private SystemSimpleContentElement[] getPreGrayedElements(SystemSimpleContentElement input, Vector oldV)
- {
- Vector v = (oldV==null) ? new Vector() : oldV;
- SystemSimpleContentElement[] children = (SystemSimpleContentElement[])provider.getElements(input);
- boolean allSame = true;
- boolean currState = false;
- boolean hasGrayChildren = false;
- if ((children != null) && (children.length>0))
- {
- currState = children[0].isSelected();
- for (int idx = 0; idx<children.length; idx++)
- {
- if (allSame && (currState != children[idx].isSelected()))
- allSame = false;
- //if (children[idx].isSelected())
- // v.addElement(children[idx]);
- int oldSize = v.size();
- getPreGrayedElements(children[idx], v); // recursively check children's children
- if (v.size() != oldSize) // add any new items?
- hasGrayChildren = true;
- }
- if (!allSame || hasGrayChildren) // some children checked, others not checked? Or any child grayed out?
- {
- v.addElement(input); // gray out this parent
- input.setSelected(true); // select this parent
- //System.out.println("Adding grayed element: " + input);
- }
- else if (allSame && currState)
- input.setSelected(true); // select this parent
- } // if no children, do not gray
-
- if (oldV != null)
- return null;
-
- SystemSimpleContentElement[] grayed = new SystemSimpleContentElement[v.size()];
- for (int idx=0; idx<grayed.length; idx++)
- grayed[idx] = (SystemSimpleContentElement)v.elementAt(idx);
- return grayed;
- }
-
- /**
- * Dynamically determine grayed state of parent element
- */
- public boolean getShouldBeGrayed(SystemSimpleContentElement parent)
- {
- SystemSimpleContentElement[] children = parent.getChildren();
- boolean gray = false;
-
- if ((children == null) || (children.length == 0))
- return gray;
-
- boolean allSame = true;
- boolean currState = children[0].isSelected();
- boolean hasGrayChildren = false;
-
- for (int idx=0; idx<children.length; idx++)
- {
- if (allSame && (children[idx].isSelected() != currState))
- allSame = false;
- if (getShouldBeGrayed(children[idx]))
- hasGrayChildren = true;
- }
-
- if (!allSame || hasGrayChildren) // some children checked, others not checked? Or any child grayed out?
- gray = true;
-
- return gray;
- }
-
- /**
- * Dynamically determine checked state of parent element
- */
- public boolean getShouldBeChecked(SystemSimpleContentElement parent)
- {
- boolean checked = false;
-
- SystemSimpleContentElement[] children = parent.getChildren();
- boolean gray = false;
-
- if ((children == null) || (children.length == 0))
- return gray;
-
- boolean anyChecked = false;
- for (int idx=0; idx<children.length; idx++)
- {
- if (children[idx].isSelected())
- anyChecked = true;
- else
- {
- }
- }
-
- if (anyChecked)
- checked = true;
-
- return checked;
- }
-
- /**
- * Return updated input model
- */
- public SystemSimpleContentElement getUpdatedContent()
- {
- return (SystemSimpleContentElement)super.getInputObject();
- }
- /**
- * Called when user presses OK button.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- protected boolean processOK()
- {
- //newNameString = newName.getText().trim();
- boolean closeDialog = verify();
- if (closeDialog)
- {
- }
- return closeDialog;
- }
- /**
- * Verifies all input.
- * @return true if there are no errors in the user input
- */
- public boolean verify()
- {
-
- clearErrorMessage();
-/*
- if (errMsg != null)
- controlInError.setFocus();
- return (errMsg == null);
- */
- return true;
- }
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = true;
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java
deleted file mode 100644
index 7df9ba5ec..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemWizardDialog.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - API consistency.
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
- ********************************************************************************/
-
-package org.eclipse.rse.ui.dialogs;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.ProgressMonitorPart;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.wizards.ISystemWizard;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Base wizard dialog class. Extends Eclipse WizardDialog class to add
- * support for the ISystemPromptDialog interface methods. These make it
- * easy to pass an input object to your wizard, if your wizard implements
- * ISystemWizard.
- * <p>This class is most effective when used together with {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard} and
- * with {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction}. Indeed,
- * if you use SystemBaseWizardAction, this class is automatically used for the dialog. It supports
- * propogation of information from the action, to the wizard, to the wizard dialog and to the wizard pages.
- * </p>
- * <p>The advantages to using this class versus the base JFace WizardDialog class is:
- * </p>
- * <ul>
- * <li>Supports settings of an input object, which is propogated to the wizard and its pages.
- * <li>Supports querying of an output object, as set by the wizard.
- * <li>Supports a {@link #wasCancelled()} method for callers to know if the wizard was dismissed or cancelled by the user.
- * <li>Supports setting of the overall contextual help, which is propogated to each page.
- * <li>Supports an {@link #updateSize(IWizardPage)} method that can be called by a page when it dynamically grows the page size.
- * <li>When a progress monitor is not required, the real estate for the monitor is reclaimed, reducing the size of the wizard
- * <li>Whan a progress monitor is required, registers this with the RSE system registry, so it is using for long-running remote communications requests.
- * </ul>
- *
- * <p>To use this class, simply instantiate it, passing a wizard that implements {@link org.eclipse.rse.ui.wizards.ISystemWizard},
- * which {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard} does. If you use {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction},
- * then this is done for you.
- *
- * @see org.eclipse.rse.ui.wizards.AbstractSystemWizard
- * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction
- */
-public class SystemWizardDialog extends WizardDialog implements ISystemPromptDialog {
- protected String helpId;
-
- /**
- * Constructor
- */
- public SystemWizardDialog(Shell shell, IWizard wizard) {
- this(shell, wizard, null);
- }
-
- /**
- * Constructor two. Use when you have an input object at instantiation time.
- */
- public SystemWizardDialog(Shell shell, IWizard wizard, Object inputObject) {
- super(shell, wizard);
- if (wizard instanceof ISystemWizard) {
- ((ISystemWizard)wizard).setSystemWizardDialog(this);
- if (inputObject != null)
- setInputObject(inputObject);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#setInputObject(java.lang.Object)
- */
- public void setInputObject(Object inputObject) {
- if (getWizard() instanceof ISystemWizard) ((ISystemWizard)getWizard()).setInputObject(inputObject);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#getInputObject()
- */
- public Object getInputObject() {
- return getWizard() instanceof ISystemWizard ? ((ISystemWizard)getWizard()).getInputObject() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#getOutputObject()
- */
- public Object getOutputObject() {
- return getWizard() instanceof ISystemWizard ? ((ISystemWizard)getWizard()).getOutputObject() : null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#setOutputObject(java.lang.Object)
- */
- public void setOutputObject(Object outputObject) {
- if (getWizard() instanceof ISystemWizard) ((ISystemWizard)getWizard()).setOutputObject(outputObject);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.dialogs.ISystemPromptDialog#wasCancelled()
- */
- public boolean wasCancelled() {
- //System.out.println("Inside wasCancelled of SystemWizardDialog: " + wizard.wasCancelled());
- return getWizard() instanceof ISystemWizard ? ((ISystemWizard)getWizard()).wasCancelled() : false;
- }
-
- /**
- * Set the help context id for this wizard dialog
- */
- public void setHelp(String id) {
- helpId = id;
- if (getWizard() instanceof ISystemWizard) ((ISystemWizard)getWizard()).setHelp(id);
- }
-
- /**
- * Get the help context id for this wizard dialog, as set in setHelp
- */
- public String getHelpContextId() {
- return helpId;
- }
-
- /**
- * Intercept of parent method so we can automatically register the wizard's progress monitor
- * with the SystemRegistry for all framework progress monitor requests, if user has specified
- * they need a progress monitor for this wizard.
- */
- protected Control createDialogArea(Composite parent) {
- boolean needsMonitor = getWizard().needsProgressMonitor();
- Control ctrl = super.createDialogArea(parent);
- if (!needsMonitor) {
- IProgressMonitor pm = getProgressMonitor();
- ((ProgressMonitorPart)pm).dispose();
- }
- if (needsMonitor && RSECorePlugin.isTheSystemRegistryActive()) {
- RSEUIPlugin.getTheSystemRegistryUI().setRunnableContext(getShell(), this);
- // add a dispose listener
- getShell().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- RSEUIPlugin.getTheSystemRegistryUI().clearRunnableContext();
- }
- });
- }
- return ctrl;
- }
-
- /**
- * Exposes this nice new 2.0 capability to the public.
- */
- public void updateSize(IWizardPage page) {
- super.updateSize(page);
- }
-
- /**
- * Expose inherited protected method convertWidthInCharsToPixels as a publicly
- * excessible method
- */
- public int publicConvertWidthInCharsToPixels(int chars) {
- return convertWidthInCharsToPixels(chars);
- }
-
- /**
- * Expose inherited protected method convertHeightInCharsToPixels as a publicly
- * excessible method
- */
- public int publicConvertHeightInCharsToPixels(int chars) {
- return convertHeightInCharsToPixels(chars);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemChangeFilterPaneEditPaneSupplier.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemChangeFilterPaneEditPaneSupplier.java
deleted file mode 100644
index 1fd566378..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemChangeFilterPaneEditPaneSupplier.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [226561] add API markup to javadoc
- ********************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The SystemChangeFilterPane class is used in both SystemChangeFilterDialog and
- * in SystemChangeFilterPropertyPage. The pane relies on both of these to supply
- * the edit pane (for historical reasons, so we don't break previous contracts).
- * This interface is implemented by both classes, for supplying that edit pane.
- * @noimplement This interface is not intended to be implemented by clients.
- * The standard implementations are included in the framework.
- */
-public interface ISystemChangeFilterPaneEditPaneSupplier
-{
- /**
- * Return the filter string edit pane.
- */
- public SystemFilterStringEditPane getFilterStringEditPane(Shell shell);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemFilterStringEditPaneListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemFilterStringEditPaneListener.java
deleted file mode 100644
index d00af2225..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/ISystemFilterStringEditPaneListener.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-/**
- * This listener interface is implemented by any code desired to be kept aware
- * of all user changes to a filter string in the SystemFilterStringEditPane.
- */
-public interface ISystemFilterStringEditPaneListener
-{
-
- /**
- * Callback method. The user has changed the filter string. It may or may not
- * be valid. If not, the given message is non-null. If it is, and you want it,
- * call getSystemFilterString() in the edit pane.
- */
- public void filterStringChanged(SystemMessage message);
-
- /**
- * Callback method. We are about to do a verify,the side effect of which is to
- * change the current state of the dialog, which we don't want. This tells the
- * dialog to back up that state so it can be restored.
- */
- public void backupChangedState();
-
- /**
- * Callback method. After backup and change events this is called to restore state
- */
- public void restoreChangedState();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java
deleted file mode 100644
index d67603450..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemChangeFilterPane.java
+++ /dev/null
@@ -1,1440 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [226561] add API markup to javadoc
- * David McKnight(IBM) - [239257] Tooltip for Filter Pool label is incorrect
- * Kevin Doyle (IBM) - [235223] Duplicate Filter Strings
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemChangeFilterActionCopyString;
-import org.eclipse.rse.internal.ui.actions.SystemChangeFilterActionDeleteString;
-import org.eclipse.rse.internal.ui.actions.SystemChangeFilterActionMoveStringDown;
-import org.eclipse.rse.internal.ui.actions.SystemChangeFilterActionMoveStringUp;
-import org.eclipse.rse.internal.ui.actions.SystemChangeFilterActionPasteString;
-import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ISystemValidatorUniqueString;
-import org.eclipse.rse.ui.validators.ValidatorFilterString;
-import org.eclipse.rse.ui.widgets.ISystemEditPaneStates;
-import org.eclipse.rse.ui.widgets.SystemEditPaneStateMachine;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-
-
-/**
- * Since we have decided to allow the same editing in both the Change Filter dialog
- * and the Properties page, we have to abstract the meat of the change filter dialog
- * into a re-usable composite. That is what this is, and it is used by both the
- * dialog and the property page.
- * @noextend This class is not intended to be subclassed by clients.
- * This class is complete and should be used as is.
- */
-public class SystemChangeFilterPane extends SystemBaseForm
- implements SelectionListener, ISystemFilterStringEditPaneListener, IMenuListener
-{
-
- protected Button applyButton, revertButton, testButton;
- protected SystemEditPaneStateMachine sm;
- protected List listView;
- protected Label filterNameLabel, filterPoolNameLabel, fsLabel;
- // context menu actions support
- private SystemChangeFilterActionCopyString copyAction;
- private SystemChangeFilterActionPasteString pasteAction;
- private SystemChangeFilterActionDeleteString deleteAction;
- private SystemChangeFilterActionMoveStringUp moveUpAction;
- private SystemChangeFilterActionMoveStringDown moveDownAction;
- private MenuManager menuMgr;
- private Clipboard clipboard;
- private boolean menuListenerAdded;
-
- // inputs
- protected ISystemChangeFilterPaneEditPaneSupplier editPaneSupplier;
- protected ISystemFilter inputFilter;
- protected ISystemFilterPoolReferenceManagerProvider refProvider;
- protected ISystemFilterPoolManagerProvider provider;
- protected String namePromptLabel, namePromptTip;
- protected String poolPromptLabel, poolPromptTip;
- protected String listPromptLabel, listPromptTip;
- protected String newEntryLabel;
-
- protected ISystemValidator filterStringValidator = null;
- protected SystemMessage duplicateFilterStringMsg;
- protected boolean wantTestButton;
- protected boolean editable = true;
-
- // state
- protected boolean caseSensitiveStrings = false;
- protected boolean allowDuplicateStrings = false;
- protected boolean ignoreEvents = false;
- protected boolean resetting = false;
- protected boolean giveEditorFocus = true;
- protected boolean showingNew = true;
- protected boolean supportsMultipleStrings = true;
- protected String[] listItems;
-
- /**
- * Constructor.
- */
- public SystemChangeFilterPane(Shell shell, ISystemMessageLine msgLine, ISystemChangeFilterPaneEditPaneSupplier editPaneSupplier)
- {
- super(shell, msgLine);
- this.editPaneSupplier = editPaneSupplier;
-
-
- // default mri values
- namePromptLabel = SystemResources.RESID_CHGFILTER_NAME_LABEL;
- namePromptTip = SystemResources.RESID_CHGFILTER_NAME_TOOLTIP;
- poolPromptLabel = SystemResources.RESID_CHGFILTER_POOL_LABEL;
- poolPromptTip = SystemResources.RESID_CHGFILTER_POOL_TOOLTIP;
- listPromptLabel = SystemResources.RESID_CHGFILTER_LIST_LABEL;
- listPromptTip = SystemResources.RESID_CHGFILTER_LIST_TOOLTIP;
- }
-
- // INPUT/CONFIGURATION
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool reference manager provider. Will be non-null if the
- * current selection is a reference to a filter pool or filter, or a reference manager
- * provider.
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- this.refProvider = provider;
- }
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool manager provider. Will be non-null if the
- * current selection is a filter pool or filter, or reference to them, or a manager provider.
- * Generally this is called when the setSystemFilterPoolReferenceManagerProvider can't be called
- * for some reason.
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
- {
- this.provider = provider;
- }
-
- /**
- * <i>Configuration method</i><br>
- * Set the Parent Filter Pool prompt label and tooltip text.
- */
- public void setParentPoolPromptLabel(String label, String tip)
- {
- this.poolPromptLabel = label;
- this.poolPromptTip = tip;
- }
- /**
- * Return the parent filter pool prompt label, as set by {@link #setParentPoolPromptLabel(String, String)}
- */
- public String getParentPoolPromptLabel()
- {
- return poolPromptLabel;
- }
- /**
- * Return the parent filter pool prompt tip, as set by {@link #setParentPoolPromptLabel(String, String)}
- */
- public String getParentPoolPromptTip()
- {
- return poolPromptTip;
- }
-
- /**
- * <i>Configuration method</i><br>
- * Set the name prompt label and tooltip text.
- */
- public void setNamePromptLabel(String label, String tip)
- {
- this.namePromptLabel = label;
- this.namePromptTip = tip;
- }
- /**
- * Return the name prompt label as set by {@link #setNamePromptLabel(String, String)}
- */
- public String getNamePromptLabel()
- {
- return namePromptLabel;
- }
- /**
- * Return the name prompt tip as set by {@link #setNamePromptLabel(String, String)}
- */
- public String getNamePromptTip()
- {
- return namePromptTip;
- }
-
- /**
- * <i>Configuration method</i><br>
- * Set the label shown in group box around the filter string list, and the tooltip text for the
- * list box.
- */
- public void setListLabel(String label, String tip)
- {
- this.listPromptLabel = label;
- this.listPromptTip = tip;
- }
- /**
- * Return list label as set by {@link #setListLabel(String, String)}
- */
- public String getListLabel()
- {
- return listPromptLabel;
- }
- /**
- * Return list tip as set by {@link #setListLabel(String, String)}
- */
- public String getListTip()
- {
- return listPromptTip;
- }
-
- /**
- * Set the string to show as the first item in the list.
- * The default is "New filter string"
- */
- public void setNewListItemText(String label)
- {
- this.newEntryLabel = label;
- }
- /**
- * Return the text for the list item, as set by {@link #setNewListItemText(String)},
- * or the default if not set.
- */
- public String getNewListItemText()
- {
- return (newEntryLabel != null) ? newEntryLabel : SystemResources.RESID_CHGFILTER_LIST_NEWITEM;
- }
-
- /**
- * <i>Configuration method</i><br>
- * Call this to specify a validator for the filter string. It will be called per keystroke.
- * A default validator is supplied otherwise: ValidatorFilterString.
- * <p>
- * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
- * <p>
- * Alternatively, if all you want is a unique error message for the case when duplicates are found,
- * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
- */
- public void setFilterStringValidator(ISystemValidator v)
- {
- filterStringValidator = v;
- }
- /**
- * Return the result of {@link #setFilterStringValidator(ISystemValidator)}.
- */
- public ISystemValidator getFilterStringValidator()
- {
- return filterStringValidator;
- }
- /**
- * <i>Configuration method</i><br>
- * Set the error message to use when the user is editing or creating a filter string, and the
- * Apply processing detects a duplicate filter string in the list.
- */
- public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
- {
- this.duplicateFilterStringMsg = msg;
- }
- /**
- * Return results of {@link #setDuplicateFilterStringErrorMessage(SystemMessage)}
- */
- public SystemMessage getDuplicateFilterStringErrorMessage()
- {
- return duplicateFilterStringMsg;
- }
- /**
- * <i>Configuration method</i><br>
- * Specify if you want to include a test button or not. Appears with "Apply" and "Reset"
- */
- public void setWantTestButton(boolean wantTestButton)
- {
- this.wantTestButton = wantTestButton;
- }
- /**
- * Return whether a test button is wanted or not, as set by {@link #setWantTestButton(boolean)}
- */
- public boolean getWantTestButton()
- {
- return wantTestButton;
- }
-
- /**
- * Set if the edit pane is not to be editable
- */
- public void setEditable(boolean editable)
- {
- this.editable = editable;
- this.showingNew = editable;
- }
- /**
- * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)}
- */
- public boolean getEditable()
- {
- return editable;
- }
- /**
- * Set if the user is to be allowed to create multiple filter strings or not. Default is true
- */
- public void setSupportsMultipleStrings(boolean multi)
- {
- this.showingNew = multi;
- this.supportsMultipleStrings = multi;
- }
- /**
- * Return whether the user is to be allowed to create multiple filter strings or not. Default is true
- */
- public boolean getSupportsMultipleStrings()
- {
- return supportsMultipleStrings;
- //return (!showingNew && editable);
- }
-
- // LIFECYCLE
- /**
- * Intercept of parent so we can set the input filter, and deduce whether
- * strings are case sensitive and if duplicates are allowed.<br>
- * Not typically overridden, but if you do, be sure to call super!
- */
- public void setInputObject(Object inputObject)
- {
- //System.out.println("INSIDE SETINPUTOBJECT: " + inputObject);
- super.setInputObject(inputObject);
- inputFilter = getSystemFilter(inputObject);
- caseSensitiveStrings = inputFilter.areStringsCaseSensitive();
- allowDuplicateStrings = inputFilter.supportsDuplicateFilterStrings();
- }
-
- /**
- * Returns the control (the list view) to recieve initial focus control
- */
- public Control getInitialFocusControl()
- {
- return listView;
- }
- /**
- * Populates the content area
- */
- public Control createContents(Composite parent)
- {
- SystemWidgetHelpers.setHelp(parent, RSEUIPlugin.HELPPREFIX+"dufr0000"); //$NON-NLS-1$
-
- if (getShell()==null)
- setShell(parent.getShell());
- SystemFilterStringEditPane editpane = getFilterStringEditPane(getShell());
- editpane.setSystemFilterPoolReferenceManagerProvider(refProvider);
- editpane.setSystemFilterPoolManagerProvider(provider);
- editpane.setChangeFilterMode(true);
-
- // Inner composite
- int nbrColumns = 2;
- Composite composite = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // composite at top to hold readonly info
- //Composite topComposite = SystemWidgetHelpers.createFlushComposite(composite, 2);
- //((GridData)topComposite.getLayoutData()).horizontalSpan = nbrColumns;
- Composite topComposite = composite;
- // filter name
- SystemWidgetHelpers.createLabel(topComposite, namePromptLabel);
- filterNameLabel = SystemWidgetHelpers.createLabel(topComposite, ""); //$NON-NLS-1$
- filterNameLabel.setToolTipText(namePromptTip);
- filterNameLabel.setText(inputFilter.getName());
- // filter pool
- SystemWidgetHelpers.createLabel(topComposite, poolPromptLabel);
- filterPoolNameLabel = SystemWidgetHelpers.createLabel(topComposite, ""); //$NON-NLS-1$
- filterPoolNameLabel.setToolTipText(poolPromptTip);
- ISystemFilterPool parentPool = inputFilter.getParentFilterPool();
- filterPoolNameLabel.setText(parentPool.getName());
-
- addFillerLine(composite, nbrColumns);
-
- // create list view on left
- if (supportsMultipleStrings)
- {
- listView = SystemWidgetHelpers.createListBox(composite, listPromptLabel, null, false, 1);
- //listView.setToolTipText(listPromptTip); VERY ANNOYING
- GridData data = (GridData)listView.getLayoutData();
- data.grabExcessHorizontalSpace = false;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessVerticalSpace = true;
- data.verticalAlignment = GridData.FILL;
- data.widthHint = 130;
- }
- String[] strings = inputFilter.getFilterStrings();
- if (strings == null)
- strings = new String[] {};
- int delta = (showingNew ? 1 : 0);
- listItems = new String[delta+strings.length];
- if (showingNew)
- listItems[0] = getNewListItemText(); // "New filter string" or caller-supplied
- for (int idx=0; idx<strings.length; idx++)
- listItems[idx+delta] = strings[idx];
- if (listView != null)
- listView.setItems(listItems);
-
- // we want the tree view on the left to extend to the bottom of the page, so on the right
- // we create a 1-column composite that will hold the edit pane on top, and the apply/revert
- // buttons on the bottom...
- Composite rightSideComposite = SystemWidgetHelpers.createFlushComposite(composite, 1);
- if (listView == null)
- {
- GridData data = (GridData)rightSideComposite.getLayoutData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = nbrColumns;
- }
-
- // now add a top spacer line and visual separator line, for the right side
- if (listView != null)
- {
- addFillerLine(rightSideComposite, 1);
- fsLabel = SystemWidgetHelpers.createLabel(rightSideComposite, ""); //$NON-NLS-1$
- addSeparatorLine(rightSideComposite,1);
- }
-
- // now populate top of right-side composite with edit pane...
- Control editPaneComposite = editpane.createContents(rightSideComposite);
- if (!allowDuplicateStrings && (filterStringValidator == null))
- {
- String[] existingStrings = inputFilter.getFilterStrings();
- if (existingStrings!=null)
- {
- filterStringValidator = new ValidatorFilterString(existingStrings, caseSensitiveStrings);
- if (duplicateFilterStringMsg != null)
- ((ValidatorFilterString)filterStringValidator).setDuplicateFilterStringErrorMessage(duplicateFilterStringMsg);
- }
- }
-
- // now add a bottom visual separator line
- addSeparatorLine(rightSideComposite,1);
-
- // now populate bottom of right-side composite with apply/revert buttons within their own composite
- int nbrColumns_buttonComposite = 3;
- Composite applyResetButtonComposite = SystemWidgetHelpers.createFlushComposite(rightSideComposite, nbrColumns_buttonComposite);
- if (!wantTestButton)
- {
- ((GridData)applyResetButtonComposite.getLayoutData()).horizontalIndent = 200; // shift buttons to the right
- // now populate the buttons composite with apply and revert buttons
- Label filler = SystemWidgetHelpers.createLabel(applyResetButtonComposite, ""); //$NON-NLS-1$
- ((GridData)filler.getLayoutData()).grabExcessHorizontalSpace = true;
- ((GridData)filler.getLayoutData()).horizontalAlignment = GridData.FILL;
- }
- if (wantTestButton)
- {
- testButton = SystemWidgetHelpers.createPushButton(applyResetButtonComposite, this,
- SystemResources.RESID_CHGFILTER_BUTTON_TEST_LABEL,SystemResources.RESID_CHGFILTER_BUTTON_TEST_TOOLTIP);
- editpane.setTestButton(testButton);
- testButton.addSelectionListener(this);
- }
- applyButton = SystemWidgetHelpers.createPushButton(applyResetButtonComposite, this, SystemResources.RESID_CHGFILTER_BUTTON_APPLY_LABEL, SystemResources.RESID_CHGFILTER_BUTTON_APPLY_TOOLTIP);
- revertButton = SystemWidgetHelpers.createPushButton(applyResetButtonComposite, this, SystemResources.RESID_CHGFILTER_BUTTON_REVERT_LABEL,SystemResources.RESID_CHGFILTER_BUTTON_REVERT_TOOLTIP);
-
- // now add a spacer to soak up left-over height...
- addGrowableFillerLine(rightSideComposite, 1);
-
- // create state machine to manage edit pane
- sm = new SystemEditPaneStateMachine(rightSideComposite, applyButton, revertButton);
- sm.setUnsetMode();
-
- composite.layout(true);
-
- // add listeners
- if (listView!=null)
- listView.addSelectionListener(this);
- applyButton.addSelectionListener(this);
- revertButton.addSelectionListener(this);
- editpane.addChangeListener(this);
-
- // add special listeners for accessibility -- do not change focus when navigating list with keys
- if (listView != null)
- {
- listView.addMouseListener(new MouseListener() {
- public void mouseDoubleClick(MouseEvent e) {
- giveEditorFocus = true;
- }
- public void mouseDown(MouseEvent e) {
- giveEditorFocus = true;
- }
- public void mouseUp(MouseEvent e) {
- giveEditorFocus = true;
- }
- });
- listView.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- giveEditorFocus = false;
- }
- public void keyReleased(KeyEvent e) {
- giveEditorFocus = false;
- }
- });
- }
-
- // add context menu
- // -----------------------------
- // Enable right-click popup menu
- // -----------------------------
- if (listView != null)
- {
- menuMgr = new MenuManager("#ChangeFilterPopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(this);
- Menu menu = menuMgr.createContextMenu(listView);
- listView.setMenu(menu);
- }
-
- // preselect list item..
- // edit mode..
- if ((listItems.length > 1) || !showingNew)
- {
- if (listView!=null)
- {
- if (showingNew)
- listView.select(1);
- else
- listView.select(0);
- }
- sm.setEditMode();
- editpane.setFilterString(listItems[showingNew ? 1 : 0], 1);
- }
- // new...
- else
- {
- if (listView!=null)
- listView.select(0);
- sm.setNewMode();
- editpane.setFilterString(null, 0);
- }
- editpane.configureHeadingLabel(fsLabel);
- setPageComplete(editpane.isComplete());// side effect is initial enablement of test button
-
- if (!editable)
- {
- if (listView!=null)
- listView.setEnabled(false);
- if (strings.length > 0)
- editpane.setFilterString(strings[0], 0);
-// editPaneComposite.setEnabled(false);
- editpane.setEditable(false);
- setPageComplete(true);
- }
- else if (!getSupportsMultipleStrings())
- setPageComplete(true);
-
- return composite;
- }
- /*
- * Intercept of parent so we can reset the default button
- *
- protected void createButtonsForButtonBar(Composite parent)
- {
- super.createButtonsForButtonBar(parent);
- getShell().setDefaultButton(applyButton); // defect 46129
- }*/
- /**
- * Return our edit pane, by referring back to our caller. You can use this,
- * but do not override it!
- */
- protected SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
- {
- return editPaneSupplier.getFilterStringEditPane(shell);
- }
-
- /**
- * Return the Apply button
- */
- public Button getApplyButton()
- {
- return applyButton;
- }
- /**
- * Return the Revert button
- */
- public Button getRevertButton()
- {
- return revertButton;
- }
-
- /**
- * Call when user presses OK button on containing dialog or pane.
- * This is when we save all the changes the user made.
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- public boolean processOK()
- {
- if (!editable)
- return true;
- if (!verify(true))
- return false;
- /*
- ignoreEvents = true;
- SystemFilterStringEditPane editpane = getFilterStringEditPane(getShell());
- if (sm.isSaveRequired())
- {
- if (editpane.verify()!=null)
- {
- ignoreEvents = false;
- sm.setChangesMade(); // defect 45773
- return false; // pending errors. Cannot save, so cannot close!
- }
- saveFilterString(editpane.getFilterString(),editpane.getCurrentSelectionIndex());
- }
- else if (!sm.getNewSetByDelete()) //d47125
- {
- if (editpane.verify() != null)
- {
- ignoreEvents = false;
- return false;
- }
- }
- ignoreEvents = false;
- if (!allowDuplicateStrings && (listView != null))
- {
- String duplicate = checkForDuplicates();
- if (duplicate != null)
- {
- SystemMessage errMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_DUPLICATES).makeSubstitution(duplicate);
- getMessageLine().setErrorMessage(errMsg);
- listView.setFocus();
- return false;
- }
- }
- */
- ISystemFilterPool pool = inputFilter.getParentFilterPool(); // recurses for nested filter
- ISystemFilterPoolManager mgr = pool.getSystemFilterPoolManager();
- if (listView != null)
- listItems = listView.getItems();
- String[] filterStrings = null;
- if (showingNew)
- {
- filterStrings = new String[listItems.length - 1];
- for (int idx=0; idx<filterStrings.length; idx++)
- filterStrings[idx] = listItems[idx+1];
- }
- else
- {
- filterStrings = listItems;
- }
-
- try {
- mgr.updateSystemFilter(inputFilter, inputFilter.getName(), filterStrings);
- }
- catch (SystemMessageException exc)
- {
- getMessageLine().setErrorMessage(exc.getSystemMessage());
- return false;
- }
- catch (Exception exc)
- {
- //displayErrorMessage("Error updating filter: " + exc.getMessage());
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_UPDATEFILTER_FAILED);
- String excText = exc.getMessage();
- if (excText == null)
- excText = exc.getClass().getName();
- msg.makeSubstitution(excText,exc);
- getMessageLine().setErrorMessage(msg);
- return false;
- }
- //return super.processOK();
- return true;
- }
- /**
- * Perform the same validation that is done when OK is pressed.
- * @param doSave - true to actually save pending changes in filter string editor (eg, when called when actually processing OK).
- */
- public boolean verify(boolean doSave)
- {
- ignoreEvents = true;
- getMessageLine().clearErrorMessage();
- SystemFilterStringEditPane editpane = getFilterStringEditPane(getShell());
- if (editpane.canSaveImplicitly() && sm.isSaveRequired())
- {
- if (editpane.verify()!=null)
- {
- ignoreEvents = false;
- sm.setChangesMade(); // defect 45773
- return false; // pending errors. Cannot save, so cannot close!
- }
- if (doSave)
- saveFilterString(editpane.getFilterString(),editpane.getCurrentSelectionIndex());
- }
- else if (!sm.getNewSetByDelete()) //d47125
- {
- if (editpane.verify() != null)
- {
- ignoreEvents = false;
- return false;
- }
- }
- ignoreEvents = false;
- if (!allowDuplicateStrings && (listView != null))
- {
- String duplicate = checkForDuplicates();
- if (duplicate != null)
- {
- SystemMessage errMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_DUPLICATES).makeSubstitution(duplicate);
- getMessageLine().setErrorMessage(errMsg);
- listView.setFocus();
- return false;
- }
- }
- return true;
- }
-
- /**
- * Call when user presses Cancel button in containing dialog. We simply blow away all their changes!
- * Return true to close dialog.
- * Return false to not close dialog.
- */
- public boolean processCancel()
- {
- /*
- if (sm.isSaveRequired())
- {
- if (editpane.verify()!=null)
- return false; // pending errors. Cannot save, so cannot close!
- saveFilterString();
- }
- */
- //return super.processCancel();
- return true;
- }
-
- /**
- * Handles events generated by controls on this page.
- */
- public void widgetSelected(SelectionEvent e)
- {
- if (resetting)
- return;
- Widget source = e.widget;
- if (source == applyButton)
- {
- getMessageLine().clearMessage();
- applyPressed();
- }
- else if (source == revertButton)
- {
- getMessageLine().clearMessage();
- revertPressed();
- }
- else if (source == testButton)
- {
- getMessageLine().clearMessage();
- getFilterStringEditPane(getShell()).processTest(getShell());
- }
-
- else if (source == listView)
- {
- // check for unresolved errors...
- if (getFilterStringEditPane(getShell()).areErrorsPending())
- {
- e.doit = false; // dang, this doesn't work!
- resetting = true; // d45795
- listView.select(getFilterStringEditPane(getShell()).getCurrentSelectionIndex()); // d45795
- resetting = false; // d45795
- return;
- }
- // check if we can save implicitly and if there are pending changes
- else if (getFilterStringEditPane(getShell()).canSaveImplicitly() && sm.isSaveRequired())
- {
- getMessageLine().clearMessage();
-
- applyPressed();
-
- // if error, do not change selection and we keep pending changes state
- if (getMessageLine().getErrorMessage() != null)
- {
- e.doit = false; // dang, this doesn't work!
- sm.setChangesMade();
- resetting = true; // d45795
- listView.select(getFilterStringEditPane(getShell()).getCurrentSelectionIndex()); // d45795
- resetting = false; // d45795
- applyButton.setEnabled(false); // d45795
- return;
- }
- }
- else {
- getMessageLine().clearMessage();
- }
-
- // proceed with selection change request...
- processListSelect();
-
- // KM: defect 53009
- // need to check if Create button can be enabled if new filter string is selected
- if (isNewSelected()) {
- handleNewFilterStringItemSelection();
- }
- }
- }
- /**
- * An item selected in list. Process it
- */
- private void processListSelect()
- {
- sm.setNewSetByDelete(false); //d47125
- int newIndex = listView.getSelectionIndex();
- if (isNewSelected() || (newIndex == -1))
- {
- SystemFilterStringEditPane editpane = getFilterStringEditPane(getShell());
- editpane.setFilterString(null, 0);
-
- if (isNewSelected()) {
- sm.setNewMode();
- }
- else
- sm.setUnsetMode();
- if (testButton != null)
- testButton.setEnabled(false);
- }
- else
- {
- getFilterStringEditPane(getShell()).setFilterString(getCurrentSelection(), newIndex);
- sm.setEditMode();
- if (testButton != null)
- testButton.setEnabled(true);
- }
- getFilterStringEditPane(getShell()).configureHeadingLabel(fsLabel);
- if (giveEditorFocus)
- {
- Control c = getFilterStringEditPane(getShell()).getInitialFocusControl();
- if ((c!=null) && !c.isDisposed() && c.isVisible())
- c.setFocus();
- }
- }
- /**
- * User pressed Apply to save the pending changes the current filter string
- */
- protected void applyPressed()
- {
- ignoreEvents = true;
-
- SystemFilterStringEditPane editpane = getFilterStringEditPane(getShell());
- if (editpane.verify() == null)
- {
- boolean ok = true;
- String editedFilterString = editpane.getFilterString();
- if (filterStringValidator != null)
- {
- String[] names = (listView!=null) ? listView.getItems() : listItems;
- if (!allowDuplicateStrings && (filterStringValidator instanceof ISystemValidatorUniqueString))
- ((ISystemValidatorUniqueString)filterStringValidator).setExistingNamesList(names);
- SystemMessage errorMessage = filterStringValidator.validate(editedFilterString);
- if (errorMessage != null)
- {
- ok = false;
- getMessageLine().setErrorMessage(errorMessage);
- }
- }
-
- if (ok)
- {
- sm.applyPressed();
- saveFilterString(editedFilterString, editpane.getCurrentSelectionIndex());
- }
- }
-
- ignoreEvents = false;
- }
-
- /**
- * User pressed Revert to discard the pending changes the current filter string
- */
- protected void revertPressed()
- {
- ignoreEvents = true;
- sm.resetPressed();
- boolean newMode = (isNewSelected() || listView == null || (listView.getSelectionIndex() == -1));
- if (newMode)
- getFilterStringEditPane(getShell()).setFilterString(null, 0);
- else
- getFilterStringEditPane(getShell()).setFilterString(getCurrentSelection(), listView.getSelectionIndex());
- getMessageLine().clearErrorMessage();
- setPageComplete(true);
- if (testButton != null)
- testButton.setEnabled(!newMode);
- ignoreEvents = false;
- }
-
- /**
- * Handles events generated by controls on this page.
- */
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
-
- /**
- * The completeness of the page has changed.
- * We direct it to the Apply button versus just the OK button
- */
- public void setPageComplete(boolean complete)
- {
- // d45795
- if (applyButton != null)
- {
- if (!complete)
- applyButton.setEnabled(false);
- // else: we never enable it because the state machine does that anyway on any user-input change
- }
- super.setPageComplete(complete);
- }
-
- // ------------
- // List methods
- // ------------
-
- /**
- * Return true if currently selected item is "New"
- */
- protected boolean isNewSelected()
- {
- if (showingNew && (listView!=null))
- return (listView.getSelectionIndex() == 0);
- else
- return false;
- }
-
- /**
- * Return currently selected filter string
- */
- protected String getCurrentSelection()
- {
- if (showingNew)
- {
- if (listView.getSelectionCount() >= 1)
- return listView.getSelection()[0];
- else
- return null;
- }
- else if (listView != null)
- {
- if (listView.getSelectionCount() >= 0)
- return listView.getSelection()[0];
- else
- return null;
- }
- else
- {
- return listItems[0];
- }
- }
-
- // LIFECYCLE OF STRINGS
-
- /**
- * Create a new filter string from the contents of the filter string edit pane
- */
- protected String createFilterString()
- {
- String newFilterString = getFilterStringEditPane(getShell()).getFilterString();
- listView.add(newFilterString);
- int selectionIndex = listView.getItemCount()-1;
- listView.select(selectionIndex);
- sm.setEditMode();
- getFilterStringEditPane(getShell()).setFilterString(newFilterString, selectionIndex);
- getFilterStringEditPane(getShell()).configureHeadingLabel(fsLabel);
- return newFilterString;
- }
- /**
- * Update the current selection with the values in the edit pane
- */
- protected void saveFilterString(String editedFilterString, int currSelectionIndex)
- {
- //System.out.println("inside savefilterstring. current sel index = " + currSelectionIndex);
- if (currSelectionIndex == -1)
- return;
- else if (showingNew && (currSelectionIndex == 0))
- createFilterString();
- else
- {
- //System.out.println("Updating list item " + currSelectionIndex + " to " + editedFilterString);
- if (listView != null)
- listView.setItem(currSelectionIndex, editedFilterString);
- else
- listItems[0] = editedFilterString;
- }
- }
-
-
- // private methods
-
- private ISystemFilter getSystemFilter(Object selectedObject)
- {
- if (selectedObject instanceof ISystemFilter)
- return (ISystemFilter)selectedObject;
- else
- return ((ISystemFilterReference)selectedObject).getReferencedFilter();
- }
-
- // ----------------------------------------------
- // EDIT PANE CHANGE LISTENER INTERFACE METHODS...
- // ----------------------------------------------
- /**
- * Callback method from the edit pane. The user has changed the filter string. It may or may not
- * be valid. If not, the given message is non-null. If it is, and you want it,
- * call getSystemFilterString() in the edit pane.
- */
- public void filterStringChanged(SystemMessage message)
- {
- if (message != null)
- getMessageLine().setErrorMessage(message);
- else
- getMessageLine().clearErrorMessage();
- if (testButton != null)
- testButton.setEnabled(message == null);
- if (!ignoreEvents) // this is set on while verifying, indicating these are not real change events per se
- {
- sm.setChangesMade();
- }
- setPageComplete(message == null);
- }
- /**
- * Callback method. We are about to do a verify,the side effect of which is to
- * change the current state of the dialog, which we don't want. This tells the
- * dialog to back up that state so it can be restored.
- */
- public void backupChangedState()
- {
- sm.backup();
- }
- /**
- * Callback method. After backup and change events this is called to restore state
- */
- public void restoreChangedState()
- {
- sm.restore();
- }
-
- // ------------------------------
- // CONTEXT MENU ACTION SUPPORT...
- // ------------------------------
- /**
- * Called when the context menu is about to open.
- * Calls {@link #fillContextMenu(IMenuManager)}
- */
- public void menuAboutToShow(IMenuManager menu)
- {
-
- fillContextMenu(menu);
- if (!menuListenerAdded)
- {
- if (menu instanceof MenuManager)
- {
- Menu m = ((MenuManager)menu).getMenu();
- if (m != null)
- {
- menuListenerAdded = true;
- SystemViewMenuListener ml = new SystemViewMenuListener();
- //ml.setShowToolTipText(true, wwDialog.getMessageLine()); does not work for some reason
- m.addMenuListener(ml);
- }
- }
- }
- }
-
- /**
- * This is method is called to populate the popup menu
- */
- public void fillContextMenu(IMenuManager menu)
- {
- String currentString = getCurrentSelection();
- IStructuredSelection selection= null;
- if (currentString != null)
- selection = new StructuredSelection(currentString);
- // Partition into groups...
- createStandardGroups(menu);
- ISystemAction action = null;
- boolean isNewSelected = isNewSelected();
- //System.out.println("new selected? " + isNewSelected);
- if ((selection != null) && !isNewSelected)
- {
- action = getDeleteAction(selection);
- menu.appendToGroup(action.getContextMenuGroup(), action);
-
- action = getCopyAction(selection);
- menu.appendToGroup(action.getContextMenuGroup(), action);
-
- action = getMoveUpAction(selection);
- menu.appendToGroup(action.getContextMenuGroup(), action);
-
- action = getMoveDownAction(selection);
- menu.appendToGroup(action.getContextMenuGroup(), action);
- }
- //if (!isNewSelected)
- {
- action = getPasteAction(selection);
- menu.appendToGroup(action.getContextMenuGroup(), action);
- }
- }
- /**
- * Creates the Systems plugin standard groups in a context menu.
- */
- public void createStandardGroups(IMenuManager menu)
- {
- if (!menu.isEmpty())
- return;
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE)); // rename,move,copy,delete,bookmark,refactoring
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER)); // move up, move down
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
- }
-
- /**
- * Get the delete action
- */
- private SystemChangeFilterActionDeleteString getDeleteAction(ISelection selection)
- {
- if (deleteAction == null)
- deleteAction = new SystemChangeFilterActionDeleteString(this);
- deleteAction.setShell(getShell());
- deleteAction.setSelection(selection);
- return deleteAction;
- }
-
- /**
- * Get the move up action
- */
- private SystemChangeFilterActionMoveStringUp getMoveUpAction(ISelection selection)
- {
- if (moveUpAction == null)
- moveUpAction = new SystemChangeFilterActionMoveStringUp(this);
- moveUpAction.setShell(getShell());
- moveUpAction.setSelection(selection);
- return moveUpAction;
- }
- /**
- * Get the move down action
- */
- private SystemChangeFilterActionMoveStringDown getMoveDownAction(ISelection selection)
- {
- if (moveDownAction == null)
- moveDownAction = new SystemChangeFilterActionMoveStringDown(this);
- moveDownAction.setShell(getShell());
- moveDownAction.setSelection(selection);
- return moveDownAction;
- }
- /**
- * Get the copy action
- */
- private SystemChangeFilterActionCopyString getCopyAction(ISelection selection)
- {
- if (copyAction == null)
- copyAction = new SystemChangeFilterActionCopyString(this);
- copyAction.setShell(getShell());
- copyAction.setSelection(selection);
- return copyAction;
- }
- /**
- * Get the paste action
- */
- private SystemChangeFilterActionPasteString getPasteAction(ISelection selection)
- {
- if (pasteAction == null)
- pasteAction = new SystemChangeFilterActionPasteString(this);
- pasteAction.setShell(getShell());
- if (selection != null)
- pasteAction.setSelection(selection);
- return pasteAction;
- }
- // -------------------------------------------------------------
- // CALLBACK METHODS FROM THE RIGHT CLICK CONTEXT MENU ACTIONS...
- // -------------------------------------------------------------
-
- /**
- * Decide if we can do the delete or not.
- * Will decide the enabled state of the delete action.
- */
- public boolean canDelete()
- {
- return (sm.getMode() == ISystemEditPaneStates.MODE_EDIT) && !sm.areChangesPending() && !isNewSelected() && (listView.getSelectionIndex()!=-1) &&
- (listView.getItemCount()>2); // defect 46149
- }
- /**
- * Perform the delete action
- */
- public void doDelete()
- {
- int idx = listView.getSelectionIndex();
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONFIRM_DELETE);
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), msg);
- try{
- if (msgDlg.openQuestion())
- {
- listView.remove(idx); // remove item from list
- // defect 46097...
- listView.select(0);
- processListSelect();
- sm.setNewSetByDelete(true); //d47125
-
- // KM: defect 53009
- // since we have new set by delete action, the verify method
- // will ignore actual verification, and just check for duplicates
- boolean ok = verify(false);
-
- // set page to complete
- // but this does not affect Create button
- setPageComplete(ok);
-
- // if the verify above went ok, i.e. no duplicates found, then
- // need to check if Create button can be enabled if new filter string is selected
- if (ok && isNewSelected()) {
- handleNewFilterStringItemSelection();
- }
- }
- } catch (Exception exc) {}
- }
-
- /**
- * Handles new filter string selection from the filter string list.
- * Enables/disables Create button depending on whether the
- * default filter string is valid.
- */
- protected void handleNewFilterStringItemSelection() {
-
- ignoreEvents = true;
-
- SystemFilterStringEditPane editpane = getFilterStringEditPane(getShell());
-
- // we check if there are any existing errors
- // shouldn't be unless setting the default filter string for new filter string item
- // in processListSelect() above caused a problem
- boolean anyErrors = editpane.areErrorsPending();
-
- // if no errors currently, then do a verify
- if (!anyErrors) {
-
- // verify the default filter string
- boolean result = (editpane.verify() == null);
-
- // enable Create button if there are no errors
- if (result) {
- applyButton.setEnabled(true);
- }
- // otherwise clear pending errors, since verify() call could have
- // resulted in errors showing through
- else {
- editpane.clearErrorsPending();
- getMessageLine().clearErrorMessage();
- }
- }
-
- // yantzi: RSE 6.2, added call to setPageComplete to enable the OK button, otherwise
- // it is disabled when the user deletes a filter or selects the newfilterstring dialog
- setPageComplete(true);
-
- ignoreEvents = false;
- }
-
- /**
- * Decide if we can do the move up or not.
- * Will decide the enabled state of the move up action.
- */
- public boolean canMoveUp()
- {
- boolean can = (sm.getMode() == ISystemEditPaneStates.MODE_EDIT) && !sm.areChangesPending() && !isNewSelected() && (listView.getSelectionIndex()!=-1);
- if (can)
- {
- int idx = listView.getSelectionIndex();
- can = (idx > 1); // skip new at index 0, skip first actual string
- }
- return can;
- }
- /**
- * Perform the move up action
- */
- public void doMoveUp()
- {
- int idx = listView.getSelectionIndex();
- String currentString = getCurrentSelection();
- listView.remove(idx); // remove item from list
- listView.add(currentString,idx-1);
- }
- /**
- * Decide if we can do the move down or not.
- * Will decide the enabled state of the move down action.
- */
- public boolean canMoveDown()
- {
- boolean can = (sm.getMode() == ISystemEditPaneStates.MODE_EDIT) && !sm.areChangesPending() && !isNewSelected() && (listView.getSelectionIndex()!=-1);
- if (can)
- {
- int idx = listView.getSelectionIndex();
- can = (idx <= (listView.getItemCount()-2)); // -1 is to be zero-based. Another -1 is to discount "New".
- }
- return can;
- }
- /**
- * Perform the move down action
- */
- public void doMoveDown()
- {
- int idx = listView.getSelectionIndex();
- String currentString = getCurrentSelection();
- listView.remove(idx); // remove item from list
- listView.add(currentString,idx+1);
- }
-
- /**
- * Decide if we can do the copy or not.
- * Will decide the enabled state of the copy action.
- */
- public boolean canCopy()
- {
- boolean can = (sm.getMode() == ISystemEditPaneStates.MODE_EDIT) && !sm.areChangesPending() && !isNewSelected() && (listView.getSelectionIndex()!=-1);
- return can;
- }
- /**
- * Actually do the copy of the current filter string to the clipboard.
- */
- public void doCopy()
- {
- if (clipboard == null)
- clipboard = new Clipboard(getShell().getDisplay());
-
- String selection = getCurrentSelection();
- TextTransfer transfer = TextTransfer.getInstance();
- clipboard.setContents(new Object[] {selection}, new Transfer[] {transfer});
- }
- /**
- * Decide if we can do the paste or not.
- * Will decide the enabled state of the copy action.
- */
- public boolean canPaste()
- {
- if (clipboard == null)
- return false;
- TextTransfer textTransfer = TextTransfer.getInstance();
- String textData = (String)clipboard.getContents(textTransfer);
- return ((textData != null) && (textData.length() > 0));
- }
- /**
- * Actually do the copy of the current filter string to the clipboard.
- * If an existing string is selected, it is pasted before it. Else. it is appended to the end of the list.
- */
- public void doPaste()
- {
- if (clipboard == null)
- return;
- TextTransfer textTransfer = TextTransfer.getInstance();
- String textData = (String)clipboard.getContents(textTransfer);
-
- String newCopy = new String(textData);
- int newLocation = listView.getSelectionIndex();
- if (newLocation <= 0)
- {
- listView.add(newCopy);
- newLocation = listView.getItemCount()-1;
- listView.select(newLocation);
- }
- else
- {
- listView.add(newCopy, newLocation);
- listView.select(newLocation);
- }
- processListSelect(); // defect 45790...
- setPageComplete(verify(false));
- }
-
- // --------------
- // ERROR CHECKING
- // --------------
-
- /**
- * This hook method is called when ok is pressed. It checks for blatantly duplicate filter strings.
- * @return filterstring duplicate if there ARE duplicates. NULL if there are no duplicates
- */
- protected String checkForDuplicates()
- {
- if (listView == null)
- return null;
- String strings[] = (listView != null) ? listView.getItems() : listItems;
- String duplicate = null;
- boolean noDupes = true;
- for (int idx=1; noDupes && (idx < strings.length); idx++)
- {
- for (int ydx=1; noDupes && (ydx < strings.length); ydx++)
- {
- if (idx != ydx)
- {
- if (compareFilterStrings(caseSensitiveStrings, strings[idx], strings[ydx]))
- {
- noDupes = false;
- duplicate = strings[idx];
- }
- }
- }
- }
- return duplicate;
- }
- /**
- * Compares one filter string to another, while searching for duplicates.
- * Override if you want to do more intelligent compares. This one checks
- * for equality. The case-sensitivity is specified by the caller.
- */
- public boolean compareFilterStrings(boolean caseSensitive, String filterString1, String filterString2)
- {
- boolean cs = caseSensitive;
- if (cs)
- return filterString1.equals(filterString2);
- else
- return filterString1.equalsIgnoreCase(filterString2);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInputs.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInputs.java
deleted file mode 100644
index 3e04df627..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInputs.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David Dykstal (IBM) - [226561] add API markup to javadoc
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-//import org.eclipse.rse.core.*;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogInputs;
-
-
-
-/**
- * A class capturing the attributes commonly needed by dialogs that work with
- * filter pools.
- *
- * @noextend This class is not intended to be subclassed by clients. This class
- * is complete and should be used as is.
- * @since 3.0
- */
-public class SystemFilterPoolDialogInputs extends SystemFilterDialogInputs
-{
-
-
- public ISystemFilterPoolManagerProvider poolManagerProvider = null;
- public ISystemFilterPoolManager[] poolManagers = null;
- public ISystemFilterPoolReferenceManager refManager = null;
- public int mgrSelection = 0;
- public String poolNamePrompt;
- public String poolNameTip;
- public String poolMgrNamePrompt;
- public String poolMgrNameTip;
-
- public SystemSimpleContentElement filterPoolTreeRoot;
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInterface.java
deleted file mode 100644
index 7efb415fa..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogInterface.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-
-
-/**
- * Common interface for dialogs or wizards that work with filter pools.
- *
- * @since 3.0
- */
-public interface SystemFilterPoolDialogInterface
-{
-
-
- /**
- * Allow base action to pass instance of itself for callback to get info
- */
- public void setFilterPoolDialogActionCaller(SystemFilterAbstractFilterPoolAction caller);
- /**
- * Return an object containing user-specified information pertinent to filter pool actions
- */
- public SystemFilterPoolDialogOutputs getFilterPoolDialogOutputs();
- /**
- * Set the help context id for this wizard
- */
- public void setHelpContextId(String id);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogOutputs.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogOutputs.java
deleted file mode 100644
index be581baab..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterPoolDialogOutputs.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David Dykstal (IBM) - [226561] add API markup to javadoc
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-//import org.eclipse.rse.core.*;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-
-
-
-/**
- * A class capturing the attributes commonly returned by dialogs that work with
- * filter pools.
- *
- * @noextend This class is not intended to be subclassed by clients. This class
- * is complete and should be used as is.
- * @since 3.0
- */
-public class SystemFilterPoolDialogOutputs
-{
-
-
- public String filterPoolName;
- public String filterPoolManagerName;
- public SystemSimpleContentElement filterPoolTreeRoot;
- public ISystemFilterPool newPool;
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java
deleted file mode 100644
index 3c7ea50c0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterStringEditPane.java
+++ /dev/null
@@ -1,730 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- ********************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-import java.util.Vector;
-
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.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.swt.widgets.Text;
-
-
-
-/**
- * This class prompts the user to create or edit the contents of a single
- * filter string. This edit pane is used in many places, so creating a decent
- * looking subclass is important:
- * <ul>
- * <li>The first page of the New Filter wizard
- * <li>The only page of the New Filter String wizard
- * <li>The right side of the Change Filter dialog, when "new" or an existing filter string is selected
- * </ul>
- * So what is the "contract" the edit pane has to fulfill?
- * <ul>
- * <li>work in "new" or "edit" mode. In the latter case it is given a String as input. This needs to be
- * switchable on the fly. This is typically automated by use of a "state machine".
- * <li>give as output a new or updated String
- * <li>allow interested parties to know when the contents have been changed, as they change,
- * and whether there are errors in those changes
- * </ul>
- * Contractually, here are the methods called by the main page of the new filter wizard:
- * <ul>
- * <li>addChangeListener ... no need to ever override
- * <li>setSystemFilterPoolReferenceManagerProvider ... no need to ever override
- * <li>setType ... no need to ever override
- * <li>setFilterStringValidator ... no need to ever override
- * <li>isComplete ... no need to ever override
- * <li>createContents ... you will typically override
- * <li>verify ... you will typically override
- * <li>getInitialFocusControl ... you will typically override
- * <li>getFilterString ... you will typically override
- * <li>areFieldsComplete ... you will typically override
- * </ul>
- */
-public class SystemFilterStringEditPane implements SelectionListener
-{
- // inputs
- protected Shell shell;
- protected String inputFilterString;
- protected Vector listeners = new Vector();
- protected ISystemFilterPoolReferenceManagerProvider refProvider = null;
- protected ISystemFilterPoolManagerProvider provider = null;
- protected String type;
- protected boolean newMode = true;
- protected boolean changeFilterMode = false;
- protected boolean ignoreChanges;
- protected boolean editable = true;
-
- // default GUI
- protected Label labelString;
- protected Text textString;
- protected Button dlgTestButton;
-
- // state
- protected SystemMessage errorMessage;
- protected boolean skipEventFiring;
- protected int currentSelectionIndex;
-
-
- /**
- * Constructor for SystemFilterStringEditPane.
- * @param shell - the shell of the wizard or dialog host this
- */
- public SystemFilterStringEditPane(Shell shell)
- {
- super();
- this.shell = shell;
-
- }
-
- // ------------------------------
- // HELPER METHODS...
- // ------------------------------
-
- /**
- * <i>Helper method. Do not override.</i><br>
- * Return the shell given us in the ctor
- */
- protected Shell getShell()
- {
- return shell;
- }
- /**
- * <i>Helper method. Do not override.</i><br>
- * Return the input filter string as given us in setFilterString
- */
- protected String getInputFilterString()
- {
- return inputFilterString;
- }
-
- /**
- * <i>Helper method. Do not override.</i><br>
- * Add a separator line. This is a physically visible line.
- */
- protected void addSeparatorLine(Composite parent, int nbrColumns)
- {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(data);
- }
- /**
- * <i>Helper method. Do not override.</i><br>
- * Add a spacer line
- */
- protected void addFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- filler.setLayoutData(data);
- }
- /**
- * <i>Helper method. Do not override.</i><br>
- * Add a spacer line that grows in height to absorb extra space
- */
- protected void addGrowableFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.grabExcessVerticalSpace = true;
- filler.setLayoutData(data);
- }
- // ------------------------------
- // CONFIGURATION/INPUT METHODS...
- // ------------------------------
- /**
- * <i>Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.</i><br>
- * Set the input filter string, in edit mode.
- * Or pass null if reseting to new mode.
- * @param filterString - the filter string to edit or null if new mode
- * @param selectionIndex - the index of the currently selected filter string. Only used for getCurrentSelectionIndex().
- */
- public void setFilterString(String filterString, int selectionIndex)
- {
- this.inputFilterString = filterString;
- this.currentSelectionIndex = selectionIndex;
- newMode = (filterString == null);
- setIgnoreChanges(true);
- resetFields();
- clearErrorsPending();
- if (inputFilterString != null)
- doInitializeFields();
- setIgnoreChanges(false);
- }
-
- /**
- * <i>Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.</i><br>
- * Set the input filter string only without any initialzing.
- */
- public void setInputFilterString(String filterString)
- {
- this.inputFilterString = filterString;
- }
-
-
- /**
- * <i>Lifecyle method. Call, but do not override.</i><br>
- * Turn on ignore changes mode. Subclasses typically can just query the inherited
- * field ignoreChanges, unless they need to set the ignoreChanges mode in their
- * own composite widgets, in which case they can override and intercept this.
- */
- protected void setIgnoreChanges(boolean ignoreChanges)
- {
- this.ignoreChanges = ignoreChanges;
- }
-
- /**
- * <i>Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.</i><br>
- * Identify a listener interested in any changes made to the filter string,
- * as they happen
- */
- public void addChangeListener(ISystemFilterStringEditPaneListener l)
- {
- listeners.add(l);
- }
- /**
- * <i>Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.</i><br>
- * Remove a listener interested in any changes made to the filter string,
- * as they happen
- */
- public void removeChangeListener(ISystemFilterStringEditPaneListener l)
- {
- listeners.remove(l);
- }
- /**
- * <i>Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.</i><br>
- * Sets the contextual system filter pool reference manager provider. That is, it will
- * be the currently selected subsystem if New Filter is launched from a subsystem.
- * <p>
- * Will be non-null if the current selection is a reference to a
- * filter pool or filter, or a reference manager provider.
- * <p>
- * This is not used by default but made available for subclasses.
- * @see #setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider)
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- this.refProvider = provider;
- }
- /**
- * <i>Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.</i><br>
- * Sets the contextual system filter pool manager provider. That is, it will
- * be the subsystem factory of the given subsystem, filter pool or filter. Used
- * when there is no way to set setSystemFilterPoolReferenceManagerProvider, because
- * there isn't one derivable from the selection.
- * <p>
- * Will be non-null if the current selection is a reference to a
- * filter pool or filter, or a filter pool or filter, or a manager provider itself.
- * <p>
- * This is not used by default but made available for subclasses.
- * @see #setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider)
- */
- public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
- {
- this.provider = provider;
- }
-
- /**
- * <i>Getter method, for the use of subclasses. Do not override.</i><br>
- * Return the contextual system filter pool reference manager provider (ie subsystem) that
- * this was launched from. Will be null if not launched from a subsystem, or reference to a
- * filter pool or filter.
- * <p>
- * This is not used by default but made available for subclasses.
- */
- public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider()
- {
- return refProvider;
- }
- /**
- * <i>Getter method, for the use of subclasses. Do not override.</i><br>
- * Return the contextual system filter pool manager provider (ie subsystem configuration) that
- * this was launched from. Will be null if not launched from a subsystem configuration, or
- * a filter pool or filter (or reference).
- * <p>
- * This is not used by default but made available for subclasses.
- */
- public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider()
- {
- return provider;
- }
-
- /**
- * <i>Helper method you do not need to ever override.</i><br>
- * Set the type of filter we are creating. Types are not used by the base filter
- * framework but are a way for tools to create typed filters and have unique
- * actions per filter type.
- * <p>
- * This simply sets the <samp>type</samp> instance variable, so that subclassing code may
- * access it if it needs to know what type of filter is being created. This method is
- * called by the setType method in the SystemNewFilterWizard wizard.
- */
- public void setType(String type)
- {
- this.type = type;
- }
-
- /**
- * <i>Configuration method, called from Change Filter dialog. Do not override.</i><br>
- * Called by Change Filter dialog to set on our changeFilterMode flag in case we wish to
- * distinguish between new filter and change filter modes
- */
- public void setChangeFilterMode(boolean changeMode)
- {
- this.changeFilterMode = changeMode;
- }
- /**
- * <i>Configuration method, called from Change Filter dialog and New Filter wizard. Do not override.</i><br>
- * Called by Change Filter dialog or New Filter wizard when caller has indicated
- * they want a test button. This is used to set the testButton instance variable.
- * Subclasses show enable/disable it as changes are made, according to valid state.
- */
- public void setTestButton(Button button)
- {
- this.dlgTestButton = button;
- }
- /**
- * <i><b>Overridable</b> method, if subclass supports a Test button.</i><br>
- * Called by owning dialog when common Test button is pressed.
- * Does nothing by default.
- */
- public void processTest(Shell shell)
- {
- System.out.println("Someone forgot to override processTest in SystemFilterStringEditPane!"); //$NON-NLS-1$
- }
-
- /**
- * Sets whether or not the edit pane is not to be editable. May be invoked
- * atany time prior or after the creation of the controls.
- * Subclasses should override and enable their own controls appropriately.
- * <p>
- * Subclasses should call super to ensure that the "editable" flag is
- * set properly. Controls which are not instantiated in this call will be ignored.
- * @param editable true if the controls in this pane are to be editable.
- * Usually set to true, but if the filter is not modifiable it will be
- * set to false.
- */
- public void setEditable(boolean editable) {
- this.editable = editable;
- enable(labelString, editable);
- enable(textString, editable);
- enable(dlgTestButton, editable);
- }
-
- /**
- * Set the enabled state of a particular control.
- * @param control the control of which to set the state
- * @param enabled the enabled state
- */
- protected void enable(Control control, boolean enabled) {
- if (!(control == null || control.isDisposed())) {
- control.setEnabled(enabled);
- }
- }
-
- /*
- * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)}
- *
- */
- public boolean getEditable()
- {
- return editable;
- }
-
- // ------------------------------
- // DATA EXTRACTION METHODS
- // ------------------------------
-
- /**
- * <i><b>Overridable</b> getter method.</i><br>
- * Get the filter string in its current form.
- * This should be overridden if createContents is overridden.
- * <p>This is the functional opposite of doInitializeFields, which tears apart the input string in update mode,
- * to populate the GUIs. This method creates the filter string from the information in the GUI.
- */
- public String getFilterString()
- {
- if (textString != null)
- return textString.getText().trim();
- else
- return inputFilterString;
- }
- /**
- * <i>Getter method. Do not override.</i><br>
- * Get the selection index of the filter string we are currently editing.
- * Used in Change Filter dialog.
- */
- public int getCurrentSelectionIndex()
- {
- return currentSelectionIndex;
- }
-
- /**
- * <i><b>Overridable</b> getter method.</i><br>
- * For page 2 of the New Filter wizard, if it is possible to
- * deduce a reasonable default name from the user input here,
- * then return it here. Else, just return null (the default).
- */
- public String getDefaultFilterName()
- {
- return null;
- }
-
- /**
- * <i><b>Overridable</b> configuration method, called from Change Filter dialog and New Filter wizard.</i><br>
- * <b>YOU MUST TEST IF THE GIVEN LABEL IS NULL!</b><br>
- * In the Change Filter dialog, this edit pane is shown on the right side, beside
- * the filter string selection list. Above it is a label, that shows something
- * like "Selected Filter String" in edit mode, or "New Filter String" in new mode.
- * <p>
- * This method gives subclasses the opportunity to specify unique values for this label.
- * In addition to setting the text, the tooltip text should also be set.
- * <p>
- * Defaults are supplied.
- */
- public void configureHeadingLabel(Label label)
- {
- if (label == null)
- return;
- if (!newMode)
- {
- label.setText(SystemResources.RESID_CHGFILTER_FILTERSTRING_LABEL);
- label.setToolTipText(SystemResources.RESID_CHGFILTER_FILTERSTRING_TOOLTIP);
- }
- else
- {
- label.setText(SystemResources.RESID_CHGFILTER_NEWFILTERSTRING_LABEL);
- label.setToolTipText(SystemResources.RESID_CHGFILTER_NEWFILTERSTRING_TOOLTIP);
- }
- }
-
- // ------------------------------
- // LIFECYCLE METHODS...
- // ------------------------------
-
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * Populate the pane with the GUI widgets. This is where we populate the client area.
- * @param parent - the composite that will be the parent of the returned client area composite
- * @return Control - a client-area composite populated with widgets.
- *
- * @see org.eclipse.rse.ui.SystemWidgetHelpers
- */
- public Control createContents(Composite parent)
- {
-
- // Inner composite
- int nbrColumns = 1;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
- ((GridLayout)composite_prompts.getLayout()).marginWidth = 0;
-
- // FILTER STRING PROMPT
- textString = SystemWidgetHelpers.createLabeledTextField(composite_prompts,null,getFilterStringPromptLabel(), getFilterStringPromptTooltip());
- labelString = SystemWidgetHelpers.getLastLabel();
- ((GridData)textString.getLayoutData()).widthHint=300;
-
- resetFields();
- doInitializeFields();
-
- textString.setFocus();
-
- // add keystroke listeners...
- textString.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateStringInput();
- }
- }
- );
- setEditable(editable);
- return composite_prompts;
- }
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * Return the control to recieve initial focus. Should be overridden if you override createContents
- */
- public Control getInitialFocusControl()
- {
- return textString;
- }
-
-
-
-
- protected String getFilterStringPromptLabel()
- {
- return SystemResources.RESID_FILTERSTRING_STRING_LABEL;
- }
-
- protected String getFilterStringPromptTooltip()
- {
- return SystemResources.RESID_FILTERSTRING_STRING_TIP;
- }
-
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * Initialize the input fields based on the inputFilterString, and perhaps refProvider.
- * This can be called before createContents, so test for null widgets first!
- * Prior to this being called, resetFields is called to set the initial default state prior to input
- */
- protected void doInitializeFields()
- {
- if (textString == null)
- return; // do nothing
- if (inputFilterString != null)
- textString.setText(inputFilterString);
- }
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * This is called in the change filter dialog when the user selects "new", or selects another string.
- * You must override this if you override createContents. Be sure to test if the contents have even been created yet!
- */
- protected void resetFields()
- {
- if (textString != null)
- {
- textString.setText(""); //$NON-NLS-1$
- }
- }
- /**
- * <i>Lifecycle method. Do not override.</i><br>
- * Instead, override {@link #areFieldsComplete()}.
- * <p>
- * This is called by the wizard page when first shown, to decide if the default information
- * is complete enough to enable finish. It doesn't do validation, that will be done when
- * finish is pressed.
- */
- public boolean isComplete()
- {
- boolean complete = true;
- if (errorMessage != null) // pending errors?
- complete = false; // clearly not complete.
- else
- complete = areFieldsComplete();
- if (dlgTestButton != null)
- dlgTestButton.setEnabled(complete);
- return complete;
- }
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * Must be overridden if createContents is overridden.
- * <p>
- * This is called by the isComplete, to decide if the default information
- * is complete enough to enable finish. It doesn't do validation, that will be done when
- * finish is pressed.
- */
- protected boolean areFieldsComplete()
- {
- if (textString == null)
- return false;
- else
- return (textString.getText().trim().length()>0);
- }
-
- /**
- * <i>Lifecycle method. Do not override.</i><br>
- * Are errors pending? Used in Change Filter dialog to prevent changing the filter string selection
- */
- public boolean areErrorsPending()
- { // d45795
- return (errorMessage != null);
- }
- /**
- * <i>Lifecycle method. Do not override.</i><br>
- * Clear any errors pending. Called when Reset is pressed.
- */
- public void clearErrorsPending()
- {
- errorMessage = null;
- }
-
- // ------------------------------
- // PRIVATE METHODS
- // ------------------------------
- /**
- * <i><b>Private</b> method. Do not call or override.</i><br>
- * Fire an event to all registered listeners, that the user has changed the
- * filter string. Include the error message, if in error, so it can be displayed to the user.
- * <p>
- * Because this is used to enable/disable the Next and Finish buttons it is important
- * to call it when asked to do verification, even if nothing has changed.
- * <p>
- * It is more efficient, however, to defer the event firing during a full verification
- * until after the last widget has been verified. To enable this, set the protected
- * variable "skipEventFiring" to true at the top of your verify event, then to "false"
- * at the end. Then do fireChangeEvent(errorMessage);
- */
- protected void fireChangeEvent(SystemMessage error)
- {
- if (skipEventFiring)
- return;
- for (int idx=0; idx<listeners.size(); idx++)
- {
- ISystemFilterStringEditPaneListener l = (ISystemFilterStringEditPaneListener)listeners.elementAt(idx);
- l.filterStringChanged(error);
- }
- }
-
- /**
- * Tell interested callers to backup changes-pending state, as we are about
- * to fire a change event, after which we will want to restore state.
- */
- protected void fireBackupChangeEvent()
- {
- for (int idx=0; idx<listeners.size(); idx++)
- {
- ISystemFilterStringEditPaneListener l = (ISystemFilterStringEditPaneListener)listeners.elementAt(idx);
- l.backupChangedState();
- }
- }
- /**
- * <i><b>Private</b> method. Do not call or override.</i><br>
- * Tell interested callers to restore changes-pending state, as we are done
- * firing a change event and in this case we don't want that state change side effect.
- */
- protected void fireRestoreChangeEvent()
- {
- for (int idx=0; idx<listeners.size(); idx++)
- {
- ISystemFilterStringEditPaneListener l = (ISystemFilterStringEditPaneListener)listeners.elementAt(idx);
- l.restoreChangedState();
- }
- }
- // ---------------------------------------------
- // METHODS FOR VERIFYING INPUT PER KEYSTROKE ...
- // ---------------------------------------------
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * Validates filter string as entered so far in the text field.
- * Not called if you override createContents() and verify()
- */
- protected SystemMessage validateStringInput()
- {
- if (ignoreChanges)
- return errorMessage;
- errorMessage= null;
- //if (validator != null)
- // errorMessage = validateFilterString(textString.getText());
- if ((textString!=null) && (textString.getText().trim().length() == 0))
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_EMPTY);
- fireChangeEvent(errorMessage);
- //setPageComplete();
- //setErrorMessage(errorMessage);
- return errorMessage;
- }
-
- /*
- * Validates filter string using the supplied generic validator.
- * Child classes who do their own syntax validation can call this method
- * to also do uniqueness validation. They are responsible for calling fireChangeEvent though.
- * @see #setFilterStringValidator(ISystemValidator)
- *
- protected SystemMessage validateFilterString(String filterString)
- {
- if (validator != null)
- return validator.validate(filterString);
- else
- return null;
- }*/
-
- // ---------------------------------
- // METHODS FOR VERIFICATION...
- // ---------------------------------
-
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * Does complete verification of input fields. If this
- * method returns null, there are no errors and the dialog or wizard can close.
- * <p>Default implementation calls {@link #validateStringInput()}.
- *
- * @return error message if there is one, else null if ok
- */
- public SystemMessage verify()
- {
- errorMessage = null;
- Control controlInError = null;
- errorMessage = validateStringInput();
- if (errorMessage != null)
- controlInError = textString;
- if (errorMessage != null)
- {
- if (controlInError != null)
- controlInError.setFocus();
- }
- //setPageComplete();
- return errorMessage;
- }
-
- // ------------------
- // EVENT LISTENERS...
- // ------------------
-
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * User has selected something
- */
- public void widgetSelected(SelectionEvent event)
- {
- }
- /**
- * <i><b>Overridable</b> lifecycle method.</i><br>
- * User has selected something via enter/dbl-click
- */
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
-
-
- // -----------------------
- // Saving related method
- // -----------------------
- /**
- * Returns whether filter string can be saved implicitly. This is called in the Change dialog
- * and property page to check whether filter string can be saved if the user does not
- * explicitly click on Create/Apply button. So, for example, if this method returns <code>false</code>,
- * and the user has pending changes when he clicks on another entry in the filter string list, we will
- * not ask user to save pending changes.
- * By default, returns <code>true</code>
- * @return <code>true</code> to query user to save pending changes, <code>false</code> otherwise.
- */
- public boolean canSaveImplicitly() {
- return true;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java
deleted file mode 100644
index d4d500142..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/SystemFilterUIHelpers.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * David Dykstal (IBM) - [226561] add API markup to javadoc
- ********************************************************************************/
-
-package org.eclipse.rse.ui.filters;
-import java.util.Vector;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-
-
-/**
- * A set of utility methods for dealing with filter pools, models, etc.
- * @noextend This class is not intended to be subclassed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
- */
-public class SystemFilterUIHelpers
-{
-
- /**
- * Find element corresponding to given data
- */
- public static SystemSimpleContentElement getDataElement(SystemSimpleContentElement root, Object data)
- {
- SystemSimpleContentElement[] children = root.getChildren();
- SystemSimpleContentElement match = null;
- if ((children!=null)&&(children.length>0))
- {
- for (int idx=0; (match==null)&&(idx<children.length); idx++)
- if (children[idx].getData() == data)
- match = children[idx];
- }
- if ((match==null)&&(children!=null)&&(children.length>0))
- {
- for (int idx=0; (match==null)&&(idx<children.length); idx++)
- match = getDataElement(children[idx], data);
- }
- return match;
- }
-
- /**
- * Create and return data model to populate selection tree with
- */
- public static SystemSimpleContentElement getFilterPoolModel(ISystemFilterPoolManagerProvider mgrProvider,
- ISystemFilterPoolManager mgrs[])
- {
- SystemSimpleContentElement veryRootElement =
- new SystemSimpleContentElement("Filter pools", //$NON-NLS-1$
- null, null, (Vector)null);
- veryRootElement.setRenamable(false);
- veryRootElement.setDeletable(false);
-
- if (mgrs == null)
- return veryRootElement;
-
- Vector veryRootChildren = new Vector();
- for (int idx=0; idx<mgrs.length; idx++)
- {
- SystemSimpleContentElement rootElement =
- new SystemSimpleContentElement(mgrs[idx].getName(),
- mgrs[idx], veryRootElement, (Vector)null);
- rootElement.setRenamable(false);
- rootElement.setDeletable(false);
- rootElement.setImageDescriptor(getFilterPoolManagerImage(mgrProvider, mgrs[idx]));
- Vector elements = new Vector();
- ISystemFilterPool[] pools = mgrs[idx].getSystemFilterPools();
- populateFilterPoolContentElementVector(pools, elements, rootElement);
- rootElement.setChildren(elements);
- veryRootChildren.addElement(rootElement);
- }
- veryRootElement.setChildren(veryRootChildren);
- return veryRootElement;
- }
-
- /**
- * Internal use only
- */
- protected static void populateFilterPoolContentElementVector(ISystemFilterPool[] pools,
- Vector elements,
- SystemSimpleContentElement parentElement)
- {
- for (int idx=0; idx<pools.length; idx++)
- {
- ISystemFilterPool pool = pools[idx];
- SystemSimpleContentElement cElement =
- new SystemSimpleContentElement(pool.getName(), pool, parentElement, (Vector)null);
- cElement.setImageDescriptor(getFilterPoolImage(pool.getProvider(),pool));
- cElement.setDeletable(pool.isDeletable());
- cElement.setRenamable(!pool.isNonRenamable());
- cElement.setReadOnly(pool.getOwningParentName()!=null);
- //cElement.setSelected(setFilterPoolSelection(pool));
- elements.addElement(cElement);
- }
- }
-
-
- /**
- * Get the filter pool manager image
- */
- public static ImageDescriptor getFilterPoolManagerImage(ISystemFilterPoolManagerProvider poolMgrProvider, ISystemFilterPoolManager poolMgr)
- {
- ImageDescriptor poolMgrImage = null;
- if (poolMgrProvider == null)
- poolMgrProvider = poolMgr.getProvider();
- if (poolMgrProvider != null)
- {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- poolMgrImage = adapter.getSystemFilterPoolManagerImage();
- }
- if (poolMgrImage == null)
- poolMgrImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
- return poolMgrImage;
- }
-
-
- /**
- * Get the filter pool image
- */
- public static ImageDescriptor getFilterPoolImage(ISystemFilterPoolManagerProvider poolMgrProvider, ISystemFilterPool pool)
- {
- ImageDescriptor poolImage = null;
- if (poolMgrProvider == null)
- poolMgrProvider = pool.getProvider();
- if (poolMgrProvider != null)
- {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- poolImage = adapter.getSystemFilterPoolImage(pool);
- }
- if (poolImage == null)
- poolImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
- return poolImage;
- }
-
- /**
- * Get the filter image
- */
- public static ImageDescriptor getFilterImage(ISystemFilterPoolManagerProvider poolMgrProvider, ISystemFilter filter)
- {
- ImageDescriptor filterImage = null;
- if (poolMgrProvider == null)
- poolMgrProvider = filter.getProvider();
- if (poolMgrProvider != null)
- {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)poolMgrProvider.getAdapter(ISubSystemConfigurationAdapter.class);
- filterImage = adapter.getSystemFilterImage(filter);
- }
- if (filterImage == null)
- filterImage = RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
- return filterImage;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java
deleted file mode 100644
index b91a306da..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/ISystemNewFilterActionConfigurator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.filters.actions;
-
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-
-/**
- * Sometimes configuring a filter action can take a reasonably substantial amount of
- * processing. For this reason, we would desire to defer that configuration, when simply
- * filling a popup menu, until such time as the user has select to run the action. This
- * reduces time and memory in the vast majority of cases.
- * <p>
- * To achieve this, code which populates a context menu can implement this interface, and
- * pass it to the new filter wizard action. That action will then call back to the caller
- * via this interface, when the action is run.
- */
-public interface ISystemNewFilterActionConfigurator
-{
-
- /**
- * The user has selected to run this action. Please configure it!
- * @param newFilterAction - the action to be configured
- * @param callerData - context data that you supplied when registering this callback
- */
- public void configureNewFilterAction(ISubSystemConfiguration factory, SystemNewFilterAction newFilterAction, Object callerData);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java
deleted file mode 100644
index bd66f46c4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemChangeFilterAction.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.actions;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action that displays the Change Filter dialog
- */
-public class SystemChangeFilterAction extends SystemBaseDialogAction
-
-{
-
- private SystemChangeFilterDialog dlg = null;
- private String dlgTitle = null;
- private SystemFilterStringEditPane editPane;
-
- /**
- * Constructor for default action label and image
- */
- public SystemChangeFilterAction(Shell parent)
- {
- this( parent, SystemResources.ACTION_UPDATEFILTER_LABEL, SystemResources.ACTION_UPDATEFILTER_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER_ID));
- }
-
- public SystemChangeFilterAction(Shell parent, String label, String tooltip)
- {
- this(parent, label, tooltip, RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CHANGEFILTER_ID));
- }
-
- public SystemChangeFilterAction(Shell parent, String label, String tooltip, ImageDescriptor image)
- {
- super(label, tooltip, image, parent);
- allowOnMultipleSelection(false);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_CHANGE);
- setHelp(RSEUIPlugin.HELPPREFIX+"acfr0000"); //$NON-NLS-1$
- }
-
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseDialogAction #setDialogHelp(String)
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
- /**
- * Set the title for the dialog that displays
- */
- public void setDialogTitle(String title)
- {
- this.dlgTitle = title;
- }
- /**
- * Set the help id for the dialog that displays
- */
- public void setDialogHelpContextId(String id)
- {
- setDialogHelp(id);
- }
- /**
- * Specify an edit pane that prompts the user for the contents of a filter string.
- */
- public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
- {
- this.editPane = editPane;
- }
- /**
- * Return the edit pane specified via {@link #setFilterStringEditPane(SystemFilterStringEditPane)}
- */
- public SystemFilterStringEditPane getFilterStringEditPane()
- {
- return editPane;
- }
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- //System.out.println("checkObjectType: " + (selectedObject instanceof SystemFilterReference));
- if (selectedObject instanceof ISystemFilter)
- {
- return !((ISystemFilter)selectedObject).isNonChangable();
- }
- else if (selectedObject instanceof ISystemFilterReference)
- {
- return !((ISystemFilterReference)selectedObject).getReferencedFilter().isNonChangable();
- }
- else
- return false;
- }
-
- /**
- * This method creates and configures the filter dialog. It defers to
- * {@link #getFilterDialog(Shell)} to create it, and then configures it here.
- * So, do not override this, but do feel free to override getFilterDialog.
- */
- public Dialog createDialog(Shell shell)
- {
- dlg = getFilterDialog(shell);
- dlg.setSystemFilterPoolReferenceManagerProvider(getSystemFilterPoolReferenceManagerProvider());
- dlg.setSystemFilterPoolManagerProvider(getSystemFilterPoolManagerProvider());
- if (editPane != null)
- dlg.setFilterStringEditPane(editPane);
- configureFilterDialog(dlg);
- ISystemFilter filter = getSelectedFilter();
- if (filter != null)
- if (filter.isSingleFilterStringOnly())
- dlg.setSupportsMultipleStrings(false);
- return dlg;
- }
-
- /**
- * Overridable extension point to get our filter dialog. Only override this if you
- * subclass SystemChangeFilterDialog. Else, override configureFilterDialog.
- */
- protected SystemChangeFilterDialog getFilterDialog(Shell shell)
- {
- if (dlgTitle == null)
- return new SystemChangeFilterDialog(shell);
- else
- return new SystemChangeFilterDialog(shell, dlgTitle);
- }
-
- /**
- * This method is called internally, but had to be made public. You can ignore it.
- */
- public void callConfigureFilterDialog(SystemChangeFilterDialog dlg)
- {
- configureFilterDialog(dlg);
- }
-
- /**
- * Overridable extension point to configure the filter dialog. Typically you don't need
- * to subclass our default dialog.
- * <p>
- * Note since the dialog has not been opened yet, you cannot assume its shell is ready,
- * so call getParentShell() versus getShell().
- */
- protected void configureFilterDialog(SystemChangeFilterDialog dlg)
- {
- Shell shell = dlg.getShell();
- if (shell == null)
- shell = dlg.getParentShell();
- // code goes here...
- }
-
- /**
- * Required by parent but we do not use it so return null;
- */
- protected Object getDialogValue(Dialog dlg)
- {
- return null;
- }
-
- /**
- * Get the contextual system filter pool reference manager provider. Will return non-null if the
- * current selection is not a reference to a filter pool or filter, or a reference manager
- * provider.
- */
- public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider()
- {
- Object firstSelection = getFirstSelection();
- if (firstSelection != null)
- {
- if (firstSelection instanceof ISystemFilterReference)
- return ((ISystemFilterReference)firstSelection).getProvider();
- else if (firstSelection instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference)firstSelection).getProvider();
- else if (firstSelection instanceof ISystemFilterPoolReferenceManagerProvider)
- return (ISystemFilterPoolReferenceManagerProvider)firstSelection;
- }
- return null;
- }
- /**
- * Get the contextual system filter pool manager provider. Will return non-null if the
- * current selection is not a reference to a filter pool or filter, or a reference manager
- * provider, or a manager provider.
- */
- public ISystemFilterPoolManagerProvider getSystemFilterPoolManagerProvider()
- {
- Object firstSelection = getFirstSelection();
- if (firstSelection != null)
- {
- if (firstSelection instanceof ISystemFilterReference)
- return ((ISystemFilterReference)firstSelection).getReferencedFilter().getProvider();
- else if (firstSelection instanceof ISystemFilter)
- return ((ISystemFilter)firstSelection).getProvider();
- else if (firstSelection instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference)firstSelection).getReferencedFilterPool().getProvider();
- else if (firstSelection instanceof ISystemFilterPool)
- return ((ISystemFilterPool)firstSelection).getProvider();
- else if (firstSelection instanceof ISystemFilterPoolManagerProvider)
- return (ISystemFilterPoolManagerProvider)firstSelection;
- }
- return null;
- }
-
- /**
- * Get the selected filter
- */
- public ISystemFilter getSelectedFilter()
- {
- Object firstSelection = getFirstSelection();
- if (firstSelection != null)
- {
- if (firstSelection instanceof ISystemFilterReference)
- return ((ISystemFilterReference)firstSelection).getReferencedFilter();
- else if (firstSelection instanceof ISystemFilter)
- return ((ISystemFilter)firstSelection);
- }
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java
deleted file mode 100644
index 9308bbb1f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterAction.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogInputs;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogInterface;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Base class capturing the attributes and operations common to dialog actions
- * that work on system filters.
- */
-public abstract class SystemFilterAbstractFilterAction
- extends SystemBaseDialogAction
-
-{
-
-
- protected SystemFilterDialogInputs dlgInputs;
-
- /**
- * Constructor when given the translated action label
- */
- public SystemFilterAbstractFilterAction(Shell parent, String title)
- {
- super(title, null, parent);
- allowOnMultipleSelection(false);
- init();
- }
-
- /**
- * Constructor when given the translated action label and tooltip
- */
- public SystemFilterAbstractFilterAction(Shell parent, String title, String tooltip)
- {
- super(title, tooltip, null, parent);
- allowOnMultipleSelection(false);
- init();
- }
-
- /**
- * Common initialization code
- */
- protected void init()
- {
- dlgInputs = new SystemFilterDialogInputs();
- }
-
- // ----------------------------
- // HELP ID SETTINGS...
- // ----------------------------
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- // ----------------------------
- // ATTRIBUTE GETTERS/SETTERS...
- // ----------------------------
-
- /**
- * Set the dialog title.
- * Either call this or override getDialogTitle()
- */
- public void setDialogTitle(String title)
- {
- dlgInputs.title = title;
- }
- /**
- * Get the dialog title.
- * By default, uses what was given in setDialogTitle, or an english default if nothing set.
- */
- public String getDialogTitle()
- {
- return dlgInputs.title;
- }
-
- /**
- * Set the dialog prompt text.
- * Either call this or override getDialogPrompt()
- */
- public void setDialogPrompt(String prompt)
- {
- dlgInputs.prompt = prompt;
- }
- /**
- * Get the dialog prompt.
- * By default, uses what was given in setDialogPrompt
- */
- public String getDialogPrompt()
- {
- return dlgInputs.prompt;
- }
-
- /**
- * Set the dialog's filter name prompt text and tooltip
- * Either call this or override getDialogFilterNamePrompt/Tip()
- */
- public void setDialogFilterNamePrompt(String prompt, String tip)
- {
- dlgInputs.filterNamePrompt = prompt;
- dlgInputs.filterNameTip = tip;
- }
- /**
- * Get the dialog's filter name prompt text.
- * By default, uses what was given in setDialogFilterNamePrompt.
- */
- public String getDialogFilterFilterNamePrompt()
- {
- return dlgInputs.filterNamePrompt;
- }
- /**
- * Get the dialog's filter name tooltip text.
- * By default, uses what was given in setDialogFilterNamePrompt.
- */
- public String getDialogFilterNameTip()
- {
- return dlgInputs.filterNameTip;
- }
-
- /**
- * Set the dialog's pre-select information.
- * Either call this or override getDialogPreSelectInput()
- */
- public void setDialogPreSelectInput(Object selectData)
- {
- dlgInputs.preSelectObject = selectData;
- }
- /**
- * Get the dialog's pre-select information.
- * By default, uses what was given in setDialogPreSelectInput.
- */
- public Object getDialogPreSelectInput()
- {
- return dlgInputs.preSelectObject;
- }
-
-
- // -------------------------
- // PARENT CLASS OVERRIDES...
- // -------------------------
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- return true;
- //return (selectedObject instanceof SystemFilterPoolReferenceManagerProvider); // override as appropriate
- }
-
- /**
- * Extends run in parent class to call doOKprocessing if the result of calling
- * getDialogValue() resulted in a non-null value.
- */
- public void run()
- {
- super.run();
- if (getValue() != null)
- doOKprocessing(getValue());
- }
-
-
- /**
- * Overrides parent method to allow creating of a dialog meeting our interface,
- * so we can pass instance of ourselves to it for callbacks to get our data.
- * <p>
- * If your dialog does not implement our interface, override this method!
- */
- protected Dialog createDialog(Shell parent)
- {
- SystemFilterDialogInterface fDlg = createFilterDialog(parent);
- fDlg.setFilterDialogActionCaller(this);
- return (Dialog)fDlg;
- }
-
- /**
- * Where you create the dialog meeting our interface. If you override
- * createDialog, then override this to return null
- */
- public abstract SystemFilterDialogInterface createFilterDialog(Shell parent);
-
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to retrieve the data
- * from the dialog. For InputDialog dialogs, this is simply
- * a matter of return dlg.getValue();
- * <p>
- * This is called by the run method after the dialog returns. Callers
- * of this object can subsequently retrieve it by calling getValue.
- *
- * @param dlg The dialog object, after it has returned from open.
- */
- protected abstract Object getDialogValue(Dialog dlg);
-
- /**
- * Method called when ok pressed on dialog and after getDialogValue has set the
- * value attribute appropriately.
- * <p>
- * Only called if user pressed OK on dialog.
- * <p>
- * @param dlgValue The output of getDialogValue().
- */
- public abstract void doOKprocessing(Object dlgValue);
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java
deleted file mode 100644
index 4cb8ea012..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolAction.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.actions;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.ui.actions.SystemBaseDialogAction;
-import org.eclipse.rse.ui.dialogs.SystemSimpleContentElement;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInputs;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * Base class capturing the attributes and operations common to dialog actions
- * that work on system filter pools.
- */
-public abstract class SystemFilterAbstractFilterPoolAction
- extends SystemBaseDialogAction
-
-{
-
-
- protected SystemFilterPoolDialogInputs dlgInputs;
- protected String mgrNamePreselect;
-
- /**
- * Constructor when given the translated action label
- */
- public SystemFilterAbstractFilterPoolAction(Shell parent, String title)
- {
- super(title, null, parent);
- allowOnMultipleSelection(false);
- init();
- }
-
- /**
- * Constructor when given the translated action label
- */
- public SystemFilterAbstractFilterPoolAction(Shell parent, String title, String tooltip)
- {
- super(title, tooltip, null, parent);
- allowOnMultipleSelection(false);
- init();
- }
-
-
-
- /**
- * Constructor when given the resource bundle and key for the action label
- */
- public SystemFilterAbstractFilterPoolAction(Shell parent, ImageDescriptor image, String label, String tooltip)
- {
- super(label, tooltip, image, parent);
- allowOnMultipleSelection(false);
- init();
- }
-
- /**
- * Common initialization code
- */
- protected void init()
- {
- dlgInputs = new SystemFilterPoolDialogInputs();
- }
-
- // ----------------------------
- // HELP ID SETTINGS...
- // ----------------------------
-
- /**
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
-
- // --------------------------------------
- // SELECTION CHANGED INTERCEPT METHODS...
- // --------------------------------------
-
- /**
- * This is called by the UI calling the action, if that UI is not a selection provider.
- * That is, this is an alternative to calling selectionChanged when there is no SelectionChangedEvent.
- * @see #selectionChanged(SelectionChangedEvent event)
- */
- public void setSelection(ISelection selection)
- {
- super.setSelection(selection);
- Object firstSelection = getFirstSelection();
- if (isEnabled() && (firstSelection != null))
- {
- if (firstSelection instanceof SystemSimpleContentElement)
- firstSelection = ((SystemSimpleContentElement)firstSelection).getData();
-
- if (firstSelection instanceof ISystemFilterPoolManagerProvider)
- setFilterPoolManagerProvider((ISystemFilterPoolManagerProvider)firstSelection);
- else if (firstSelection instanceof ISystemFilterPoolManager)
- setFilterPoolManagerProvider(((ISystemFilterPoolManager)firstSelection).getProvider());
- else if (firstSelection instanceof ISystemFilterPool)
- setFilterPoolManagerProvider(((ISystemFilterPool)firstSelection).getProvider());
- else if (firstSelection instanceof ISystemFilter)
- setFilterPoolManagerProvider(((ISystemFilter)firstSelection).getProvider());
- else if (firstSelection instanceof ISystemFilterString)
- setFilterPoolManagerProvider(((ISystemFilterString)firstSelection).getProvider());
-
- else if (firstSelection instanceof ISystemFilterPoolReferenceManagerProvider)
- setFilterPoolReferenceManager(((ISystemFilterPoolReferenceManagerProvider)firstSelection).getSystemFilterPoolReferenceManager());
- else if (firstSelection instanceof ISystemFilterPoolReferenceManager)
- setFilterPoolReferenceManager((ISystemFilterPoolReferenceManager)firstSelection);
- else if (firstSelection instanceof ISystemFilterPoolReference)
- setFilterPoolReferenceManager(((ISystemFilterPoolReference)firstSelection).getFilterPoolReferenceManager());
- else if (firstSelection instanceof ISystemFilterReference)
- setFilterPoolReferenceManager(((ISystemFilterReference)firstSelection).getFilterPoolReferenceManager());
- else if (firstSelection instanceof ISystemFilterStringReference)
- setFilterPoolReferenceManager(((ISystemFilterStringReference)firstSelection).getFilterPoolReferenceManager());
- }
- }
-
- // ----------------------------
- // ATTRIBUTE GETTERS/SETTERS...
- // ----------------------------
-
- /**
- * Set the input filter pool manager provider from which to get the list of filter pool managers.
- * Either call this or call setFilterPoolManagers or override getFilterPoolManagerProvider().
- */
- public void setFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
- {
- dlgInputs.poolManagerProvider = provider;
- //setFilterPoolManagers(provider.getSystemFilterPoolManagers());
- }
-
- /**
- * Get the input filter pool manager provider from which to get the list of filter pool managers.
- */
- public ISystemFilterPoolManagerProvider getFilterPoolManagerProvider()
- {
- //if (dlgInputs.poolManagerProvider != null)
- return dlgInputs.poolManagerProvider;
- //else if ((dlgInputs.poolManagers != null) && (dlgInputs.poolManagers.length > 0))
- //return dlgInputs.poolManagers[0].getProvider();
- //else
- //return null;
- }
-
- /**
- * Set the input filter pool managers from which to allow selections of filter pools.
- * Either call this or call setFilterPoolManagerProvider or override getFilterPoolManagers().
- */
- public void setFilterPoolManagers(ISystemFilterPoolManager[] managers)
- {
- dlgInputs.poolManagers = managers;
- }
-
- /**
- * Returns the filter pool managers from which to show filter pools for selection.
- * <p>
- * By default, tries the following in this order:
- * <ol>
- * <li>calls getFilterPoolManagerProvider if setFilterPoolManagerProvider was called
- * <li>uses what was given in setFilterPoolManagers
- * <li>uses what was given in setFilterPoolReferenceManager, calling its getSystemFilterPoolManagers
- * <li>checks if the current selection is a filterPoolReferenceManager, and if so uses the managers it references from.
- * </ol>
- */
- public ISystemFilterPoolManager[] getFilterPoolManagers()
- {
- ISystemFilterPoolManager[] mgrs = null;
- ISystemFilterPoolManagerProvider provider = getFilterPoolManagerProvider();
- mgrs = dlgInputs.poolManagers;
- if ((mgrs==null) && (provider != null))
- mgrs = provider.getSystemFilterPoolManagers(); // get it in real time.
- if (mgrs == null)
- {
- ISystemFilterPoolReferenceManager refmgr = getFilterPoolReferenceManager();
- if (refmgr != null)
- mgrs = refmgr.getSystemFilterPoolManagers();
- }
- if (mgrs == null)
- {
- ISystemFilterPoolReferenceManagerProvider sfprmp = getReferenceManagerProviderSelection();
- if (sfprmp != null)
- mgrs = sfprmp.getSystemFilterPoolReferenceManager().getSystemFilterPoolManagers();
- }
- return mgrs;
- }
- /**
- * Return the current selection if it implements SystemFilterPoolReferenceManagerProvider
- */
- protected ISystemFilterPoolReferenceManagerProvider getReferenceManagerProviderSelection()
- {
- Object obj = getFirstSelection();
- if ((obj instanceof ISystemFilterPoolReferenceManagerProvider))
- return (ISystemFilterPoolReferenceManagerProvider)obj;
- else
- return null;
- }
- /**
- * Set the zero-based index of the manager name to preselect.
- * The default is zero.
- * Either call this or override getFilterPoolManagerNameSelectionIndex or call setFilterPoolManagerNamePreSelection(String)
- */
- public void setFilterPoolManagerNameSelectionIndex(int index)
- {
- dlgInputs.mgrSelection = index;
- }
- /**
- * Returns the zero-based index of the manager name to preselect.
- * Returns what was set in setFilterPoolManagerNamePreSelection or setFilterPoolManagerNameSelectionIndex by default.
- */
- public int getFilterPoolManagerNameSelectionIndex()
- {
- int pos = -1;
- if (mgrNamePreselect != null)
- {
- ISystemFilterPoolManager[] mgrs = getFilterPoolManagers();
- if (mgrs != null)
- {
- for (int idx=0; (pos<0) && (idx<mgrs.length); idx++)
- if (mgrs[idx].getName().equals(mgrNamePreselect))
- pos = idx;
- }
- }
- if (pos < 0)
- return dlgInputs.mgrSelection;
- else
- {
- //System.out.println("Found a match for mgr name '"+mgrNamePreselect+"' so preselect index is "+pos);
- return pos;
- }
- }
- /**
- * Set the name of the filter pool manager to pre-select
- */
- public void setFilterPoolManagerNamePreSelection(String name)
- {
- this.mgrNamePreselect = name;
- }
-
- /**
- * Set the input filter pool reference manager which is holding the references this
- * dialog is allowing the user to select.
- * <p>
- * If you call this, then this action has everything it needs to know to be fully self-contained.
- * It will totally handle updating the reference manager with the user's selections and
- * deselections.
- */
- public void setFilterPoolReferenceManager(ISystemFilterPoolReferenceManager refManager)
- {
- dlgInputs.refManager = refManager;
- }
- /**
- * Returns the filter pool reference manager which contains the list of selected filter pools
- * that this dialog is showing and allowing the user to change.
- * <p>
- * If not set, then the subclass needs to override doOKprocessing.
- */
- public ISystemFilterPoolReferenceManager getFilterPoolReferenceManager()
- {
- return dlgInputs.refManager;
- }
-
- /**
- * Set the dialog title.
- * Either call this or override getDialogTitle()
- */
- public void setDialogTitle(String title)
- {
- dlgInputs.title = title;
- }
- /**
- * Get the dialog title.
- * By default, uses what was given in setDialogTitle, or an english default if nothing set.
- */
- public String getDialogTitle()
- {
- return dlgInputs.title;
- }
-
- /**
- * Set the dialog prompt text.
- * Either call this or override getDialogPrompt()
- */
- public void setDialogPrompt(String prompt)
- {
- dlgInputs.prompt = prompt;
- }
- /**
- * Get the dialog prompt.
- * By default, uses what was given in setDialogPrompt
- */
- public String getDialogPrompt()
- {
- return dlgInputs.prompt;
- }
-
- /**
- * Set the dialog's filter pool name prompt text and tooltip
- * Either call this or override getDialogFilterPoolNamePrompt/Tip()
- */
- public void setDialogFilterPoolNamePrompt(String prompt, String tip)
- {
- dlgInputs.poolNamePrompt = prompt;
- dlgInputs.poolNameTip = tip;
- }
- /**
- * Get the dialog's filter pool name prompt text.
- * By default, uses what was given in setDialogFilterPoolNamePrompt.
- */
- public String getDialogFilterPoolNamePrompt()
- {
- return dlgInputs.poolNamePrompt;
- }
- /**
- * Get the dialog's filter pool name tooltip text.
- * By default, uses what was given in setDialogFilterPoolNamePrompt.
- */
- public String getDialogFilterPoolNameTip()
- {
- return dlgInputs.poolNameTip;
- }
-
- /**
- * Set the dialog's filter pool manager name prompt text and tooltip
- * Either call this or override getDialogFilterPoolManagerNamePrompt/Tip()
- */
- public void setDialogFilterPoolManagerNamePrompt(String prompt, String tip)
- {
- dlgInputs.poolMgrNamePrompt = prompt;
- dlgInputs.poolMgrNameTip = tip;
- }
- /**
- * Get the dialog's filter pool manager name prompt text.
- * By default, uses what was given in setDialogFilterPoolManagerNamePrompt.
- */
- public String getDialogFilterPoolManagerNamePrompt()
- {
- return dlgInputs.poolMgrNamePrompt;
- }
- /**
- * Get the dialog's filter pool manager name tooltip text.
- * By default, uses what was given in setDialogFilterPoolManagerNamePrompt.
- */
- public String getDialogFilterPoolManagerNameTip()
- {
- return dlgInputs.poolMgrNameTip;
- }
-
- /**
- * Set the dialog's pre-select information.
- * Either call this or override getDialogPreSelectInput()
- */
- public void setDialogPreSelectInput(Object selectData)
- {
- dlgInputs.preSelectObject = selectData;
- }
- /**
- * Get the dialog's pre-select information.
- * By default, uses what was given in setDialogPreSelectInput.
- */
- public Object getDialogPreSelectInput()
- {
- return dlgInputs.preSelectObject;
- }
-
-
- // -------------------------
- // PARENT CLASS OVERRIDES...
- // -------------------------
-
- /**
- * Called by SystemBaseAction when selection is set.
- * Our opportunity to verify we are allowed for this selected type.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- return (selectedObject instanceof ISystemFilterPoolReferenceManagerProvider); // override as appropriate
- }
-
-
- /**
- * Walk elements deciding pre-selection
- */
- protected void preSelect(SystemSimpleContentElement inputElement)
- {
- SystemSimpleContentElement[] mgrElements = inputElement.getChildren();
- for (int idx=0; idx<mgrElements.length; idx++)
- {
- //SystemFilterPoolManager mgr = (SystemFilterPoolManager)mgrElements[idx].getData();
- SystemSimpleContentElement[] poolElements = mgrElements[idx].getChildren();
- for (int jdx=0; jdx<poolElements.length; jdx++)
- {
- //if (poolElements[jdx].isSelected())
- poolElements[jdx].setSelected(
- getFilterPoolPreSelection((ISystemFilterPool)poolElements[jdx].getData()));
- }
- }
- }
- /**
- * Decide per pool if it should be selected or not.
- * Default behaviour is to select it if it is currently referenced.
- */
- protected boolean getFilterPoolPreSelection(ISystemFilterPool pool)
- {
- return pool.getReferenceCount() > 0;
- }
-
- /**
- * Extends run in parent class to call doOKprocessing if the result of calling
- * getDialogValue() resulted in a non-null value.
- */
- public void run()
- {
- super.run();
- if (getValue() != null)
- doOKprocessing(getValue());
- }
-
-
- /**
- * Overrides parent method to allow creating of a dialog meeting our interface,
- * so we can pass instance of ourselves to it for callbacks to get our data.
- * <p>
- * If your dialog does not implement our interface, override this method!
- */
- protected Dialog createDialog(Shell parent)
- {
- SystemFilterPoolDialogInterface fpDlg = createFilterPoolDialog(parent);
- fpDlg.setFilterPoolDialogActionCaller(this);
- return (Dialog)fpDlg;
- }
-
- /**
- * Where you create the dialog meeting our interface. If you override
- * createDialog, then override this to return null
- * @since 3.0
- */
- public abstract SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent);
-
- /**
- * If you decide to use the supplied run method as is,
- * then you must override this method to retrieve the data
- * from the dialog. For InputDialog dialogs, this is simply
- * a matter of returning dlg.getValue();
- * <p>
- * This is called by the run method after the dialog returns. Callers
- * of this object can subsequently retrieve it by calling getValue.
- *
- * @param dlg The dialog object, after it has returned from open.
- */
- protected abstract Object getDialogValue(Dialog dlg);
-
- /**
- * Method called when ok pressed on dialog and after getDialogValue has set the
- * value attribute appropriately.
- * <p>
- * Only called if user pressed OK on dialog.
- * <p>
- * @param dlgValue The output of getDialogValue().
- */
- public abstract void doOKprocessing(Object dlgValue);
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java
deleted file mode 100644
index 79d92a702..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterPoolWizardAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.actions;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterPoolWizardDialog;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterPoolWizardInterface;
-import org.eclipse.swt.widgets.Shell;
-
-
-public abstract class SystemFilterAbstractFilterPoolWizardAction
- extends SystemFilterAbstractFilterPoolAction
-{
-
-
-
- /**
- * Constructor for SystemFilterAbstactFilterPoolWizardAction
- */
- public SystemFilterAbstractFilterPoolWizardAction(Shell parent, String title)
- {
- super(parent, title);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- }
-
-
-
- /**
- * Constructor for SystemFilterAbstactFilterPoolWizardAction
- */
- public SystemFilterAbstractFilterPoolWizardAction(Shell parent, ImageDescriptor image,
- String label, String tooltip)
- {
- super(parent, image, label, tooltip);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- }
-
- /**
- * @see SystemFilterAbstractFilterPoolAction#doOKprocessing(Object)
- */
- public void doOKprocessing(Object dlgValue)
- {
- }
-
- /**
- * @see SystemFilterAbstractFilterPoolAction#getDialogValue(Dialog)
- */
- protected Object getDialogValue(Dialog dlg)
- {
- return null;
- }
-
- /**
- * @see SystemFilterAbstractFilterPoolAction#createFilterPoolDialog(Shell)
- */
- public SystemFilterPoolDialogInterface createFilterPoolDialog(Shell parent)
- {
- SystemFilterPoolWizardInterface newWizard = getFilterPoolWizard();
- SystemFilterPoolDialogInterface dialog =
- new SystemFilterPoolWizardDialog(parent, newWizard);
- return dialog;
- }
-
- /**
- * Return the wizard so we can customize it prior to showing it.
- * @since 3.0
- */
- public abstract SystemFilterPoolWizardInterface getFilterPoolWizard();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java
deleted file mode 100644
index eeda326be..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemFilterAbstractFilterWizardAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.actions;
-
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.rse.internal.ui.filters.dialogs.SystemFilterWizardDialog;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.filters.dialogs.ISystemFilterWizard;
-import org.eclipse.rse.ui.filters.dialogs.SystemFilterDialogInterface;
-import org.eclipse.swt.widgets.Shell;
-
-
-public abstract class SystemFilterAbstractFilterWizardAction
- extends SystemFilterAbstractFilterAction
-{
-
-
-
- /**
- * Constructor for SystemFilterAbstactFilterWizardAction
- */
- public SystemFilterAbstractFilterWizardAction(Shell parent, String title)
- {
- super(parent, title);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- }
-
- /**
- * Constructor for SystemFilterAbstactFilterWizardAction
- */
- public SystemFilterAbstractFilterWizardAction(Shell parent, String label, String tooltip)
- {
- super(parent, label, tooltip);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- }
-
- /**
- * @see SystemFilterAbstractFilterAction#doOKprocessing(Object)
- */
- public void doOKprocessing(Object dlgValue)
- {
- }
-
- /**
- * @see SystemFilterAbstractFilterAction#getDialogValue(Dialog)
- */
- protected Object getDialogValue(Dialog dlg)
- {
- return null;
- }
-
- /**
- * @see SystemFilterAbstractFilterAction#createFilterDialog(Shell)
- */
- public SystemFilterDialogInterface createFilterDialog(Shell parent)
- {
- ISystemFilterWizard newWizard = getFilterWizard();
-
- SystemFilterDialogInterface dialog =
- new SystemFilterWizardDialog(parent, newWizard);
-
- return dialog;
- }
-
- /**
- * Return the wizard so we can customize it prior to showing it.
- */
- public abstract ISystemFilterWizard getFilterWizard();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java
deleted file mode 100644
index 89464d842..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/actions/SystemNewFilterAction.java
+++ /dev/null
@@ -1,493 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.actions;
-import java.util.Vector;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterContainer;
-import org.eclipse.rse.core.filters.ISystemFilterContainerReference;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolSelectionValidator;
-import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.actions.SystemBaseWizardAction;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The action acts as a base class for all "New Filter" wizards so we can
- * get some common functionality.
- * <p>
- * An interesting capability of this action is to defer configuration, which might be
- * time consuming, until the user selects to run it. That can be done by registering
- * a callback object that implements ISystemNewFilterActionConfigurator.
- */
-public class SystemNewFilterAction
- extends SystemBaseWizardAction
-
-{
- protected ISystemFilterPool parentPool;
- protected ISystemFilterPool[] poolsToSelectFrom;
- protected ISystemFilterPoolWrapperInformation poolWrapperInformation;
- protected boolean nested = false;
- protected boolean showFilterStrings = true;
- protected boolean showNamePrompt = true;
- protected boolean showInfoPage = true;
- protected boolean fromRSE = false;
- protected String[] defaultFilterStrings;
- protected String type = null;
- protected String verbiage = null;
- protected String page1Description;
- protected String namePageHelp;
- protected ISystemFilterPoolSelectionValidator filterPoolSelectionValidator;
- protected ISystemNewFilterActionConfigurator callbackConfigurator;
- protected boolean callbackConfiguratorCalled = true;
- protected Object callbackData = null;
- protected SystemFilterStringEditPane editPane;
-
- /**
- * Constructor for non-nested actions.
- */
- public SystemNewFilterAction(Shell shell, ISystemFilterPool parentPool,
- String label, String tooltip, ImageDescriptor image)
- {
- this(shell, parentPool, label, tooltip, image, false);
- }
- /**
- * Constructor allowing nested actions. Changes the title.
- */
- public SystemNewFilterAction(Shell shell, ISystemFilterPool parentPool,
- String label, String tooltip, ImageDescriptor image,
- boolean nested)
- {
- super(label, tooltip, image, shell);
- setContextMenuGroup(ISystemContextMenuConstants.GROUP_NEW);
- this.parentPool = parentPool;
- this.nested = nested;
- setAvailableOffline(true);
- }
- /**
- * Constructor to use when you want to just use the default action name and image.
- * Also defaults to nested filters not allowed.
- */
- public SystemNewFilterAction(Shell shell, ISystemFilterPool parentPool)
- {
- this(shell, parentPool, SystemResources.ACTION_NEWFILTER_LABEL, SystemResources.ACTION_NEWFILTER_TOOLTIP,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTER_ID), false);
- }
-
- // ------------------------
- // CONFIGURATION METHODS...
- // ------------------------
-
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Call this to defer expensive configuration until the user runs the action
- * @param caller - an implementor of the callback interface
- * @param data - any data the callback needs. It will be passed back on the callback.
- */
- public void setCallBackConfigurator(ISystemNewFilterActionConfigurator caller, Object data)
- {
- this.callbackConfigurator = caller;
- this.callbackData = data;
- this.callbackConfiguratorCalled = false;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set the help context Id (infoPop) for this action. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelpContextId(String id)
- {
- setHelp(id);
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set the parent filter pool that the new-filter actions need.
- * Typically this is set at constructor time but it can be set later if re-using the action.
- */
- public void setParentFilterPool(ISystemFilterPool parentPool)
- {
- this.parentPool = parentPool;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * If you want to prompt the user for the parent filter pool to create this filter in,
- * call this with the list of filter pools. In this case, the filter pool passed into
- * the constructor will be used as the initial selection.
- */
- public void setAllowFilterPoolSelection(ISystemFilterPool[] poolsToSelectFrom)
- {
- this.poolsToSelectFrom = poolsToSelectFrom;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[])}
- * <p>
- * If you want to prompt the user for the parent filter pool to create this filter in,
- * but want to not use the term "pool" say, you can use an array of euphamisms. That is,
- * you can pass an array of objects that map to filter pools, but have a different
- * display name that is shown in the dropdown.
- * <p>
- * Of course, if you want to do this, then you will likely want to offer a different
- * label and tooltip for the prompt, and different verbiage above the prompt. The
- * object this method accepts as a parameter encapsulates all that information, and
- * there is a default class you can use for this.
- */
- public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolsToSelectFrom)
- {
- this.poolWrapperInformation = poolsToSelectFrom;
- }
-
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set the type of filter we are creating. Results in a call to setType(String) on the new filter.
- * Types are not used by the base filter framework but are a way for tools to create typed
- * filters and have unique actions per filter type.
- * <p>This will also result in a call to setType(String) on the filter string edit pane, which
- * sets the <samp>type</samp> instance variable in case your edit pane subclass needs to know.
- */
- public void setType(String type)
- {
- this.type = type;
- }
- /**
- * <i>Getter method. Do not override.</i><br>
- * Get the type of filter as set by {@link #setType(String)}
- */
- public String getType()
- {
- return type;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set whether to show, or hide, the first page that prompts for a filter string. Default is true.
- * @see #setDefaultFilterStrings(String[])
- */
- public void setShowFilterStrings(boolean show)
- {
- showFilterStrings = show;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Call this if you want the new filter to have some default filter strings.
- */
- public void setDefaultFilterStrings(String[] defaultFilterStrings)
- {
- this.defaultFilterStrings = defaultFilterStrings;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Call in order to not prompt the user for a filter name. This also implies we will not
- * be prompting for a parent filter pool! Default is true.
- * <p>
- * This is used when creating temporary filters that won't be saved. In this case, on
- * Finish a filter is not created! Instead, call getFilterStrings() to get the filter
- * strings created by the user ... typically there is just one unless you also called
- * setDefaultFilterStrings, in which case they will also be returned.
- * <p>
- * For convenience, when this is called, setShowInfoPage(false) is called for you
- */
- public void setShowNamePrompt(boolean show)
- {
- showNamePrompt = show;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Call in order to not show the final info-only page of the wizard. Default is true.
- * @see #setVerbiage(String)
- */
- public void setShowInfoPage(boolean show)
- {
- showInfoPage = show;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set the verbiage to show on the final page. By default, it shows a tip about creating multiple
- * filter strings via the Change action. Use this method to change that default.
- */
- public void setVerbiage(String verbiage)
- {
- this.verbiage = verbiage;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set the description to display on the first page of the wizard
- */
- public void setPage1Description(String description)
- {
- this.page1Description = description;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set if we are creating a filter for use in the RSE or not. This affects the
- * tips and help.
- * <p>
- * This is set to true automatically by the subsystem factory base class in the RSE,
- * else it defaults to false.
- */
- public void setFromRSE(boolean rse)
- {
- this.fromRSE = true;
- }
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Set the validator to call when the user selects a filter pool. Optional.
- * Only valid in create mode.
- */
- public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
- {
- this.filterPoolSelectionValidator = validator;
- }
-
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Specify an edit pane that prompts the user for the contents of a filter string.
- */
- public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
- {
- this.editPane = editPane;
- }
-
- /**
- * <i>Configuration method. Do not override.</i><br>
- * Specify the help to show for the name page (page 2)
- */
- public void setNamePageHelp(String helpId)
- {
- this.namePageHelp = helpId;
- }
-
- // ----------------------
- // OVERRIDABLE METHODS...
- // ----------------------
- /**
- * <i><b>Overridable</b> configuration method.</i><br>
- * Overridable extension. For those cases when you don't want to create your
- * own wizard subclass, but prefer to simply configure the default wizard.
- * <p>
- * Note, at the point this is called, all the base configuration, based on the
- * setters for this action, have been called. There really is nothing much that
- * can't be done via setters. The reason you may want to subclass versus use the
- * setters is defer expensive operations until the user actually selects the New Filter
- * action. Using the setters means this is done at time the popup menu is being
- * construction. Overriding this method allows you to defer the wizard configuration
- * until the user selects the action and the wizard is actually created.
- * <p>By default, this does nothing.
- */
- protected void configureNewFilterWizard(SystemNewFilterWizard wizard)
- {
- }
-
- /**
- * <i><b>Overridable</b> configuration method.</i><br>
- * Configure the new filter created by the wizard. This is only called after
- * successful completion of the wizard
- * <p>By default, this does nothing.
- */
- protected void configureNewFilter(ISystemFilter newFilter)
- {
- }
-
- // --------------------
- // LIFECYCLE METHODS...
- // --------------------
-
- /**
- * <i>Lifecyle method. Do not override. Instead override {@link #createNewFilterWizard(ISystemFilterPool)}.</i><br>
- * The default processing for the run method calls createDialog, which
- * in turn calls this method to return an instance of our wizard.<br>
- * Our default implementation is to call createNewFilterWizard.
- * <p>
- * Note your own wizard must subclass {@link org.eclipse.rse.ui.filters.dialogs.SystemNewFilterWizard SystemNewFilterWizard}
- */
- protected IWizard createWizard()
- {
- if ((callbackConfigurator != null) && !callbackConfiguratorCalled)
- {
- callbackConfigurator.configureNewFilterAction(((ISubSystem)callbackData).getSubSystemConfiguration(), this, callbackData);
- callbackConfiguratorCalled = true;
- }
- SystemNewFilterWizard wizard = createNewFilterWizard(parentPool);
- if (poolsToSelectFrom != null)
- wizard.setAllowFilterPoolSelection(poolsToSelectFrom);
- else if (poolWrapperInformation != null)
- wizard.setAllowFilterPoolSelection(poolWrapperInformation);
- if (type != null)
- wizard.setType(type);
- if (defaultFilterStrings != null)
- wizard.setDefaultFilterStrings(defaultFilterStrings);
- if (namePageHelp != null)
- wizard.setNamePageHelp(namePageHelp);
- wizard.setShowFilterStrings(showFilterStrings);
- wizard.setShowNamePrompt(showNamePrompt);
- wizard.setShowInfoPage(showInfoPage);
- wizard.setFromRSE(fromRSE);
- if (verbiage != null)
- wizard.setVerbiage(verbiage);
- if (page1Description != null)
- wizard.setPage1Description(page1Description);
- if (filterPoolSelectionValidator != null)
- wizard.setFilterPoolSelectionValidator(filterPoolSelectionValidator);
- if (editPane != null)
- wizard.setFilterStringEditPane(editPane);
- ISystemFilterPoolReferenceManagerProvider provider = getSystemFilterPoolReferenceManagerProvider();
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"Inside createWizard. null? " + (provider==null));
- wizard.setSystemFilterPoolReferenceManagerProvider(provider);
- configureNewFilterWizard(wizard);
- return wizard;
- }
-
- /**
- * <i><b>Overridable</b> lifecyle method. </i><br>
- * Create and return the actual wizard.
- * By default this returns an instance of {@link SystemNewFilterWizard}.
- * <p>
- * You can avoid creating your own wizard subclass by instead overriding
- * {@link #configureNewFilterWizard(SystemNewFilterWizard)}
- */
- protected SystemNewFilterWizard createNewFilterWizard(ISystemFilterPool parentPool)
- {
- return new SystemNewFilterWizard(parentPool);
- }
- /**
- * <i>Lifecyle method. Do not override. Instead override {@link #configureNewFilter(ISystemFilter)}.</i><br>
- * Intercept of parent method so we can allow overrides opportunity to
- * configure the new filter.
- * This simply calls configureNewFilter.
- */
- protected void postProcessWizard(IWizard wizard)
- {
- SystemNewFilterWizard newFilterWizard = (SystemNewFilterWizard)wizard;
- ISystemFilter newFilter = newFilterWizard.getSystemFilter();
- if (newFilter != null)
- configureNewFilter(newFilter);
- }
-
- /**
- * <i>Lifecyle method. No need to override.</i><br>
- * Decide whether to enable this action based on selected object's type.
- * Returns false unless selected object is a filter pool or subsystem.
- */
- public boolean checkObjectType(Object selectedObject)
- {
- return ((selectedObject instanceof ISystemFilterContainer) ||
- (selectedObject instanceof ISystemFilterContainerReference) ||
- (selectedObject instanceof ISystemFilterPoolReferenceManagerProvider));
- }
-
- // -----------------
- // OUTPUT METHODS...
- // -----------------
-
- /**
- * <i>Output method. Do not override.</i><br>
- * Get the contextual system filter pool reference manager provider. Will return non-null if the
- * current selection is a reference to a filter pool or filter, or a reference manager
- * provider.
- */
- public ISystemFilterPoolReferenceManagerProvider getSystemFilterPoolReferenceManagerProvider()
- {
- Object firstSelection = getFirstSelection();
- if (firstSelection != null)
- {
- if (firstSelection instanceof ISystemFilterReference)
- return ((ISystemFilterReference)firstSelection).getProvider();
- else if (firstSelection instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference)firstSelection).getProvider();
- else if (firstSelection instanceof ISystemFilterPoolReferenceManagerProvider)
- return (ISystemFilterPoolReferenceManagerProvider)firstSelection;
- else
- return null;
- }
- return null;
- }
-
- /**
- * <i>Output method. Do not override.</i><br>
- * Convenience method to return the newly created filter after running the action.
- * Will be null if the user cancelled. Will also be null if you called setShowNamePrompt(false),
- * in which case you should call getNewFilterStrings().
- * <p>
- * Be sure to call wasCancelled() first before calling this.
- */
- public ISystemFilter getNewFilter()
- {
- Object output = getValue();
- if (output instanceof ISystemFilter)
- return (ISystemFilter)getValue();
- else
- return null;
- }
-
- /**
- * <i>Output method. Do not override.</i><br>
- * When prompting for an unnamed filter, no filter is created. Instead, the user is prompted
- * for a single filter string. This method returns that string. However, if you happened to
- * call setDefaultFilterStrings(...) then those are also returned, hence the need for an
- * array. If not, this will be an array of one, or null if the user cancelled the wizard.
- * <p>
- * Be sure to call wasCancelled() first before calling this.
- */
- public String[] getFilterStrings()
- {
- Object output = getValue();
- if (output == null)
- return null;
- else if (output instanceof Vector)
- {
- Vector v = (Vector)output;
- String[] strings = new String[v.size()];
- for (int idx=0; idx<strings.length; idx++)
- strings[idx] = (String)v.elementAt(idx);
- return strings;
- }
- else if (output instanceof ISystemFilter)
- {
- return ((ISystemFilter)output).getFilterStrings();
- }
- else
- return null;
- }
- /**
- * <i>Output method. Do not override.</i><br>
- * Shortcut to getFilterStrings()[0].
- */
- public String getFilterString()
- {
- String[] strings = getFilterStrings();
- if ((strings!=null) && (strings.length>0))
- return strings[0];
- else
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java
deleted file mode 100644
index 54f5a89e2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemFilterWizard.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-
-import org.eclipse.rse.ui.wizards.ISystemWizard;
-
-
-public interface ISystemFilterWizard
- extends ISystemWizard, SystemFilterDialogInterface
-{
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java
deleted file mode 100644
index 7cedebf9c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/ISystemNewFilterWizardConfigurator.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-
-
-/**
- * Much of the new filter wizard is configurable, especially with respect to translated strings.
- * While there exists setters and overridable methods for most of it, sometimes that gets overwhelming.
- * This interface is designed to capture all the configurable attributes that are not likely to change
- * from usage to usage of the wizard (eg, not context sensitive) such that for convenience you can
- * implement it in a class and instantiate a singleton instance of that class to re-use for your
- * wizard.
- * <p>
- * Your best option is to subclass {@link SystemNewFilterWizardConfigurator} and override just those
- * things you want to change.
- */
-public interface ISystemNewFilterWizardConfigurator
-{
-
- /**
- * Return the default page title to use for each page, unless overridden individually
- */
- public String getPageTitle();
- /**
- * Return the page title for page 1 (which prompts for the filter string)
- */
- public String getPage1Title();
- /**
- * Return the description for page 1 (which prompts for the filter string)
- */
- public String getPage1Description();
-
- /**
- * Return the page title for page 2 (which prompts for the name and filter pool)
- */
- public String getPage2Title();
- /**
- * Return the description for page 2 (which prompts for the name and filter pool)
- */
- public String getPage2Description();
- /**
- * Return the help ID for page 2
- */
- public String getPage2HelpID();
- /**
- * Return the verbiage for the name prompt on page 2
- */
- public String getPage2NameVerbiage();
- /**
- * Return the verbiage for the pool prompt on page 3
- */
- public String getPage2PoolVerbiage();
- /**
- * Return the verbiage tooltip for the name prompt on page 2
- */
- public String getPage2PoolVerbiageTip();
- /**
- * Return the label for the filter name
- * prompt on page 2.
- */
- public String getPage2NamePromptLabel();
-
- /**
- * Return the tooltip for the filter name
- * prompt on page 2.
- */
- public String getPage2NamePromptTooltip();
-
- /**
- * Return the label for the filter pool
- * prompt on page 2.
- */
- public String getPage2PoolPromptLabel();
-
- /**
- * Return the label for the filter pool
- * prompt on page 2.
- */
- public String getPage2PoolPromptTooltip();
-
- /**
- * Get the "Unique to this connection" checkbox label
- */
- public String getPage2UniqueToConnectionLabel();
- /**
- * Set the "Unique to this connection" checkbox tooltip
- */
- public String getPage2UniqueToConnectionToolTip();
-
- /**
- * Return the page title for page 3 (which shows 2 tips)
- */
- public String getPage3Title();
- /**
- * Return the description for page 3 (which shows 2 tips)
- */
- public String getPage3Description();
- /**
- * Return the first tip on page 3
- */
- public String getPage3Tip1();
- /**
- * Return the second tip on page 3
- */
- public String getPage3Tip2();
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java
deleted file mode 100644
index 472e03bf5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemChangeFilterDialog.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemPageCompleteListener;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.filters.ISystemChangeFilterPaneEditPaneSupplier;
-import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * A dialog that allows the user to change a filter. It allows update of the filter strings. <br>
- * We do not typically override this to produce our own change filter dialog ... rather we usually
- * call the configuration methods to affect it. At a minimum, we usually want to set the {@link #setFilterStringEditPane(SystemFilterStringEditPane) editpane},
- * which is used to prompt for a new filter string or change an existing one. We usually share the
- * same edit pane with the {@link SystemNewFilterWizard} wizard.
- */
-public class SystemChangeFilterDialog extends SystemPromptDialog
- implements ISystemPageCompleteListener, ISystemChangeFilterPaneEditPaneSupplier
-{
-
- protected SystemChangeFilterPane changeFilterPane;
- protected SystemFilterStringEditPane editPane;
-
- /**
- * Constructor
- */
- public SystemChangeFilterDialog(Shell shell)
- {
- this(shell, SystemResources.RESID_CHGFILTER_TITLE);
- }
- /**
- * Constructor, when unique title desired
- */
- public SystemChangeFilterDialog(Shell shell, String title)
- {
- super(shell, title);
- changeFilterPane = new SystemChangeFilterPane(shell, this, this);
- changeFilterPane.addPageCompleteListener(this);
- setHelp();
- }
-
- /**
- * Overridable extension point for setting dialog help
- */
- protected void setHelp()
- {
- setHelp(RSEUIPlugin.HELPPREFIX+"dufr0000"); //$NON-NLS-1$
- }
-
- // INPUT/CONFIGURATION
- /**
- * <i>Configuration method</i><br>
- * Specify an edit pane that prompts the user for the contents of a filter string.
- */
- public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
- {
- this.editPane = editPane;
- }
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool reference manager provider. Will be non-null if the
- * current selection is a reference to a filter pool or filter, or a reference manager
- * provider.
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- changeFilterPane.setSystemFilterPoolReferenceManagerProvider(provider);
- }
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool manager provider. Will be non-null if the
- * current selection is a filter pool or filter, or reference to them, or a manager provider.
- * Generally this is called when the setSystemFilterPoolReferenceManagerProvider can't be called
- * for some reason.
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
- {
- changeFilterPane.setSystemFilterPoolManagerProvider(provider);
- }
-
- /**
- * <i>Configuration method</i><br>
- * Set the Parent Filter Pool prompt label and tooltip text.
- */
- public void setParentPoolPromptLabel(String label, String tip)
- {
- changeFilterPane.setParentPoolPromptLabel(label, tip);
- }
- /**
- * Return the parent filter pool prompt label, as set by {@link #setParentPoolPromptLabel(String, String)}
- */
- public String getParentPoolPromptLabel()
- {
- return changeFilterPane.getParentPoolPromptLabel();
- }
- /**
- * Return the parent filter pool prompt tip, as set by {@link #setParentPoolPromptLabel(String, String)}
- */
- public String getParentPoolPromptTip()
- {
- return changeFilterPane.getParentPoolPromptTip();
- }
-
- /**
- * <i>Configuration method</i><br>
- * Set the name prompt label and tooltip text.
- */
- public void setNamePromptLabel(String label, String tip)
- {
- changeFilterPane.setNamePromptLabel(label, tip);
- }
- /**
- * Return the name prompt label as set by {@link #setNamePromptLabel(String, String)}
- */
- public String getNamePromptLabel()
- {
- return changeFilterPane.getNamePromptLabel();
- }
- /**
- * Return the name prompt tip as set by {@link #setNamePromptLabel(String, String)}
- */
- public String getNamePromptTip()
- {
- return changeFilterPane.getNamePromptTip();
- }
-
- /**
- * <i>Configuration method</i><br>
- * Set the label shown in group box around the filter string list, and the tooltip text for the
- * list box.
- */
- public void setListLabel(String label, String tip)
- {
- changeFilterPane.setListLabel(label, tip);
- }
- /**
- * Return list label as set by {@link #setListLabel(String, String)}
- */
- public String getListLabel()
- {
- return changeFilterPane.getListLabel();
- }
- /**
- * Return list tip as set by {@link #setListLabel(String, String)}
- */
- public String getListTip()
- {
- return changeFilterPane.getListTip();
- }
-
- /**
- * Set the string to show as the first item in the list.
- * The default is "New filter string"
- */
- public void setNewListItemText(String label)
- {
- changeFilterPane.setNewListItemText(label);
- }
- /**
- * Return the text for the list item, as set by {@link #setNewListItemText(String)},
- * or the default if not set.
- */
- public String getNewListItemText()
- {
- return changeFilterPane.getNewListItemText();
- }
-
- /**
- * <i>Configuration method</i><br>
- * Call this to specify a validator for the filter string. It will be called per keystroke.
- * A default validator is supplied otherwise: ValidatorFilterString.
- * <p>
- * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
- * <p>
- * Alternatively, if all you want is a unique error message for the case when duplicates are found,
- * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
- */
- public void setFilterStringValidator(ISystemValidator v)
- {
- changeFilterPane.setFilterStringValidator(v);
- }
- /**
- * Return the result of {@link #setFilterStringValidator(ISystemValidator)}.
- */
- public ISystemValidator getFilterStringValidator()
- {
- return changeFilterPane.getFilterStringValidator();
- }
- /**
- * <i>Configuration method</i><br>
- * Set the error message to use when the user is editing or creating a filter string, and the
- * Apply processing detects a duplicate filter string in the list.
- */
- public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
- {
- changeFilterPane.setDuplicateFilterStringErrorMessage(msg);
- }
- /**
- * Return results of {@link #setDuplicateFilterStringErrorMessage(SystemMessage)}
- */
- public SystemMessage getDuplicateFilterStringErrorMessage()
- {
- return changeFilterPane.getDuplicateFilterStringErrorMessage();
- }
-
- /**
- * <i>Configuration method</i><br>
- * Specify if you want to include a test button or not. Appears with "Apply" and "Reset"
- */
- public void setWantTestButton(boolean wantTestButton)
- {
- changeFilterPane.setWantTestButton(wantTestButton);
- }
- /**
- * Return whether a test button is wanted or not, as set by {@link #setWantTestButton(boolean)}
- */
- public boolean getWantTestButton()
- {
- return changeFilterPane.getWantTestButton();
- }
-
- /**
- * Set if the edit pane is not to be editable
- */
- public void setEditable(boolean editable)
- {
- changeFilterPane.setEditable(editable);
- }
- /**
- * Return whether the edit pane is editable, as set by {@link #setEditable(boolean)}
- */
- public boolean getEditable()
- {
- return changeFilterPane.getEditable();
- }
-
- /**
- * Set if the user is to be allowed to create multiple filter strings or not. Default is true
- */
- public void setSupportsMultipleStrings(boolean multi)
- {
- changeFilterPane.setSupportsMultipleStrings(multi);
- }
- /**
- * Return whether the user is to be allowed to create multiple filter strings or not. Default is true
- */
- public boolean getSupportsMultipleStrings()
- {
- return changeFilterPane.getSupportsMultipleStrings();
- }
-
- // LIFECYCLE
- /**
- * Intercept of parent so we can set the input filter, and deduce whether
- * strings are case sensitive and if duplicates are allowed.<br>
- * Not typically overridden, but if you do, be sure to call super!
- */
- public void setInputObject(Object inputObject)
- {
- changeFilterPane.setInputObject(inputObject);
- }
-
- /**
- * Returns the control (the list view) to recieve initial focus control
- */
- protected Control getInitialFocusControl()
- {
- return changeFilterPane.getInitialFocusControl();
- }
- /**
- * Populates the content area
- */
- protected Control createInner(Composite parent)
- {
- return changeFilterPane.createContents(parent);
- }
- /**
- * Intercept of parent so we can reset the default button
- */
- protected void createButtonsForButtonBar(Composite parent)
- {
- super.createButtonsForButtonBar(parent);
- getShell().setDefaultButton(changeFilterPane.getApplyButton()); // defect 46129
- }
- /**
- * Return our edit pane. Overriding this is an alternative to calling setEditPane.
- * Method is declared in {@link ISystemChangeFilterPaneEditPaneSupplier}.
- */
- public SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
- {
- if (editPane == null)
- editPane = new SystemFilterStringEditPane(shell);
- return editPane;
- }
-
- /**
- * Parent override.
- * Called when user presses OK button.
- * This is when we save all the changes the user made.
- */
- protected boolean processOK()
- {
- return changeFilterPane.processOK();
- }
-
- /**
- * Parent override.
- * Called when user presses CLOSE button. We simply blow away all their changes!
- */
- protected boolean processCancel()
- {
- return changeFilterPane.processCancel();
- }
-
-
- /**
- * The comleteness of the page has changed.
- * This is a callback from SystemChangeFilterPane.
- */
- public void setPageComplete(boolean complete)
- {
- super.setPageComplete(complete);
- }
-
- /**
- * Returns parent shell, under which this window's shell is created.
- *
- * @return the parent shell, or <code>null</code> if there is no parent shell
- */
- public Shell getParentShell()
- {
- return super.getParentShell();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInputs.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInputs.java
deleted file mode 100644
index 33c5c0e18..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInputs.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-/**
- * A class capturing the attributes commonly needed by dialogs that
- * work with filters.
- */
-public class SystemFilterDialogInputs
-{
-
-
- public String title;
- public String prompt;
- public String filterNamePrompt;
- public String filterNameTip;
- public Object preSelectObject;
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInterface.java
deleted file mode 100644
index 5f3a2c490..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogInterface.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterAction;
-
-
-/**
- * Common interface for dialogs or wizards that work with filters.
- */
-public interface SystemFilterDialogInterface
-{
- /**
- * Allow base action to pass instance of itself for callback to get info
- */
- public void setFilterDialogActionCaller(SystemFilterAbstractFilterAction caller);
- /**
- * Return an object containing user-specified information pertinent to filter pool actions
- */
- public SystemFilterDialogOutputs getFilterDialogOutputs();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogOutputs.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogOutputs.java
deleted file mode 100644
index cb47fcde2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterDialogOutputs.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-import org.eclipse.rse.core.filters.ISystemFilter;
-
-
-/**
- * A class capturing the attributes commonly returned by dialogs that
- * work with filters.
- */
-public class SystemFilterDialogOutputs
-{
-
-
- public String filterName;
- public String filterPoolName;
- public ISystemFilter newFilter;
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java
deleted file mode 100644
index 9369fe32c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemFilterPoolWizardInterface.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-import org.eclipse.rse.ui.filters.SystemFilterPoolDialogInterface;
-import org.eclipse.rse.ui.wizards.ISystemWizard;
-
-/**
- * An interface for filter pool wizards to implement
- *
- * @since 3.0 moved from "internal" to API
- */
-public interface SystemFilterPoolWizardInterface
- extends ISystemWizard, SystemFilterPoolDialogInterface
-{
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizard.java
deleted file mode 100644
index fbe3974a3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizard.java
+++ /dev/null
@@ -1,676 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David Dykstal (IBM) - [222270] clean up interfaces in org.eclipse.rse.core.filters
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [226948] [api][regression] SystemNewFilterWizard.createNamePage() is no longer available
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-
-import java.util.Arrays;
-import java.util.Vector;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterContainer;
-import org.eclipse.rse.core.filters.ISystemFilterContainerReference;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolSelectionValidator;
-import org.eclipse.rse.core.filters.ISystemFilterPoolWrapper;
-import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFilterName;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Base Wizard for users to define a new system filter.
- * While subsystem providers are free to offer their own wizards, this
- * abstracts out much of it and makes it easy to simply override and
- * supply a couple classes to offer a totally unique presentation to the
- * user.
- * <p>
- * Some guiding design rules for this wizard:
- * <ul>
- * <li>Users are confused about filter strings versus filters. So, we don't
- * support the creation of multiple filter strings at the time the filter
- * is created, only after via the change action. The wizard basically
- * prompts for the creation of a single new filter string.
- * <li>Users are confused about "naming" a filter, so the name is not asked
- * for until the second page, and it is possible for subclasses to
- * default that name to something intelligent based on the contents of
- * the first page, such that users can press Finish and not think about
- * the name.
- * </ul>
- * <p>
- * While this class can be subclassed, you should find all attributes can be
- * configured via setters.
- */
-public class SystemNewFilterWizard
- extends AbstractSystemWizard
-{
- protected SystemNewFilterWizardMainPage mainPage;
- private SystemNewFilterWizardNamePage namePage;
- protected SystemNewFilterWizardInfoPage infoPage;
- protected ISystemFilterContainer filterContainer;
- protected ISystemFilterPool parentPool;
- protected ISystemFilterPool[] poolsToSelectFrom;
- protected String type;
- protected String[] defaultFilterStrings;
- //protected String verbiage;
- //protected String page1Description;
- protected boolean showFilterStrings = true;
- protected boolean showNamePrompt = true;
- protected boolean showInfoPage = true;
- protected boolean fromRSE = false;
- protected boolean page1DescriptionSet = false;
- protected ISystemFilter newFilter = null;
- protected SystemFilterStringEditPane editPane;
- protected ISystemFilterPoolReferenceManagerProvider provider;
- protected ISystemFilterPoolWrapperInformation poolWrapperInformation;
- protected ISystemFilterPoolSelectionValidator filterPoolSelectionValidator;
- protected ISystemNewFilterWizardConfigurator configurator;
-
-
- /**
- * Constructor when you want to supply your own title and image
- * @param title - title to show for this wizard. This is used as the page title! The title is always "New"!
- * @param wizardImage - title bar image for this wizard
- * @param parentPool - the filter pool we are to create this filter in.
- */
- public SystemNewFilterWizard(String title, ImageDescriptor wizardImage, ISystemFilterPool parentPool)
- {
- this(new SystemNewFilterWizardConfigurator(title), wizardImage, parentPool);
- }
- /**
- * Constructor when you want to use the default page title and image, or want to
- * supply it via setWizardTitle and setWizardImage.
- * @param parentPool - the filter pool we are to create this filter in.
- */
- public SystemNewFilterWizard(ISystemFilterPool parentPool)
- {
- this(new SystemNewFilterWizardConfigurator(),
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWFILTERWIZARD_ID),
- parentPool);
- }
- /**
- * Constructor when you want to supply all your own configuration data
- * @param data - configuration data
- * @param wizardImage - title bar image for this wizard
- * @param parentPool - the filter pool we are to create this filter in.
- */
- public SystemNewFilterWizard(ISystemNewFilterWizardConfigurator data, ImageDescriptor wizardImage, ISystemFilterPool parentPool)
- {
- super(SystemResources.RESID_NEWFILTER_TITLE, wizardImage);
- super.setWizardPageTitle(data.getPageTitle());
- super.setForcePreviousAndNextButtons(true);
- this.configurator = data;
- this.parentPool = parentPool;
- setOutputObject(null);
- }
-
- // -----------------------------------
- // INPUT/CONFIGURATION METHODS...
- // -----------------------------------
-
- /**
- * If you want to prompt the user for the parent filter pool to create this filter in,
- * call this with the list of filter pools. In this case, the filter pool passed into
- * the constructor will be used as the initial selection.
- */
- public void setAllowFilterPoolSelection(ISystemFilterPool[] poolsToSelectFrom)
- {
- this.poolsToSelectFrom = poolsToSelectFrom;
- }
- /**
- * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[])}
- * <p>
- * If you want to prompt the user for the parent filter pool to create this filter in,
- * but want to not use the term "pool" say, you can use an array of euphamisms. That is,
- * you can pass an array of objects that map to filter pools, but have a different
- * display name that is shown in the dropdown.
- * <p>
- * Of course, if you want to do this, then you will likely want to offer a different
- * label and tooltip for the prompt, and different verbiage above the prompt. The
- * object this method accepts as a parameter encapsulates all that information, and
- * there is a default class you can use for this.
- */
- public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolsToSelectFrom)
- {
- this.poolWrapperInformation = poolsToSelectFrom;
- }
- /**
- * Set the type of filter we are creating. Results in a call to setType on the new filter.
- * Types are not used by the base filter framework but are a way for tools to create typed
- * filters and have unique actions per filter type.
- */
- public void setType(String type)
- {
- this.type = type;
- }
- /**
- * Get the type of filter as set by {@link #setType(String)}
- */
- public String getType()
- {
- return type;
- }
- /**
- * Call in order to not have the first page, but instead the name-prompt page. Default is true.
- * @see #setDefaultFilterStrings(String[])
- */
- public void setShowFilterStrings(boolean show)
- {
- showFilterStrings = show;
- }
- /**
- * Call in order to not prompt the user for a filter name. This also implies we will not
- * be prompting for a parent filter pool! Default is true.
- * <p>
- * This is used when creating temporary filters that won't be saved. In this case, on
- * Finish a filter is not created! Instead, call getFilterStrings() to get the filter
- * strings created by the user ... typically there is just one unless you also called
- * setDefaultFilterStrings, in which case they will also be returned.
- * <p>
- * For convenience, when this is called, setShowInfoPage(false) is called for you
- */
- public void setShowNamePrompt(boolean show)
- {
- showNamePrompt = show;
- if (!show)
- setShowInfoPage(false);
- }
- /**
- * Specify the help to show for the name page (page 2)
- */
- public void setNamePageHelp(String helpId)
- {
- if (configurator instanceof SystemNewFilterWizardConfigurator)
- ((SystemNewFilterWizardConfigurator)configurator).setPage2HelpID(helpId);
- }
- /**
- * Call in order to not show the final info-only page of the wizard. Default is true.
- */
- public void setShowInfoPage(boolean show)
- {
- showInfoPage = show;
- }
- /**
- * Call this if you want the filter to auto-include some default filter strings.
- */
- public void setDefaultFilterStrings(String[] defaultFilterStrings)
- {
- this.defaultFilterStrings = defaultFilterStrings;
- }
- /**
- * Set if we are creating a filter for use in the RSE or not. This affects the
- * tips and help.
- * <p>
- * This is set to true automatically by the subsystem factory base class in the RSE,
- * else it defaults to false.
- */
- public void setFromRSE(boolean rse)
- {
- this.fromRSE = true;
- }
- /**
- * Set the validator to call when the user selects a filter pool. Optional.
- * Only valid in create mode.
- */
- public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
- {
- this.filterPoolSelectionValidator = validator;
- }
-
- /**
- * Set the contextual system filter pool reference manager provider. Eg, in the RSE, this
- * will be the selected subsystem if the New Filter action is launched from there, or if
- * launched from a filter pool reference under there.
- * <p>
- * Will be non-null if the current selection is a reference to a filter pool or filter,
- * or a reference manager provider.
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- this.provider = provider;
- //RSEUIPlugin.logDebugMessage(this.getClass().getName(),"Inside setSystemFilterPoolReferenceManagerProvider. null? " + (provider==null));
- }
- /**
- * Set the verbiage to show on the final page. By default, it shows a tip about creating multiple
- * filter strings via the Change action. Use this method to change that default.
- */
- public void setVerbiage(String verbiage)
- {
- if (configurator instanceof SystemNewFilterWizardConfigurator)
- ((SystemNewFilterWizardConfigurator)configurator).setPage3Tip1(verbiage);
- }
- /**
- * Set the wizard page title. Using this makes it possible to avoid subclassing.
- * The page title goes below the wizard title, and can be unique per page. However,
- * typically the wizard page title is the same for all pages... eg "Filter".
- * <p>
- * This is not used by default, but can be queried via getPageTitle() when constructing
- * pages.
- */
- public void setWizardPageTitle(String pageTitle)
- {
- super.setWizardPageTitle(pageTitle);
- if (configurator instanceof SystemNewFilterWizardConfigurator)
- ((SystemNewFilterWizardConfigurator)configurator).setPageTitle(pageTitle);
- }
- /**
- * Set the description to display on the first page of the wizard
- */
- public void setPage1Description(String description)
- {
- if (configurator instanceof SystemNewFilterWizardConfigurator)
- ((SystemNewFilterWizardConfigurator)configurator).setPage1Description(description);
- page1DescriptionSet = true;
- }
-
- /**
- * Specify an edit pane that prompts the user for the contents of a filter string.
- */
- public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
- {
- this.editPane = editPane;
- }
-
- // -----------------------------------
- // INTERNAL BUT OVERRIDABLE METHODS...
- // -----------------------------------
- /**
- * Extendable point for child classes. You don't need to override typically though... rather
- * you can simply supply your own filter string edit pane.
- * <p>
- * By default, this page uses the wizard page title as set in setWizardPageTitle(...) or the constructor.
- * @return the primary page prompting for a single filter string.
- */
- protected SystemNewFilterWizardMainPage createMainPage()
- {
- mainPage = null;
- if (editPane == null)
- mainPage = new SystemNewFilterWizardMainPage(this, configurator);
- else
- mainPage = new SystemNewFilterWizardMainPage(this, editPane, configurator);
- return mainPage;
- }
- /**
- * By default, this page uses the wizard page title as set in
- * setWizardPageTitle(...) or the constructor.
- *
- * @return the wizard page prompting for the filter name and parent filter
- * pool
- * @since 3.0 moved SystemNewFilterWizardNamePage from internal to API
- */
- protected SystemNewFilterWizardNamePage createNamePage()
- {
- namePage = new SystemNewFilterWizardNamePage(this, parentPool, configurator);
- return namePage;
- }
- /**
- * Extendable point for child classes. You don't need to override typically though.
- * <p>
- * By default, this page uses the wizard page title as set in setWizardPageTitle(...) or the constructor.
- * @return the final wizard page with additional readonly information
- */
- protected SystemNewFilterWizardInfoPage createInfoPage()
- {
- boolean showFilterPoolsTip = ((poolsToSelectFrom != null) || (poolWrapperInformation != null));
- infoPage = new SystemNewFilterWizardInfoPage(this, showFilterPoolsTip, configurator);
- return infoPage;
- }
- /**
- * Override of parent to do nothing
- */
- public void addPages() {}
-
- /**
- * Creates the wizard pages.
- * This method is an override from the parent Wizard class.
- */
- public void createPageControls(Composite c)
- {
- try {
- // MAIN PAGE...
- mainPage = createMainPage();
- mainPage.setSystemFilterPoolReferenceManagerProvider(provider);
- mainPage.setType(type);
- if (defaultFilterStrings != null)
- mainPage.setDefaultFilterStrings(defaultFilterStrings);
- if (showFilterStrings)
- {
- addPage(mainPage);
- }
-
- // NAME PAGE...
- namePage = createNamePage();
- if (showNamePrompt && (namePage!=null))
- {
- if (filterPoolSelectionValidator!=null)
- namePage.setFilterPoolSelectionValidator(filterPoolSelectionValidator);
- if (poolsToSelectFrom != null)
- {
- ISystemValidator[] validators = new ISystemValidator[poolsToSelectFrom.length];
- for (int idx=0; idx<validators.length; idx++)
- validators[idx] = getFilterNameValidator(poolsToSelectFrom[idx]);
- namePage.setAllowFilterPoolSelection(poolsToSelectFrom, validators);
- }
- else if (poolWrapperInformation != null)
- {
- ISystemFilterPoolWrapper[] wrappers = poolWrapperInformation.getWrappers();
- ISystemValidator[] validators = new ISystemValidator[wrappers.length];
- for (int idx=0; idx<validators.length; idx++)
- validators[idx] = getFilterNameValidator(wrappers[idx].getSystemFilterPool());
- namePage.setAllowFilterPoolSelection(poolWrapperInformation, validators);
- }
- else
- {
- ISystemValidator validator = getFilterNameValidator(getFilterContainer());
- namePage.setFilterNameValidator(validator);
- }
- if (!showFilterStrings && page1DescriptionSet)
- namePage.setDescription(configurator.getPage1Description());
- addPage(namePage);
- }
-
- // INFO PAGE...
- if (showInfoPage)
- {
- infoPage = createInfoPage();
- if (infoPage!=null)
- {
- addPage(infoPage);
- }
- }
- } catch (Exception exc)
- {
- SystemBasePlugin.logError("Error in createPageControls of SystemNewFilterWizard", exc); //$NON-NLS-1$
- //System.out.println("Error in createPageControls of SystemNewFilterWizard"); // temp
- //exc.printStackTrace(); // temp
- }
- }
- /**
- * Extendable point for child classes.
- * Override to change the validator used for the filter name given the master object.
- * By default, uses FilterNameValidator.
- */
- protected ISystemValidator getFilterNameValidator(ISystemFilterContainer container)
- {
- return getFilterNameValidator(container, null);
- }
- /**
- * Reusable method to return a name validator for renaming a filter.
- * @param container the current filter object on updates. Can be null for new names. Used
- * to remove from the existing name list the current filter's name.
- * @param filter the filter whose name should be removed from the validation list. May be null if the list from the container
- * should be used intact.
- * @return a name validator
- */
- public static ISystemValidator getFilterNameValidator(ISystemFilterContainer container, ISystemFilter filter) {
- String[] names = container.getSystemFilterNames();
- Vector v = new Vector(names.length);
- v.addAll(Arrays.asList(names));
- if (filter != null) {
- v.removeElement(filter.getName());
- }
- ValidatorFilterName filterNameValidator = new ValidatorFilterName(v);
- return filterNameValidator;
- }
-
- /**
- * Override if necessary.
- * Returns true if filter strings are case-sensitive in this filter.
- * <p>
- * By default, returns the value in the selected filter container. If this is null, returns false.
- */
- public boolean areStringsCaseSensitive()
- {
- ISystemFilterContainer fc = getFilterContainer();
- if (fc != null)
- return fc.areStringsCaseSensitive();
- return false;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish() {
- boolean ok = false;
- newFilter = null;
- setOutputObject(null);
- if (!mainPage.performFinish()) {
- setPageError(mainPage);
- } else if (!namePage.performFinish()) {
- setPageError(namePage);
- } else {
- Vector filterStrings = mainPage.getFilterStrings();
- String filterName = null;
- if (showNamePrompt) {
- filterName = namePage.getFilterName();
- // Get the filter parent, i.e. the filter pool for this new filter
- ISystemFilterContainer filterParent = null;
- if ((poolsToSelectFrom != null) || (poolWrapperInformation != null)) {
- filterParent = namePage.getParentSystemFilterPool();
- if (namePage.getUniqueToThisConnection()) {
- /*
- * this means the user selected to create this filter in the filter pool that is unique to this connection. So now we
- * must find, or create, that filter pool.
- */
- filterParent = provider.getUniqueOwningSystemFilterPool(true); // true -> create if not found
- } else
- filterParent = namePage.getParentSystemFilterPool();
- } else
- filterParent = getFilterContainer();
- // Create the filter and possibly a filter pool reference.
- String type = mainPage.getType();
- try {
- newFilter = createNewFilter(getShell(), filterParent, filterName, filterStrings, type);
- if (newFilter == null) return false;
- /*
- * We allow users to select a profile to create their filter in. From this we
- * select the default filter pool for the particular subsystem in that profile.
- * It is possible for the user to pick a profile that this subsystem does not yet reference.
- * To solve this we need to add a reference for them. This is only a possibility when called
- * from a subsystem's New Filter action, versus that action on a directly on a filter pool.
- */
- if ((provider != null) && (filterParent instanceof ISystemFilterPool)) {
- ISystemFilterPool parentPool = (ISystemFilterPool) filterParent;
- if (provider.getSystemFilterPoolReferenceManager().getReferenceToSystemFilterPool(parentPool) == null) {
- provider.getSystemFilterPoolReferenceManager().addReferenceToSystemFilterPool(parentPool);
- }
- }
- } catch (Exception exc) {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_OCCURRED);
- msg.makeSubstitution(exc);
- SystemMessageDialog msgDlg = new SystemMessageDialog(getShell(), msg);
- msgDlg.openWithDetails();
- return false;
- }
- setOutputObject(newFilter);
- // special handling to expand the currently selected parent node and reveal the new filter
- if ((newFilter != null) && (getInputObject() != null)) {
- Object selectedObject = getInputObject();
- if ((selectedObject instanceof ISystemFilterPoolReference) || (selectedObject instanceof ISystemFilterPoolReferenceManagerProvider)) {
- ISystemFilterPoolReferenceManagerProvider provider = null;
- if (selectedObject instanceof ISystemFilterPoolReference) {
- ISystemFilterPoolReferenceManager sfprm = ((ISystemFilterPoolReference) selectedObject).getFilterPoolReferenceManager();
- if (sfprm != null) provider = sfprm.getProvider();
- } else
- provider = (ISystemFilterPoolReferenceManagerProvider) selectedObject;
- if (provider != null) provider.filterEventFilterCreated(selectedObject, newFilter);
- } else if (selectedObject instanceof ISystemFilterReference) {
- ISystemFilterReference ref = (ISystemFilterReference) selectedObject;
- ISystemFilterPoolReferenceManagerProvider provider = ref.getProvider();
- provider.filterEventFilterCreated(selectedObject, newFilter);
- }
- }
- ok = (newFilter != null);
- } // end if showNamePrompt
- else {
- ok = true;
- setOutputObject(filterStrings);
- }
- return ok;
- }
- return false;
- }
-
- /**
- * Return the parent into which we are creating a filter. If filterContainer has been set,
- * returns that, else returns getInputObject() which is set by the calling action.
- */
- protected Object getParent()
- {
- if (filterContainer != null)
- return filterContainer;
- else
- return getInputObject();
- }
- /**
- * Return parent filter container to contain this filter
- */
- protected ISystemFilterContainer getFilterContainer()
- {
- //System.out.println("Old. inside getFilterContainer. " + filterContainer + ", " + getInputObject());
-
- if (filterContainer == null)
- {
- Object input = getInputObject();
- //if (input != null)
- // System.out.println("... input instanceof SystemFilterContainer? " + (input instanceof SystemFilterContainer));
- //else
- // System.out.println("... input is null");
-
- if (input != null)
- {
- if (input instanceof ISystemFilter)
- return ((ISystemFilter)input).getParentFilterContainer();
- else if (input instanceof ISystemFilterReference)
- return ((ISystemFilterReference)input).getReferencedFilter().getParentFilterContainer();
- else if (input instanceof ISystemFilterContainer)
- return (ISystemFilterContainer)input;
- else if (input instanceof ISystemFilterContainerReference)
- return ((ISystemFilterContainerReference)input).getReferencedSystemFilterContainer();
- else if (input instanceof ISystemFilterPoolReference)
- return ((ISystemFilterPoolReference)input).getReferencedFilterPool();
- else if (parentPool != null)
- return parentPool;
- else if ((poolsToSelectFrom != null) && (poolsToSelectFrom.length>0))
- return poolsToSelectFrom[0];
- else if (poolWrapperInformation != null)
- return poolWrapperInformation.getPreSelectWrapper().getSystemFilterPool();
- else
- return null;
- }
- else
- return null;
- }
- else
- return filterContainer;
- }
- /**
- * Set parent filter container to contain this filter
- */
- public void setFilterContainer(ISystemFilterContainer container)
- {
- this.filterContainer = container;
- }
- /**
- * Set parent filter container to contain this filter
- */
- public void setFilterContainer(ISystemFilterContainerReference containerRef)
- {
- this.filterContainer = containerRef.getReferencedSystemFilterContainer();
- }
-
- /**
- * Extendable point for child classes.
- * Override to create unique SystemFilter object.
- * By default calls createSystemFilter in subsystem factory.
- * @param shell the shell that hosts this wizard.
- * @param filterParent the parent of this filter - usually a filter pool
- * @param aliasName the name of the filter itself
- * @param filterStringsVector a Vector of string that contain the specification of this filter
- * @param type the type of the filter used when interpreting the filter, usually supplied by a subsystem
- * @return the ISystemFilter that was created
- * @throws Exception if an error occurs
- */
- public ISystemFilter createNewFilter(Shell shell, ISystemFilterContainer filterParent, String aliasName, Vector filterStringsVector, String type) throws Exception {
- ISystemFilter newFilter = null;
- ISystemFilterPoolManager fpMgr = filterParent.getSystemFilterPoolManager();
- if (type == null)
- newFilter = fpMgr.createSystemFilter(filterParent, aliasName, filterStringsVector);
- else
- newFilter = fpMgr.createSystemFilter(filterParent, aliasName, filterStringsVector, type);
- return newFilter;
- }
-
- // -----------------------
- // CALLBACKS FROM PAGES...
- // -----------------------
- /**
- * Return true if this filter is an RSE filter or not
- */
- protected boolean isFromRSE()
- {
- return fromRSE;
- }
- /**
- * For page 2 of the New Filter wizard, if it is possible to
- * deduce a reasonable default name from the user input here,
- * then return it here. Else, just return null.
- * <b>
- * By default this calls getDefaultFilterName on the edit pane.
- */
- public String getDefaultFilterName()
- {
- return mainPage.getEditPane(null).getDefaultFilterName();
- }
- // ------
- // OUTPUT
- // ------
- /**
- * Return the filter created upon successful finish
- */
- public ISystemFilter getSystemFilter()
- {
- return newFilter;
- }
-} // end class
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardConfigurator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardConfigurator.java
deleted file mode 100644
index d0404f4c0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardConfigurator.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-/**
- * Much of the new filter wizard is configurable, especially with respect to translated strings.
- * While there exists setters and overridable methods for most of it, sometimes that gets overwhelming.
- * This class is designed to capture all the configurable attributes that are not likely to change
- * from usage to usage of the wizard (eg, not context sensitive) such that for convenience you can
- * subclass it in a class and instantiate a singleton instance of that class to re-use in your
- * wizard.
- * <p>
- * Your best option is to subclass this and override just those things you want to change.
- */
-public class SystemNewFilterWizardConfigurator
- implements ISystemNewFilterWizardConfigurator
-{
- // cached attrs
- private String pageTitle;
- private String page1Description, page2Help, page3Tip1, page3Tip2;
-
- /**
- * Constructor for SystemNewFilterWizardConfigurator.
- */
- protected SystemNewFilterWizardConfigurator()
- {
- this(SystemResources.RESID_NEWFILTER_PAGE_TITLE);
- }
- /**
- * Constructor for SystemNewFilterWizardConfigurator when you want to change the page title
- */
- protected SystemNewFilterWizardConfigurator(String pageTitle)
- {
- super();
- this.pageTitle = pageTitle;
- this.page1Description = SystemResources.RESID_NEWFILTER_PAGE1_DESCRIPTION;
- this.page3Tip1 = SystemResources.RESID_NEWFILTER_PAGE3_STRINGS_VERBIAGE;
- this.page3Tip2 = SystemResources.RESID_NEWFILTER_PAGE3_POOLS_VERBIAGE;
- this.page2Help = RSEUIPlugin.HELPPREFIX + "nfp20000"; //$NON-NLS-1$
- }
-
- /**
- * Return the default page title to use for each page, unless overridden individually
- */
- public String getPageTitle()
- {
- return pageTitle;
- }
-
- /**
- * Return the page title for page 1 (which prompts for the filter string)
- */
- public String getPage1Title()
- {
- return pageTitle;
- }
-
- /**
- * Return the description for page 1 (which prompts for the filter string)
- */
- public String getPage1Description()
- {
- return page1Description;
- }
- /*page1 help of a wizard comes from the setDialogHelp of the wizard... so this is meaningless
- * Return the help ID for page 1
- *
- public String getPage1HelpID()
- {
- return RSEUIPlugin.HELPPREFIX + "nfp10000";
- }*/
-
- /**
- * Return the page title for page 2 (which prompts for the name and filter pool)
- */
- public String getPage2Title()
- {
- return pageTitle;
- }
- /**
- * Return the description for page 2 (which prompts for the name and filter pool)
- */
- public String getPage2Description()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_DESCRIPTION;
- }
- /**
- * Return the help ID for page 2
- */
- public String getPage2HelpID()
- {
- return page2Help;
- }
- /**
- * Return the verbiage for the name prompt on page 2
- */
- public String getPage2NameVerbiage()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_NAME_VERBIAGE;
- }
- /**
- * Return the verbiage for the name prompt on page 2
- */
- public String getPage2PoolVerbiage()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_POOL_VERBIAGE;
- }
- /**
- * Return the verbiage tooltip for the name prompt on page 2
- */
- public String getPage2PoolVerbiageTip()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_POOL_VERBIAGE_TIP;
- }
-
- public String getPage2NamePromptLabel()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_NAME_LABEL;
- }
-
- public String getPage2NamePromptTooltip()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_NAME_TOOLTIP;
- }
-
- public String getPage2PoolPromptLabel()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_POOL_LABEL;
- }
-
- public String getPage2PoolPromptTooltip()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_POOL_TOOLTIP;
- }
-
- /**
- * Get the "Unique to this connection" checkbox label
- */
- public String getPage2UniqueToConnectionLabel()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_UNIQUE_LABEL;
- }
- /**
- * Set the "Unique to this connection" checkbox tooltip
- */
- public String getPage2UniqueToConnectionToolTip()
- {
- return SystemResources.RESID_NEWFILTER_PAGE2_UNIQUE_TOOLTIP;
- }
-
- /**
- * Return the page title for page 3 (which shows 2 tips)
- */
- public String getPage3Title()
- {
- return pageTitle;
- }
- /**
- * Return the description for page 3 (which shows 2 tips)
- */
- public String getPage3Description()
- {
- return SystemResources.RESID_NEWFILTER_PAGE3_DESCRIPTION;
- }
- /**
- * Return the description for page 3 (which shows 2 tips)
- */
- public String getPage3Tip1()
- {
- return page3Tip1;
- }
-
- /**
- * Return the second tip on page 3
- */
- public String getPage3Tip2()
- {
- return page3Tip2;
- }
-
-
-
- // -------
- // SETTERS
- // -------
- /**
- * Set the default page title. Sometimes this is all you want to change and don't want to subclass.
- */
- public void setPageTitle(String pageTitle)
- {
- this.pageTitle = pageTitle;
- }
- /**
- * Set the description for page 1
- */
- public void setPage1Description(String description)
- {
- this.page1Description = description;
- }
- /**
- * Set the help ID for page 2
- */
- public void setPage2HelpID(String helpId)
- {
- this.page2Help = helpId;
- }
- /**
- * Set the first tip to show for page 3
- */
- public void setPage3Tip1(String tip)
- {
- this.page3Tip1 = tip;
- }
- /**
- * Set the second tip to show for page 3
- */
- public void setPage3Tip2(String tip)
- {
- this.page3Tip2 = tip;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java
deleted file mode 100644
index 10a0abbe7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardInfoPage.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-
-/**
- * Third page of the New Filter wizard that simply shows information
- */
-public class SystemNewFilterWizardInfoPage
- extends AbstractSystemWizardPage
-{
- private ISystemNewFilterWizardConfigurator configurator;
-
- /**
- * Constructor.
- */
- public SystemNewFilterWizardInfoPage(SystemNewFilterWizard wizard, boolean filterPoolsShowing, ISystemNewFilterWizardConfigurator data)
- {
- super(wizard, "NewFilterPage3", data.getPage3Title(), data.getPage3Description()); //$NON-NLS-1$
- this.configurator = data;
- //setHelp(data.getPage3HelpID());
- }
- // ---------------------------------
- // LIFECYCLE METHODS...
- // ---------------------------------
-
- // ---------------------------------
- // LIFECYCLE METHODS...
- // ---------------------------------
-
- /**
- * Populate the dialog area with our widgets. Return the composite they are in.
- */
- public Control createContents(Composite parent)
- {
- int nbrColumns = 1;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- if (configurator.getPage3Tip1() != null)
- {
- SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage3Tip1(), nbrColumns, false, 200);
- addSeparatorLine(composite_prompts, nbrColumns);
- addFillerLine(composite_prompts, nbrColumns);
- }
-
- if (((SystemNewFilterWizard)getWizard()).isFromRSE())
- {
- if (configurator.getPage3Tip2() != null)
- SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage3Tip2(), nbrColumns, false, 200);
- }
-
- return composite_prompts;
- }
-
- /**
- * Return the Control to be given initial focus.
- * Override from parent. Return control to be given initial focus.
- */
- protected Control getInitialFocusControl()
- {
- return null;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return true
- */
- public boolean performFinish()
- {
- return true;
- }
-
- /**
- * Return true if the page is complete, so to enable Finish.
- * Called by wizard framework.
- * @return true
- */
- public boolean isPageComplete()
- {
- return true;
- }
-
- /**
- * Inform wizard of page-complete status of this page
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java
deleted file mode 100644
index dfabd8947..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardMainPage.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-
-import java.util.Vector;
-
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Main page of the abstract "New Filter" wizard.
- * This page's content is supplyable in the form of an "edit pane" which
- * essentially is reponsible for the content area of the wizard, and
- * which implements necessary minimal methods for this wizard to
- * interact with it.
- * <p>
- * As per the design goals of the filter wizard, this page effectively
- * only prompts to create a single new filter string. Thus, the
- * edit pane needed is in fact the "new filter string" edit pane.
- */
-
-public class SystemNewFilterWizardMainPage
- extends AbstractSystemWizardPage
- implements ISystemFilterStringEditPaneListener
- //,SystemFilterNewFilterWizardMainPageInterface, ISystemMessageLine
-{
- protected SystemFilterStringEditPane editPane;
- protected String type;
- protected String[] defaultFilterStrings;
- protected boolean firstVisit = true;
- private Control clientArea;
- /**
- * Constructor.
- * Uses the wizard page title as set in the overall wizard.
- * Uses a default wizard page description. Change later via setDescription if desired.
- * @param wizard - the parent new filter wizard
- * @param data - configurable mri data
- */
- public SystemNewFilterWizardMainPage(SystemNewFilterWizard wizard, ISystemNewFilterWizardConfigurator data)
-
- {
- super(wizard,"NewFilterPage1", data.getPage1Title(), data.getPage1Description()); //$NON-NLS-1$
- editPane = getEditPane(wizard.getShell());
- //setHelp(data.getPage1HelpID()); not used as it comes from wizard help
- }
- /**
- * Constructor when unique edit pane supplied
- * Uses the wizard page title as set in the overall wizard.
- * Uses a default wizard page description. Change later via setDescription if desired.
- * @param wizard - the parent new filter wizard
- * @param editPane - the edit pane that prompts the user for a single filter string
- * @param data - configurable mri data
- */
- public SystemNewFilterWizardMainPage(SystemNewFilterWizard wizard, SystemFilterStringEditPane editPane, ISystemNewFilterWizardConfigurator data)
-
- {
- super(wizard,"NewFilterPage1", data.getPage1Title(), data.getPage1Description()); //$NON-NLS-1$
- this.editPane = editPane;
- editPane.addChangeListener(this);
- //setHelp(data.getPage1HelpID()); not used as it comes from wizard help
- }
- /**
- * Set the contextual system filter pool reference manager provider. Ie, in the RSE this
- * is the currently selected subsystem if this wizard was launched from a subsystem.
- * <p>
- * Will be non-null if the current selection is a reference to a filter pool or filter,
- * or a reference manager provider.
- * <p>
- * This is not used by default but made available for subclasses.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- editPane.setSystemFilterPoolReferenceManagerProvider(provider);
- }
- /**
- * Overrride this if you want to supply your own edit pane for the filter string.
- */
- protected SystemFilterStringEditPane getEditPane(Shell shell)
- {
- if (editPane == null)
- editPane = new SystemFilterStringEditPane(shell);
- return editPane;
- }
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- */
- public Control createContents(Composite parent)
- {
- clientArea = editPane.createContents(parent);
- editPane.addChangeListener(this);
- return clientArea;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- SystemMessage errorMessage = editPane.verify();
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- return (errorMessage == null);
- }
-
- /**
- * Return the Control to be given initial focus.
- * Override from parent. Return control to be given initial focus.
- */
- protected Control getInitialFocusControl()
- {
- return editPane.getInitialFocusControl();
- }
- // ------------------------------------
- // METHODS FOR EXTRACTING USER DATA ...
- // ------------------------------------
- /**
- * Return the user-specified filter strings
- */
- public Vector getFilterStrings()
- {
- Vector v = new Vector();
-
- String userAddedString = editPane.getFilterString();
- if ((userAddedString !=null) && (userAddedString.length()>0))
- {
- if (!v.contains(userAddedString))
- v.add(userAddedString);
- }
- else if (defaultFilterStrings != null)
- {
- for (int idx=0; idx<defaultFilterStrings.length; idx++)
- {
- v.add(defaultFilterStrings[idx]);
- }
- }
- return v;
- //return editPane.getFilterStrings();
- }
- /**
- * Get the type of filter as set by {@link #setType(String)}
- */
- public String getType()
- {
- return type;
- }
- // -----------------------------------------
- // METHODS FOR SETTING/CONFIGURING INPUT ...
- // -----------------------------------------
- /**
- * Set the type of filter we are creating. Results in a call to setType on the new filter.
- * Types are not used by the base filter framework but are a way for tools to create typed
- * filters and have unique actions per filter type.
- */
- public void setType(String type)
- {
- this.type = type;
- editPane.setType(type);
- }
-
- /**
- * Supply the default set of filter strings this filter is to have.
- */
- public void setDefaultFilterStrings(String[] defaultFilterStrings)
- {
- this.defaultFilterStrings = defaultFilterStrings;
- if (editPane != null)
- {
- for (int i = 0; i < defaultFilterStrings.length; i++)
- {
- editPane.setFilterString(defaultFilterStrings[i], i);
- }
- }
- }
-
- // ----------------------------------------------
- // EDIT PANE CHANGE LISTENER INTERFACE METHODS...
- // ----------------------------------------------
- /**
- * Callback method. The user has changed the filter string. It may or may not
- * be valid. If not, the given message is non-null. If it is, and you want it,
- * call getSystemFilterString() in the edit pane.
- */
- public void filterStringChanged(SystemMessage message)
- {
- if (message != null)
- setErrorMessage(message);
- else
- clearErrorMessage();
- setPageComplete(message == null);
- }
- /**
- * Callback method. We are about to do a verify,the side effect of which is to
- * change the current state of the dialog, which we don't want. This tells the
- * dialog to back up that state so it can be restored.
- */
- public void backupChangedState()
- {
- }
- /**
- * Callback method. After backup and change events this is called to restore state
- */
- public void restoreChangedState()
- {
- }
-
- // -------------------------------
- // INTERCEPT OF WIZARDPAGE METHODS
- // -------------------------------
- /**
- * This is called when a page is given focus or loses focus
- */
- public void setVisible(boolean visible)
- {
- super.setVisible(visible);
- if (visible)
- {
- // ok, we don't want to issue a msg in the user's face the first time they see this page, but
- // after that when we get focus we verify the contents.
- // It is the job of that verify method in the edit pane to fire an event back to us as the result
- // of that verify. This results in a call to our filterStringChanged method above.
- if (!firstVisit)
- editPane.verify();
- else
- setPageComplete(editPane.isComplete());
- firstVisit = false;
- //System.out.println("Edit pane size = " + clientArea.getSize());
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java
deleted file mode 100644
index f122a5e36..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/filters/dialogs/SystemNewFilterWizardNamePage.java
+++ /dev/null
@@ -1,556 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [160403] filters should be connection private by default
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David McKnight (IBM) - [226948] [api][regression] SystemNewFilterWizard.createNamePage() is no longer available
- * David McKnight (IBM) - [249482] Duplicate Filters can be created if changing the filter pool
- *******************************************************************************/
-
-package org.eclipse.rse.ui.filters.dialogs;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolSelectionValidator;
-import org.eclipse.rse.core.filters.ISystemFilterPoolWrapper;
-import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizardPage;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-
-
-
-/**
- * Second page of the New Filter wizard that prompts for the name of the filter.
- *
- * @since 3.0 moved from internal to API
- */
-public class SystemNewFilterWizardNamePage
- extends AbstractSystemWizardPage
- implements SelectionListener
-{
-
- protected Text nameText;
- protected Button uniqueCB;
- protected Label poolVerbiage;
- protected Label poolComboLabel;
- protected Combo poolWrapperCombo;
- protected Combo poolCombo;
- protected SystemMessage errorMessage;
- protected String inputFilterName;
- protected boolean contentsCreated;
- protected boolean userEditedName;
- protected boolean ignoreChanges;
- protected ISystemValidator nameValidator;
- protected ISystemValidator[] nameValidators;
- protected ISystemFilterPoolSelectionValidator filterPoolSelectionValidator;
- protected ISystemFilterPool[] poolsToSelectFrom = null;
- protected ISystemFilterPoolWrapper[] poolWrappers = null;
- protected ISystemFilterPoolWrapperInformation poolWrapperInformation;
- protected ISystemFilterPool parentPool = null;
- private ISystemNewFilterWizardConfigurator configurator;
-
- /**
- * Constructor.
- */
- public SystemNewFilterWizardNamePage(SystemNewFilterWizard wizard, ISystemFilterPool parentPool, ISystemNewFilterWizardConfigurator data)
- {
- super(wizard, "SetNewFilterName", data.getPage2Title(), data.getPage2Description()); //$NON-NLS-1$
- this.parentPool = parentPool;
- this.configurator = data;
- setHelp(data.getPage2HelpID());
- }
-
- // ---------------------------------
- // INPUT METHODS...
- // ---------------------------------
- /**
- * Set the filter name to default the entry field to
- */
- public void setFilterName(String filterName)
- {
- this.inputFilterName = filterName;
- if (nameText != null)
- nameText.setText(inputFilterName);
- }
- /**
- * Set the validator to use to verify the filter name is correct
- */
- public void setFilterNameValidator(ISystemValidator nameValidator)
- {
- this.nameValidator = nameValidator;
- }
- /**
- * Call if you want to allow the user to select the filter pool to create this filter in.
- */
- public void setAllowFilterPoolSelection(ISystemFilterPool[] poolsToSelectFrom,
- ISystemValidator[] nameValidators)
- {
- this.poolsToSelectFrom = poolsToSelectFrom;
- this.nameValidators = nameValidators;
- if ((poolsToSelectFrom != null) && (poolsToSelectFrom.length>0))
- {
- if (parentPool == null)
- parentPool = poolsToSelectFrom[0];
- }
- }
- /**
- * This is an alternative to {@link #setAllowFilterPoolSelection(ISystemFilterPool[], ISystemValidator[])}
- * <p>
- * If you want to prompt the user for the parent filter pool to create this filter in,
- * but want to not use the term "pool" say, you can use an array of euphamisms. That is,
- * you can pass an array of objects that map to filter pools, but have a different
- * display name that is shown in the dropdown.
- * <p>
- * Of course, if you want to do this, then you will likely want to offer a different
- * label and tooltip for the prompt, and different verbiage above the prompt. The
- * object this method accepts as a parameter encapsulates all that information, and
- * there is a default class you can use for this.
- */
- public void setAllowFilterPoolSelection(ISystemFilterPoolWrapperInformation poolWrappersToSelectFrom,
- ISystemValidator[] nameValidators)
- {
- this.poolWrapperInformation = poolWrappersToSelectFrom;
- this.nameValidators = nameValidators;
- if (parentPool == null)
- parentPool = poolWrappersToSelectFrom.getPreSelectWrapper().getSystemFilterPool();
- }
- /**
- * Set the validator to call when the user selects a filter pool. Optional.
- */
- public void setFilterPoolSelectionValidator(ISystemFilterPoolSelectionValidator validator)
- {
- filterPoolSelectionValidator = validator;
- //System.out.println("Inside setFilterPoolSelectionValidator. Non null? " + (validator != null));
- }
-
- // ---------------------------------
- // LIFECYCLE METHODS...
- // ---------------------------------
-
- /**
- * Populate the dialog area with our widgets. Return the composite they are in.
- */
- public Control createContents(Composite parent)
- {
-
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage2NameVerbiage(), nbrColumns, false, 200);
- nameText = SystemWidgetHelpers.createLabeledTextField(composite_prompts, null, configurator.getPage2NamePromptLabel(), configurator.getPage2NamePromptTooltip());
-
- addSeparatorLine(composite_prompts, nbrColumns);
- addFillerLine(composite_prompts, nbrColumns);
-
- // allow the user to create this filter uniquely for this connection, which means putting it in a
- // special filter pool we will create, just for this connection. This option is not shown if we are
- // already told which filter pool to create the filter in, such as in Show Filter Pools mode, when
- // the user selects New Filter to create a filter in the selected pool. We assume in this case the
- // will go in whatever filter is selected.
- if ((poolsToSelectFrom!=null) || (poolWrapperInformation!=null))
- {
- uniqueCB = SystemWidgetHelpers.createCheckBox(composite_prompts, nbrColumns, configurator.getPage2UniqueToConnectionLabel(), null);
- uniqueCB.setToolTipText(configurator.getPage2UniqueToConnectionToolTip());
- uniqueCB.addSelectionListener(this);
- uniqueCB.setSelection(true); // [160403] filters should be connection private by default
- }
-
- addFillerLine(composite_prompts, nbrColumns);
-
- if (poolsToSelectFrom != null)
- {
- poolVerbiage = SystemWidgetHelpers.createVerbiage(composite_prompts, configurator.getPage2PoolVerbiage(), nbrColumns, false, 200);
- poolVerbiage.setToolTipText(configurator.getPage2PoolVerbiageTip());
- poolCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, configurator.getPage2PoolPromptLabel(), configurator.getPage2PoolPromptTooltip());
- poolComboLabel = SystemWidgetHelpers.getLastLabel();
- String[] poolNames = new String[poolsToSelectFrom.length];
- int filterPoolSelectionIndex = 0;
- for (int idx=0; idx<poolNames.length; idx++)
- {
- ISystemFilterPool pool = poolsToSelectFrom[idx];
- if (pool == parentPool)
- filterPoolSelectionIndex = idx;
- poolNames[idx] = pool.getSystemFilterPoolManager().getName()+"."+pool.getName(); //$NON-NLS-1$
- }
- if ((nameValidator == null) && (nameValidators!=null))
- nameValidator = nameValidators[filterPoolSelectionIndex];
- poolCombo.setItems(poolNames);
- poolCombo.select(filterPoolSelectionIndex);
- poolCombo.addSelectionListener(this);
- if ((uniqueCB!=null) && uniqueCB.getSelection())
- {
- poolVerbiage.setEnabled(false);
- poolComboLabel.setEnabled(false);
- poolCombo.setEnabled(false);
- }
- }
- else if (poolWrapperInformation != null)
- {
- poolVerbiage = SystemWidgetHelpers.createVerbiage(composite_prompts, poolWrapperInformation.getVerbiageLabel(), nbrColumns, false, 200);
- poolWrapperCombo = SystemWidgetHelpers.createLabeledReadonlyCombo(composite_prompts, null, poolWrapperInformation.getPromptLabel(), poolWrapperInformation.getPromptTooltip());
- poolComboLabel = SystemWidgetHelpers.getLastLabel();
- poolWrappers = poolWrapperInformation.getWrappers();
- String[] poolNames = new String[poolWrappers.length];
- int filterPoolSelectionIndex = 0;
- for (int idx=0; idx<poolNames.length; idx++)
- {
- if (poolWrapperInformation.getPreSelectWrapper() == poolWrappers[idx])
- filterPoolSelectionIndex = idx;
- poolNames[idx] = poolWrappers[idx].getDisplayName();
- }
- if ((nameValidator == null) && (nameValidators!=null))
- nameValidator = nameValidators[filterPoolSelectionIndex];
- poolWrapperCombo.setItems(poolNames);
- poolWrapperCombo.select(filterPoolSelectionIndex);
- poolWrapperCombo.addSelectionListener(this);
- if ((uniqueCB!=null) && uniqueCB.getSelection())
- {
- poolVerbiage.setEnabled(false);
- poolComboLabel.setEnabled(false);
- poolWrapperCombo.setEnabled(false);
- }
- }
-
- // initialize inputs
- if (nameValidator != null)
- {
- int maxNameLength = nameValidator.getMaximumNameLength();
- if (maxNameLength >= 0)
- nameText.setTextLimit(maxNameLength);
- }
- if (inputFilterName != null)
- nameText.setText(inputFilterName);
-
- // add keystroke listeners...
- nameText.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (ignoreChanges)
- return;
- userEditedName = true;
- validateNameInput();
- }
- }
- );
-
- setPageComplete();
- contentsCreated = true;
- return composite_prompts;
- }
- /**
- * Return the Control to be given initial focus.
- * Override from parent. Return control to be given initial focus.
- */
- protected Control getInitialFocusControl()
- {
- return nameText;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- if (!contentsCreated)
- return true;
- return (verify() == null);
- }
-
- /**
- * Return true if the page is complete, so to enable Finish.
- * Called by wizard framework.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = (errorMessage == null) && (nameText!=null);
- if (pageComplete)
- pageComplete = (nameText.getText().trim().length() > 0);
- return pageComplete;
- }
-
- /**
- * Inform caller of page-complete status of this page
- */
- public void setPageComplete()
- {
- setPageComplete(isPageComplete());
- }
- /**
- * User has selected something
- */
- public void widgetSelected(SelectionEvent e)
- {
- Object src = e.getSource();
- if (src == poolCombo)
- {
- int selection = poolCombo.getSelectionIndex();
-
- if ((selection >= 0) && (nameValidators!=null)){
- nameValidator = nameValidators[selection];
-
- ISystemFilterPool currentPool = poolsToSelectFrom[selection];
- if (currentPool == parentPool){ // if this is the connection-unique filter pool, set the uniqueCB
- uniqueCB.setSelection(true);
- poolCombo.setEnabled(false);
- }
- }
- }
- else if (src == poolWrapperCombo)
- {
- int selection = poolWrapperCombo.getSelectionIndex();
-
- if ((selection >= 0) && (nameValidators!=null)){
- nameValidator = nameValidators[selection];
-
- ISystemFilterPoolWrapper currentPool = poolWrappers[selection];
- if (currentPool == poolWrapperInformation.getPreSelectWrapper()){ // if this is the connection-unique filter pool, set the uniqueCB
- uniqueCB.setSelection(true);
- poolWrapperCombo.setEnabled(false);
- }
- }
- }
- else if (src == uniqueCB)
- {
- boolean selected = uniqueCB.getSelection();
- if (poolVerbiage != null)
- poolVerbiage.setEnabled(!selected);
- if (poolCombo != null){
- poolCombo.setEnabled(!selected);
-
-
- // if unique to connection then only connection-private filter pool can be used
- // if it's not unique to connection, then the connection-private filter pool should not be selected
- boolean foundPool = false;
- int filterPoolSelectionIndex = 0;
- if (poolsToSelectFrom != null){
-
- int currentIndex = poolCombo.getSelectionIndex();
- ISystemFilterPool currentPool = poolsToSelectFrom[currentIndex];
- if (currentPool != parentPool && !selected){
- // then the current pool is okay
- filterPoolSelectionIndex = currentIndex;
- }
- else {
- for (int idx=0; idx<poolsToSelectFrom.length && !foundPool; idx++){
- ISystemFilterPool pool = poolsToSelectFrom[idx];
-
- boolean isConnectionUnique = pool == parentPool;
-
- if ((isConnectionUnique && selected) || (!isConnectionUnique && !selected)){
- filterPoolSelectionIndex = idx;
- foundPool = true;
- }
- }
- poolCombo.select(filterPoolSelectionIndex);
- }
- }
- else if (poolWrappers != null){
- int currentIndex = poolWrapperCombo.getSelectionIndex();
- ISystemFilterPoolWrapper currentPoolWrapper = poolWrappers[currentIndex];
- if (currentPoolWrapper == poolWrapperInformation.getPreSelectWrapper()){
- // then the current pool is okay
- filterPoolSelectionIndex = currentIndex;
- }
- else {
- for (int idx=0; idx<poolWrappers.length && !foundPool; idx++){
-
- boolean isConnectionUnique = poolWrapperInformation.getPreSelectWrapper() == poolWrappers[idx];
- if ((isConnectionUnique && selected) || (!isConnectionUnique && !selected)){
- filterPoolSelectionIndex = idx;
- foundPool = true;
- }
- }
- poolWrapperCombo.select(filterPoolSelectionIndex);
- }
- }
-
- if (nameValidators != null){
- nameValidator = nameValidators[filterPoolSelectionIndex];
- }
-
- }
- if (poolWrapperCombo != null)
- poolWrapperCombo.setEnabled(!selected);
- if (poolComboLabel != null)
- poolComboLabel.setEnabled(!selected);
- }
- verify();
- setPageComplete();
- }
- /**
- * User has selected something and pressed Enter
- */
- public void widgetDefaultSelected(SelectionEvent e)
- {
- }
- // ---------------------------------
- // VERIFICATION METHODS...
- // ---------------------------------
- /**
- * Verify all contents
- */
- public SystemMessage verify()
- {
- errorMessage = null;
- Control controlInError = null;
-
- if ((errorMessage == null) && (filterPoolSelectionValidator != null))
- {
- errorMessage = filterPoolSelectionValidator.validate(getParentSystemFilterPool());
- if (poolCombo != null)
- controlInError = poolCombo;
- else if (poolWrapperCombo != null)
- controlInError = poolCombo;
- }
- if ((errorMessage == null) && (nameValidator != null))
- {
- errorMessage = nameValidator.validate(nameText.getText().trim());
- controlInError = nameText;
- }
-
- if (errorMessage != null)
- {
- if (controlInError != null)
- controlInError.setFocus();
- setErrorMessage(errorMessage);
- }
- else
- clearErrorMessage();
- return errorMessage;
- }
- /**
- * This hook method is called whenever the text changes in the filter name input field.
- */
- protected SystemMessage validateNameInput()
- {
- errorMessage= null;
- if (nameValidator != null)
- errorMessage = nameValidator.validate(nameText.getText().trim());
- if ((errorMessage == null) && (filterPoolSelectionValidator != null))
- errorMessage = filterPoolSelectionValidator.validate(getParentSystemFilterPool());
- setPageComplete();
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- else
- clearErrorMessage();
- return errorMessage;
- }
-
-
- // ---------------------------------
- // METHODS FOR EXTRACTING USER DATA
- // ---------------------------------
- /**
- * Return name of filter
- * Call this after finish ends successfully.
- */
- public String getFilterName()
- {
- if (nameText != null)
- return nameText.getText().trim();
- else
- return inputFilterName;
- }
- /**
- * Return the filter pool that was explicitly chosen by the user,
- * or implicitly set by the caller.
- */
- public ISystemFilterPool getParentSystemFilterPool()
- {
- ISystemFilterPool pool = null;
- // do we prompt with a list of filter pools? Yes, just return selected...
- if (poolCombo != null)
- {
- int selection = poolCombo.getSelectionIndex();
- if (selection < 0)
- selection = 0;
- pool = poolsToSelectFrom[selection];
- }
- // do we prompt using a wrapper of some kind, such a profile or a command set,
- // from which we deduce the pool? If so, deduce pool from selected wrapper....
- else if (poolWrapperCombo != null)
- {
- int selection = poolWrapperCombo.getSelectionIndex();
- if (selection < 0)
- selection = 0;
- pool = poolWrappers[selection].getSystemFilterPool();
- }
- // else no prompt so we must have been given the explicit filter pool in which
- // to create this filter. Eg, in Show Filter Pools mode and the user selects a
- // filter pool and choose New Filter from it.
- else
- pool = parentPool;
- //System.out.println("Inside getParentSystemFilterPool. returning " + pool.getName());
- return pool;
- }
-
- /**
- * Return the user's decision whether to create this filter uniquely
- * for this connection, or for all applicable connections.
- */
- public boolean getUniqueToThisConnection()
- {
- if (uniqueCB != null)
- return uniqueCB.getSelection();
- else
- return false;
- }
-
- // -------------------------------
- // INTERCEPT OF WIZARDPAGE METHODS
- // -------------------------------
- /**
- * This is called when a page is given focus or loses focus
- */
- public void setVisible(boolean visible)
- {
- super.setVisible(visible);
- if (visible)
- {
- if (!userEditedName && (nameText!=null))
- {
- String defaultName = ((SystemNewFilterWizard)getWizard()).getDefaultFilterName();
- if (defaultName != null)
- {
- ignoreChanges = true;
- nameText.setText(defaultName);
- ignoreChanges = false;
- }
- }
- verify();
- //System.out.println("Wizard size = " + ((SystemNewFilterWizard)getWizard()).getShell().getSize());
- }
- }
-
- // --------------------------------------------------------------
- // ALL THE MRI ON THIS PAGE IS CONFIGURABLE. CALL HERE TO SET IT.
- // --------------------------------------------------------------
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java
deleted file mode 100644
index 67906a929..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLine.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-
-/**
- * A message line interface. It distinguishs between "normal" messages and errors, as does the
- * DialogPage classes in eclipse.
- * <p>
- * For each of those, however, we also support both simple string msgs and more robust SystemMessage
- * messages. A dialog, wizard page or property page class that implements this interface will support
- * these by using getLevelOneText() to get the string for the first level text, and support mouse
- * clicking on the message to display the SystemMessageDialog class to show the 2nd level text.
- * <p>
- * Setting an error message hides a currently displayed message until
- * <code>clearErrorMessage</code> is called.
- */
-public interface ISystemMessageLine {
-
- /**
- * Clears the currently displayed error message and redisplayes
- * the non-error message which was active before the error message was set (if any).
- */
- public void clearErrorMessage();
-
- /**
- * Clears the currently displayed message.
- */
- public void clearMessage();
-
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public String getErrorMessage();
-
- /**
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage();
-
- /**
- * Get the currently displayed message.
- * @return The message. If no message is displayed <code>null<code> is returned.
- */
- public String getMessage();
-
- /**
- * Display the given error message. A currently displayed (non-error) message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message);
-
- /**
- * Display the given error message. A currently displayed (non-error) message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message);
-
- /**
- * Display the given exception as an error message. This is a convenience
- * method... a generic SystemMessage is used for exceptions.
- */
- public void setErrorMessage(Throwable exc);
-
- /**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage.
- */
- public void setMessage(String message);
-
- /**
- * If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message);
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java
deleted file mode 100644
index 5dfa23966..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/ISystemMessageLineTarget.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-/**
- * Implemented by any class that supports being passed an ISystemMessageLine to
- * target messages to. This is useful in re-usable forms so that the parent dialog
- * or wizard can pass in "this" in order to allow the form to issue messages.
- */
-public interface ISystemMessageLineTarget
-{
- /**
- * Set the message line to use for issuing messages
- */
- public void setMessageLine(ISystemMessageLine msgLine);
- /**
- * Get the message line to use for issuing messages
- */
- public ISystemMessageLine getMessageLine();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java
deleted file mode 100644
index 4fadeb73b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/StatusLineManagerAdapter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-
-
-/**
- * This class adapts the eclipse IStatusLineManager to an ISystemMessageLine.
- *
- * @author yantzi
- */
-public class StatusLineManagerAdapter implements ISystemMessageLine {
-
- private IStatusLineManager statusLine;
- private String message, errorMessage;
- private SystemMessage sysErrorMessage;
-
- /**
- * Constructor
- *
- * @param statusLineManager the status line manager to adapt to an ISystemMessageLine
- */
- public StatusLineManagerAdapter(IStatusLineManager statusLineManager)
- {
- this.statusLine = statusLineManager;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#clearErrorMessage()
- */
- public void clearErrorMessage() {
- errorMessage = null;
- sysErrorMessage = null;
- if (statusLine != null)
- statusLine.setErrorMessage(errorMessage);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#clearMessage()
- */
- public void clearMessage() {
- message = null;
- if (statusLine != null)
- statusLine.setMessage(message);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#getErrorMessage()
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#getSystemErrorMessage()
- */
- public SystemMessage getSystemErrorMessage() {
- return sysErrorMessage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#getMessage()
- */
- public String getMessage() {
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
- */
- public void setErrorMessage(String message) {
- this.errorMessage = message;
- if (statusLine != null)
- statusLine.setErrorMessage(message);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.core.ui.messages.SystemMessage)
- */
- public void setErrorMessage(SystemMessage message) {
- sysErrorMessage = message;
- setErrorMessage(message.getLevelOneText());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
- */
- public void setErrorMessage(Throwable exc) {
- setErrorMessage(exc.getMessage());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setMessage(java.lang.String)
- */
- public void setMessage(String message) {
- this.message = message;
- if (statusLine != null)
- statusLine.setMessage(message);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.ui.messages.ISystemMessageLine#setMessage(org.eclipse.rse.core.ui.messages.SystemMessage)
- */
- public void setMessage(SystemMessage message) {
- setMessage(message.getLevelOneText());
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java
deleted file mode 100644
index ccaad9708..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageDialog.java
+++ /dev/null
@@ -1,914 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
- * Martin Oberhuber (Wind River) - [187115] force SystemMessageDialog always into Display thread
- * Martin Oberhuber (Wind River) - [189272] exception when canceling ssh connect
- * David McKnight (IBM) - [216596] determine whether to show yes/no or just okay
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * Martin Oberhuber (Wind River) - Adding Javadoc
- * David McKnight (IBM) - [232670] SystemMessageDialog should not throw IndicatorExceptions
- * David McKnight (IBM) - [238585] SystemMessageDialog's details area is always scrolled to the bottom
- *******************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.internal.ui.GenericMessages;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * A dialog for showing SystemMessages and optionally asking the user for Yes /
- * No / Ok / Cancel type of response.
- *
- * The client may choose to construct and open the dialog itself, or use one of
- * the provided static factory methods, which construct the dialog and
- * synchronously open it without thread switch (must be called on the UI
- * thread):
- * <ul>
- * <li>{@link #openError(Shell, String, String, IStatus)}</li>
- * <li>{@link #openError(Shell, String, String, IStatus, int)}</li>
- * </ul>
- * or one of the convenience static factory methods which also switch to the UI
- * thread automatically to synchronously open the dialog there if needed:
- * <ul>
- * <li>{@link #show(Shell, SystemMessage)}</li>
- * <li>{@link #showExceptionMessage(Shell, String, Exception)}</li>
- * <li>{@link #displayErrorMessage(Shell, String)}</li>
- * <li>{@link #displayErrorMessage(Shell, SystemMessage)}</li>
- * <li>{@link #displayErrorMessage(Shell, SystemMessage, Throwable)}</li>
- * <li>... and many more displayXXX() static methods.</li>
- * </ul>
- *
- * @noextend This class is not intended to be subclassed by clients, because we
- * want a uniform appearance of message dialogs.
- */
-public class SystemMessageDialog extends ErrorDialog implements Listener {
-
- /**
- * Reserve room for this many list items.
- */
- private static final int LIST_ITEM_COUNT = 5;
-
- /**
- * The Details button.
- */
- private Button detailsButton=null;
-
- /**
- * The message to display.
- */
- private SystemMessage message;
-
- /**
- * Exception being reported and logged
- */
- private Throwable exc;
-
-
- /**
- * The SWT list control that displays the error details.
- */
- private Text list;
-
-
- /**
- * Indicates whether the error details viewer is currently created.
- */
- private boolean listCreated = false;
-
-
- /**
- * Filter mask for determining which status items to display.
- */
- private int displayMask = 0xFFFF;
-
-
- /**
- * The main status object.
- */
- private IStatus status;
-
-
- /**
- * List of the main error object's detailed errors
- * (element type: <code>IStatus</code>).
- */
- private java.util.List statusList;
-
- /**
- * the image to use when displaying the message
- */
- // private String imageName;
- private int imageId;
-
- /**
- * show the details panel
- */
- private boolean showDetails=false;
-
- /**
- * buttons for button area
- */
- private String []buttons=null;
-
- /**
- * default button
- */
- private int defaultIndex=0;
-
- /**
- * button id number for the first button in the button bar.<p>
- * The second button, would have an id of buttonId+1 etc.
- */
- public static final int BUTTON_ID=1000;
-
- /**
- * button pressed to dismiss the dialog
- */
- private int buttonIdPressed;
-
- /**
- * whether or not to open the dialog with the yes/no buttons
- */
- private boolean yesNoButtons=false;
-
- /**
- * whether or not to open the dialog with the yes/no/cancel buttons
- */
- private boolean yesNoCancelButtons=false;
-
- protected boolean noShowAgainOption;
- protected Button noShowAgainButton;
-
- // preference stuff for option to not show the dialog again
- protected IPreferenceStore prefStore;
- protected String prefId;
- protected boolean prefValAsSelected;
-
- /**
- * Creates an error dialog.
- * Note that the dialog will have no visual representation (no widgets)
- * until it is told to open.
- * @param parentShell the shell under which to create this dialog
- * @param message the message to display in the dialog
- */
- public SystemMessageDialog(Shell parentShell, SystemMessage message)
- {
- this(parentShell,
- message.getFullMessageID(),
- message.getLevelOneText(),
- (new MultiStatus(SystemBasePlugin.getBaseDefault().getSymbolicName(), IStatus.OK, "", new Exception(""))), //$NON-NLS-1$ //$NON-NLS-2$
- 0xFFFFF);
- ((MultiStatus)this.status).add(new Status(IStatus.INFO, SystemBasePlugin.getBaseDefault().getSymbolicName(), IStatus.OK, message.getLevelTwoText(), new Exception(""))); //$NON-NLS-1$
- statusList = Arrays.asList(status.getChildren());
- this.message=message;
- initImage(message);
- }
-
- private SystemMessageDialog(Shell parentShell, String dialogTitle, String message,
- IStatus status, int displayMask)
- {
- super(parentShell, dialogTitle, message, status, displayMask);
- this.status = status;
- statusList = Arrays.asList(status.getChildren());
- this.displayMask = displayMask;
- setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
- }
-
- private static String getStatusTitle(SystemMessage message) {
- String title = null;
- // setup image
- if (message.getIndicator()==SystemMessage.INFORMATION ||
- message.getIndicator()==SystemMessage.COMPLETION)
- title = GenericMessages.Information;
- else if (message.getIndicator()==SystemMessage.INQUIRY)
- //imageName=DLG_IMG_QUESTION;
- title = GenericMessages.Question;
- else if (message.getIndicator()==SystemMessage.ERROR ||
- message.getIndicator()==SystemMessage.UNEXPECTED)
- title = GenericMessages.Error;
- else if (message.getIndicator()==SystemMessage.WARNING)
- title = GenericMessages.Warning;
- return title;
- }
-
-
- private void initImage(SystemMessage message)
- {
- // setup image
- if (message.getIndicator()==SystemMessage.INFORMATION ||
- message.getIndicator()==SystemMessage.COMPLETION)
- //imageName=DLG_IMG_INFO;
- imageId = SWT.ICON_INFORMATION;
- else if (message.getIndicator()==SystemMessage.INQUIRY)
- //imageName=DLG_IMG_QUESTION;
- imageId = SWT.ICON_QUESTION;
- else if (message.getIndicator()==SystemMessage.ERROR ||
- message.getIndicator()==SystemMessage.UNEXPECTED)
- //imageName=DLG_IMG_ERROR;
- imageId = SWT.ICON_ERROR;
- else if (message.getIndicator()==SystemMessage.WARNING)
- //imageName=DLG_IMG_WARNING;
- imageId = SWT.ICON_WARNING;
- }
-
-
- /* Handles the pressing of the Ok, Details or any button in this dialog.
- * If the Ok button was pressed then close this dialog. If the Details
- * button was pressed then toggle the displaying of the error details area.
- */
- protected void buttonPressed(int id)
- {
- if (id == IDialogConstants.DETAILS_ID) // was the details button pressed?
- toggleDetailsArea();
- else
- {
- super.buttonPressed(id);
- close();
- }
- buttonIdPressed=id;
- }
-
- /*
- * Creates the buttons for the button bar.
- * If the message is an inquiry
- * message or yes/no buttons are explicitly requested then Yes, No, and
- * perhaps Cancel are the preferred buttons.
- * Otherwise, if there are buttons supplied by the client use those.
- * Otherwise if no buttons are supplied, just supply an OK button.
- * A Details button is suppled if the message indicates that it has any
- * significant details. In particular, test to see that the details length is
- * greater than 2. This disqualifies using %2 and getting details for some
- * reason.
- * d58252 - re-ordered tests to make logic easier to read. Set initial focus
- * on the default button since it would normally be on the message which is
- * now read-only text.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- if ( yesNoButtons || yesNoCancelButtons || (message.getIndicator()==SystemMessage.INQUIRY) ) {
- boolean yesDefault=(defaultIndex==0);
- boolean noDefault=(defaultIndex==1);
- boolean cancelDefault=(defaultIndex==2);
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, yesDefault);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, noDefault);
- if (yesNoCancelButtons) {
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, cancelDefault);
- }
- if (yesDefault) {
- getButton(IDialogConstants.YES_ID).setFocus();
- } else if (noDefault) {
- getButton(IDialogConstants.NO_ID).setFocus();
- } else if (cancelDefault) {
- getButton(IDialogConstants.CANCEL_ID).setFocus();
- }
- } else if (buttons!=null) {
- for (int i=0; i<buttons.length; i++) {
- boolean defaultButton=(i==defaultIndex);
- createButton(parent, BUTTON_ID+i, buttons[i], defaultButton);
- if (defaultButton) {
- getButton(BUTTON_ID+i).setFocus();
- }
- }
- } else {
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- getButton(IDialogConstants.OK_ID).setFocus();
- }
- if (status.isMultiStatus() && message != null && message.getLevelTwoText() != null && message.getLevelTwoText().length() > 2) {
- detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false);
- if (showDetails) {
- toggleDetailsArea2(parent);
- }
- }
- }
-
- /*
- * Creates and returns the contents of the upper part
- * of the dialog (above the button bar).
- * d58252 - fixed dialog layout to allow resize of message area for long message,
- * made message area a read-only text for accessibility reasons.
- */
- protected Control createDialogArea(Composite parent) {
- // create composite
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- ((GridLayout)composite.getLayout()).numColumns = 2;
-
- // create image
- Image image = getShell().getDisplay().getSystemImage(imageId);
- if (image != null) {
- Label label = new Label(composite, 0);
- image.setBackground(label.getBackground());
- label.setImage(image);
- label.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER |
- GridData.VERTICAL_ALIGN_BEGINNING));
- }
-
- // create message, this is a read-only text field so it is tab enabled by
- // default for accessibility reasons
- if (message != null) {
- Text messageArea = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
- messageArea.setText(message.getLevelOneText());
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- messageArea.setLayoutData(data);
- }
-
- // if user wants the option to not show the dialog again
- if (noShowAgainOption) {
- Label l = new Label(composite, SWT.NONE);
- l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER, GridData.VERTICAL_ALIGN_CENTER));
- noShowAgainButton = createNoShowAgainButton(composite);
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, true);
- noShowAgainButton.setLayoutData(data);
- }
-
-// composite.pack(true);
- return composite;
- }
- /**
- * Create this dialog's drop-down list component.
- *
- * @param parent the parent composite
- * @return the drop-down list component
- */
- protected Text createDropDownList2(Composite parent)
- {
- // create the list
- list = new Text(parent, SWT.READ_ONLY | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL );
-
- GridData data = new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL |
- GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
- data.heightHint = list.getLineHeight() * LIST_ITEM_COUNT;
- data.widthHint= getDialogArea().getSize().x;
- list.setLayoutData(data);
- listCreated = true;
- // fill the list
- populateList(list);
- list.setTopIndex(0);
-
- return list;
- }
-
- /**
- * When the message involves an exception for which we want to log the stack,
- * set that exception here.
- */
- public void setException(Throwable exc)
- {
- this.exc = exc;
- }
-
- /**
- * logs the message in the appropriate log
- */
- private void logMessage()
- {
- Object[] subList=message.getSubVariables();
- for (int i=0; subList!=null && i<subList.length; i++)
- {
- String msg=message.getFullMessageID()+": SUB#"+new Integer(i).toString()+":"+message.getSubValue(subList[i]); //$NON-NLS-1$ //$NON-NLS-2$
- if (message.getIndicator()==SystemMessage.INFORMATION ||
- message.getIndicator()==SystemMessage.COMPLETION ||
- message.getIndicator()==SystemMessage.INQUIRY)
- {
- SystemBasePlugin.logInfo(msg);
- if (i==subList.length-1 && message.getIndicator()==SystemMessage.INQUIRY)
- SystemBasePlugin.logInfo(message.getFullMessageID()+" :Button ID Pressed:"+buttonIdPressed); //$NON-NLS-1$
- }
- else if (message.getIndicator()==SystemMessage.WARNING)
- SystemBasePlugin.logWarning(msg);
- else if (message.getIndicator()==SystemMessage.ERROR)
- SystemBasePlugin.logError(msg, null);
- else if (message.getIndicator()==SystemMessage.UNEXPECTED)
- {
- if (i==subList.length-1)
- SystemBasePlugin.logError(msg, (exc!=null) ? exc : new Exception());
- else
- SystemBasePlugin.logError(msg, null);
- }
- }
- if (subList==null)
- {
- String msg=message.getFullMessageID();
- if (message.getIndicator()==SystemMessage.INFORMATION ||
- message.getIndicator()==SystemMessage.COMPLETION ||
- message.getIndicator()==SystemMessage.INQUIRY)
- SystemBasePlugin.logInfo(msg);
- else if (message.getIndicator()==SystemMessage.WARNING)
- SystemBasePlugin.logWarning(msg);
- else if (message.getIndicator()==SystemMessage.ERROR)
- SystemBasePlugin.logError(msg, null);
- else if (message.getIndicator()==SystemMessage.UNEXPECTED)
- SystemBasePlugin.logError(msg, (exc!=null) ? exc : new Exception());
- }
- }
-
- /**
- * Opens the message dialog to display the message.
- */
- public int open()
- {
- if (!showDetails)
- logMessage();
- return super.open();
- }
-
- /**
- * Opens the message dialog with the details showing to display the message.
- */
- public int openWithDetails()
- {
- showDetails=true;
- return open();
- }
-
- /**
- * Opens the message dialog with the details showing to display an exception, if that is
- * the root cause of the message.
- * <p>
- * Also logs the first level text plus exception.
- */
- public int openWithDetails(Exception exc)
- {
- showDetails=true;
- SystemBasePlugin.logError(message.getLevelOneText(), exc);
- return open();
- }
-
- /**
- * Open the dialog with Yes, No, Details button for an Inquiry/Question
- * message.
- *
- * @return <code>true</code> if Yes was pressed, <code>false</code> if
- * No was pressed.
- */
- public boolean openQuestion()
- {
- yesNoButtons=true;
- open();
- return (buttonIdPressed==IDialogConstants.YES_ID);
- }
-
- /**
- * Open the dialog with Yes/No, Details button for an Inquiry/Question
- * message.
- *
- * @return <code>true</code> if Yes was pressed, <code>false</code> if
- * No was pressed.
- */
- public boolean openQuestionNoException()
- {
- return openQuestionNoException(true);
- }
-
- /**
- * opens the dialog with an optional Yes/No or OK, Details button for an
- * Inquiry/Question message.
- *
- * Before RSE 3.0, this method had no arguments. Since RSE 3.0, it is taking
- * a boolean argument.
- *
- * @since org.eclipse.rse.ui 3.0
- */
- public boolean openQuestionNoException(boolean showYesNo)
- {
- yesNoButtons=showYesNo;
- open();
- return (buttonIdPressed==IDialogConstants.YES_ID);
- }
-
- /**
- * opens the dialog with Yes, No, Cancel Details for an Inquiry/Question message
- * @return IDialogConstants.YES_ID or NO_ID
- */
- public int openYesNoCancel()
- {
- yesNoCancelButtons=true;
- return open();
- }
-
- /**
- * returns the id of the button pressed
- */
- public int getButtonPressedId()
- {
- return buttonIdPressed;
- }
-
- /**
- * overrides the default button selection.
- * @param buttonList an array of buttons for the button bar
- */
- public void setButtons(String [] buttonList)
- {
- buttons=buttonList;
- }
- /**
- * sets the default button for the message.
- * Use this method if you wan to override the default button (the first one)
- * @param buttonIndex the 0-based index of the button
- */
- public void setButtonIndex(int buttonIndex)
- {
- defaultIndex=buttonIndex;
- }
-
-
-
-
- /**
- * Populates the list using this error dialog's status object.
- * This walks the child stati of the status object and
- * displays them in a list. The format for each entry is
- * status_path : status_message
- * If the status's path was null then it (and the colon)
- * are omitted.
- */
- private void populateList(Text list)
- {
- Iterator z = statusList.iterator();
- while (z.hasNext())
- {
- IStatus childStatus = (IStatus) z.next();
- populateList(list, childStatus, 0);
- }
- }
-
-
-
- private void populateList(Text list, IStatus status, int nesting)
- {
- if (!status.matches(displayMask))
- {
- return;
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < nesting; i++)
- {
- sb.append(" "); //$NON-NLS-1$
- }
- sb.append(status.getMessage());
- list.append(sb.toString());
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- list.append("\n"); //$NON-NLS-1$
- populateList(list, children[i], nesting + 1);
- }
- }
-
- /**
- * Toggles the unfolding of the details area. This is triggered by
- * the user pressing the details button.
- */
- private void toggleDetailsArea()
- {
- Point windowSize = getShell().getSize();
- getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (listCreated)
- {
- list.dispose();
- listCreated = false;
- detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
- }
- else
- {
- list = createDropDownList2((Composite)getContents());
- detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
- }
- Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- // yantzi:5.1.2 this leaves a gap at the bottom of the dialog when opened with details,
- // why not just set it to the newSize.y?
- //getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
- getShell().setSize(new Point(windowSize.x, newSize.y));
- }
-
- /**
- * Toggles the unfolding of the details area. This is triggered by
- * open using openWithDetails.
- */
- private void toggleDetailsArea2(Composite composite)
- {
- Point windowSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- getDialogArea().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- list = createDropDownList2(composite.getParent());
- detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
- Point newSize = composite.getParent().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- // yantzi:5.1.2 this leaves a gap at the bottom of the dialog when opened with details,
- // why not just set it to the newSize.y?
- //getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y-buttonSize.y)));
- getShell().setSize(new Point(windowSize.x, newSize.y));
- }
-
- /**
- * Keeping for posterity. Phil.
- */
- public static Shell getDefaultShell()
- {
- return SystemBasePlugin.getActiveWorkbenchShell();
- }
-
- private static void runInUIThread(final Runnable r) {
- Display d = Display.getCurrent();
- if (d!=null) {
- r.run();
- }
- else {
- d = Display.getDefault();
- d.syncExec(r);
- }
- }
-
- private static int openInUIThread(final Window dlg) {
- Display d = Display.getCurrent();
- if (d!=null) {
- return dlg.open();
- }
- else {
- d = Display.getDefault();
- final int[] rv = new int[1];
- d.syncExec(new Runnable() {
- public void run() {
- rv[0] = dlg.open();
- }
- });
- return rv[0];
- }
- }
-
- /**
- * For ease of use for simple messages with no response from user.
- */
- public static void displayErrorMessage(Shell shell, SystemMessage msg)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
- openInUIThread(msgDlg);
- }
-
- /**
- * For ease of use for simple messages which are the result of an exception
- */
- public static void displayErrorMessage(Shell shell, SystemMessage msg, Throwable exc)
- {
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
- msgDlg.setException(exc);
- openInUIThread(msgDlg);
- }
-
- /**
- * For ease of use for simple error message text with no response from user.
- */
- public static void displayErrorMessage(Shell shell, String msgText)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_E);
- msg.makeSubstitution(msgText);
- displayErrorMessage(shell,msg);
- }
-
- /**
- * For ease of use for simple message text with no response from user.
- */
- public static void displayMessage(Shell shell, String msgText)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_I);
- msg.makeSubstitution(msgText);
- displayErrorMessage(shell,msg);
- }
-
- /**
- * Display this wrapped system message to the user
- */
- public static void displayMessage(Shell shell, SystemMessageException msgEx)
- {
- if (msgEx != null)
- SystemMessageDialog.displayErrorMessage(shell, msgEx.getSystemMessage());
- }
-
- /**
- * Display this wrapped system message to the user
- */
- public static void displayMessage(SystemMessageException msgEx)
- {
- if (msgEx != null)
- SystemMessageDialog.displayErrorMessage(getDefaultShell(), msgEx.getSystemMessage());
- }
-
- /**
- * For ease of use for simple host error messages that are xlated already.
- */
- public static void displayHostErrorMessage(Shell shell, String hostMsg)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_E);
- msg.makeSubstitution(hostMsg);
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
- openInUIThread(msgDlg);
- }
-
- /**
- * For ease of use for simple host error messages that are xlated already,
- * and which have 2nd level text.
- */
- public static void displayHostErrorMessage(Shell shell, String hostMsg, String levelTwo)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_E_HELP);
- msg.makeSubstitution(hostMsg,levelTwo);
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
- openInUIThread(msgDlg);
- }
-
- /**
- * For ease of use for simple host warning messages that are xlated already.
- */
- public static void displayHostWarningMessage(Shell shell, String hostMsg)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_W);
- msg.makeSubstitution(hostMsg);
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
- openInUIThread(msgDlg);
- }
-
- /**
- * For ease of use for simple host warning messages that are xlated already,
- * and which have 2nd level text.
- */
- public static void displayHostWarningMessage(Shell shell, String hostMsg, String levelTwo)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_GENERIC_W_HELP);
- msg.makeSubstitution(hostMsg,levelTwo);
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
- openInUIThread(msgDlg);
- }
-
- /**
- * For displaying a generic error message when an unexpected exception happens.
- */
- public static void displayExceptionMessage(Shell shell, Throwable exc)
- {
- SystemMessage msg = getExceptionMessage(shell, exc);
- if ((shell == null) && (Display.getCurrent()!=null))
- shell = Display.getCurrent().getActiveShell();
- SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
- msgDlg.setException(exc);
- openInUIThread(msgDlg);
- }
-
-
- /**
- * When an exception occurs and you want to turn it into a SystemMessage,
- * call this...
- */
- public static SystemMessage getExceptionMessage(Shell shell, Throwable exc)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_OCCURRED);
- msg.makeSubstitution(exc);
- return msg;
- }
-
- /**
- * Put up an error message when the error message framework itself doesn't
- * work, and also log the error.
- */
- public static void showExceptionMessage(Shell shell, String msg, Exception exc)
- {
- final MessageBox mb = new MessageBox(null);
- //mb.setTitle("Remote Systems Programming Error");
- mb.setMessage(msg);
- runInUIThread(new Runnable() {
- public void run() {
- mb.open();
- }
- });
- SystemBasePlugin.logError(msg,exc);
- }
-
- /**
- * Show this message in the message dialog. We polymorphically show the right message dialog,
- * by querying the message type.
- * @return true if this is a question message, and user presses Yes.
- */
- public static boolean show(Shell shell, SystemMessage msg)
- {
- boolean yes = false;
- final SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);
-
- if (msg.getIndicator() != SystemMessage.INQUIRY)
- openInUIThread(msgDlg);
- else {
- final boolean[] rv = new boolean[1];
- runInUIThread(new Runnable() {
- public void run() {
- rv[0] = msgDlg.openQuestionNoException();
- }
- });
- yes = rv[0];
- }
- return yes;
- }
-
- /**
- * Set option to not show this dialog again and specify the preference that should be set
- * according to whether the user selects to show the dialog again or no. The caller can
- * query this preference to find out what the user selection is.
- * @param noShowAgainOption <code>true</code> to show the option in the dialog, <code>false</code> to not show it.
- * @param prefStore the preference store.
- * @param prefId the preference id for which a boolean value will be stored according to the user's selection.
- * @param prefValAsSelected whether to mirror the user selection in the preference. If this is set to
- * <code>true</code>, then the value stored in the preference is <code>true</code> if the user selects the option,
- * and <code>false</code> if the user does not select the option. If this is set to <code>false</code>, then the
- * value stored in the preference will be <code>false</code> if the user selects the option, and <code>true</code>
- * if the user does not select the option
- */
- public void setNoShowAgainOption(boolean noShowAgainOption, IPreferenceStore prefStore, String prefId, boolean prefValAsSelected) {
- this.noShowAgainOption = noShowAgainOption;
- this.prefStore = prefStore;
- this.prefId = prefId;
- this.prefValAsSelected = prefValAsSelected;
- }
-
- /**
- * Creates a button to allow option to not show this dialog again.
- * @return the button that allows option to not show this dialog again.
- */
- protected Button createNoShowAgainButton(Composite c) {
- Button b = new Button(c, SWT.CHECK);
- b.setText(SystemResources.RESID_DO_NOT_SHOW_MESSAGE_AGAIN_LABEL);
- b.setToolTipText(SystemResources.RESID_DO_NOT_SHOW_MESSAGE_AGAIN_TOOLTIP);
- b.addListener(SWT.Selection, this);
- return b;
- }
-
- /**
- * Handles events generated by controls on this page.
- * Should be overridden by child.
- * Only public because of interface requirement!
- */
- public void handleEvent(Event e)
- {
- if (e.type == SWT.Selection) {
-
- if (e.widget == noShowAgainButton) {
- boolean isNoShowSelected = noShowAgainButton.getSelection();
-
- if ((prefStore != null) && (prefId != null)) {
-
- if (prefValAsSelected) {
- prefStore.setValue(prefId, isNoShowSelected);
- }
- else {
- prefStore.setValue(prefId, !isNoShowSelected);
- }
- }
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java
deleted file mode 100644
index c8f2ddc7b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageLine.java
+++ /dev/null
@@ -1,642 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-
-import org.eclipse.jface.resource.ColorRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemThemeConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-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.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A message line. It distinguishs between "normal" messages and errors.
- * Setting an error message hides a currently displayed message until
- * <code>clearErrorMessage</code> is called.
- */
-public class SystemMessageLine extends Composite implements ISystemMessageLine {
-
- private Button moreButton;
- private Label image;
- private Text widget;
- private MyMessage infoMessage = null;
- private MyMessage errorMessage = null;
- private static final int ERROR = 3;
- private static final int WARNING = 2;
- private static final int INFO = 1;
- private static final int NONE = 0;
-
- private abstract class MyMessage {
- /**
- * @return The Image of the message based on its type.
- */
- Image getImage() {
- int type = getType();
- switch (type) {
- case ERROR:
- return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_ERROR);
- case WARNING:
- return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_WARNING);
- case INFO:
- return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
- default:
- return JFaceResources.getImage(org.eclipse.jface.dialogs.Dialog.DLG_IMG_MESSAGE_INFO);
- }
- }
-
- Color getColor() {
- int type = getType();
- switch (type) {
- case ERROR:
- return getColor(ISystemThemeConstants.MESSAGE_ERROR_COLOR);
- case WARNING:
- return getColor(ISystemThemeConstants.MESSAGE_WARNING_COLOR);
- case INFO:
- return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
- default:
- return getColor(ISystemThemeConstants.MESSAGE_INFORMATION_COLOR);
- }
- }
-
- /**
- * @param symbolicName the name of the color in the current theme's color registry.
- * @return an SWT Color or null.
- */
- private Color getColor(String symbolicName) {
- ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
- Color result = registry.get(symbolicName);
- return result;
- }
-
- boolean isError() {
- return getType() == ERROR;
- }
-
- /**
- * @return The id of the message or null if there is none.
- */
- abstract String getID();
-
- /**
- * @return The full text of the message to be shown in the message line.
- */
- abstract String getText();
-
- /**
- * @return The tooltip for the message, to be shown when hovering over the message line.
- */
- abstract String getTooltip();
-
- /**
- * @return true if there is more text that can be shown in a message details pane.
- */
- abstract boolean hasMore();
-
- /**
- * @return The SystemMessage version of the message.
- */
- abstract SystemMessage toSystemMessage();
-
- /**
- * @return The type of the message. One of NONE, INFO, WARNING, or ERROR.
- */
- abstract int getType();
-
- /**
- * @return The data values associated with this message.
- */
- abstract Object[] getData();
-
- /**
- * @return true if the message resulted form a strange occurence.
- */
- abstract boolean isStrange();
- }
-
- private class MySystemMessage extends MyMessage {
-
- private SystemMessage message = null;
-
- /**
- * @param message
- */
- MySystemMessage(SystemMessage message) {
- this.message = message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#toSystemMessage()
- */
- SystemMessage toSystemMessage() {
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
- */
- String getID() {
- return message.getFullMessageID();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getText()
- */
- String getText() {
- return message.getLevelOneText();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getTooltip()
- */
- String getTooltip() {
- return message.getFullMessageID() + ": " + getText(); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
- */
- boolean hasMore() {
- String text2 = message.getLevelTwoText();
- return (text2 != null) && (text2.length() > 0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
- */
- boolean isStrange() {
- return message.getIndicator() == SystemMessage.UNEXPECTED;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
- */
- Object[] getData() {
- Object[] result = message.getSubVariables();
- if (result == null) result = new Object[0];
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getType()
- */
- int getType() {
- int result = NONE;
- if (message != null) {
- switch (message.getIndicator()) {
- case SystemMessage.COMPLETION:
- case SystemMessage.INFORMATION:
- case SystemMessage.INQUIRY:
- result = INFO;
- break;
- case SystemMessage.ERROR:
- case SystemMessage.UNEXPECTED:
- result = ERROR;
- break;
- case SystemMessage.WARNING:
- result = WARNING;
- break;
- default:
- result = NONE;
- }
- }
- return result;
- }
- }
-
- private class MyImpromptuMessage extends MyMessage {
-
- private int type = NONE;
- private String text1 = ""; //$NON-NLS-1$
- private String text2 = null;
-
- /**
- * @param type The type of the message.
- * @param text1 The first-level text of the message.
- */
- MyImpromptuMessage(int type, String text1) {
- this.type = type;
- this.text1 = text1;
- }
-
- /**
- * @param type The type of the message.
- * @param text1 The first-level text of the message.
- * @param text2 the second-level text of the message.
- */
- MyImpromptuMessage(int type, String text1, String text2) {
- this.type = type;
- this.text1 = text1;
- this.text2 = text2;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#toSystemMessage()
- */
- public SystemMessage toSystemMessage() {
- String id = null;
- Object[] data = null;
- if (text2 == null) {
- id = isError() ? ISystemMessages.MSG_GENERIC_E : ISystemMessages.MSG_GENERIC_I;
- data = new Object[] { text1 };
- } else {
- id = isError() ? ISystemMessages.MSG_GENERIC_E_HELP : ISystemMessages.MSG_GENERIC_I_HELP;
- data = new Object[] { text1, text2 };
- }
- SystemMessage result = RSEUIPlugin.getPluginMessage(id, data);
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getID()
- */
- String getID() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getText()
- */
- String getText() {
- return text1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getTooltip()
- */
- String getTooltip() {
- return text1;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#hasMore()
- */
- boolean hasMore() {
- return text2 != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#wasStrange()
- */
- boolean isStrange() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getData()
- */
- Object[] getData() {
- return new Object[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.SystemMessageLine.MyMessage#getType()
- */
- int getType() {
- return type;
- }
- }
-
- /**
- * Creates a new message line as a child of the given parent. If the parent
- * uses a grid layout then the layout data is set. If not then the layout data
- * must be set by the creator to match the layout of the parent composite.
- */
- public SystemMessageLine(Composite parent) {
- super(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 5;
- layout.marginHeight = 2;
- layout.marginWidth = 3;
- setLayout(layout);
-
- image = new Label(this, SWT.NONE);
- image.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
-
- // this is a read-only text field so it is tab enabled and readable by a screen reader.
- widget = new Text(this, SWT.READ_ONLY | SWT.SINGLE);
- widget.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
- widget.setBackground(parent.getBackground());
-
- moreButton = new Button(this, SWT.NONE);
- moreButton.setImage(RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_HELP_ID));
- moreButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
- moreButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (e.getSource().equals(moreButton)) {
- MyMessage message = getCurrentMessage();
- if (message != null) {
- SystemMessage m = message.toSystemMessage();
- Shell shell = getShell();
- SystemMessageDialog dialog = new SystemMessageDialog(shell, m);
- dialog.openWithDetails();
- }
- }
- }
- });
- // add accessibility information to the "more" button
- moreButton.setToolTipText(SystemResources.RESID_MSGLINE_TIP);
- moreButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- getHelp(e);
- }
-
- public void getHelp(AccessibleEvent e) {
- e.result = moreButton.getToolTipText();
- }
- });
-
- addControlListener(new ControlListener() {
- public void controlMoved(ControlEvent e) {
- }
-
- public void controlResized(ControlEvent e) {
- adjustText();
- layout();
- }
- });
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- widget.dispose();
- moreButton.dispose();
- image.dispose();
- }
- });
- showCurrentMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage()
- */
- public void clearMessage() {
- infoMessage = null;
- showCurrentMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearErrorMessage()
- */
- public void clearErrorMessage() {
- errorMessage = null;
- showCurrentMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
- */
- public void setMessage(SystemMessage message) {
- infoMessage = new MySystemMessage(message);
- if (infoMessage.isError()) {
- infoMessage = new MyImpromptuMessage(NONE, message.getLevelOneText(), message.getLevelTwoText());
- }
- showCurrentMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setMessage(java.lang.String)
- */
- public void setMessage(String message) {
- if (message != null)
- {
- infoMessage = new MyImpromptuMessage(INFO, message);
- }
- else
- {
- infoMessage = null;
- }
- showCurrentMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
- */
- public void setErrorMessage(String message) {
- if (message != null)
- {
- errorMessage = new MyImpromptuMessage(ERROR, message);
- }
- else
- {
- errorMessage = null;
- }
-
- showCurrentMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
- */
- public void setErrorMessage(SystemMessage message) {
- logMessage(message);
- errorMessage = new MySystemMessage(message);
- showCurrentMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
- */
- public void setErrorMessage(Throwable throwable) {
- SystemMessage message = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
- message.makeSubstitution(throwable);
- setErrorMessage(message);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getMessage()
- */
- public String getMessage() {
- String result = infoMessage != null ? infoMessage.getText() : null;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getErrorMessage()
- */
- public String getErrorMessage() {
- String result = errorMessage != null ? errorMessage.getText() : null;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getSystemErrorMessage()
- */
- public SystemMessage getSystemErrorMessage() {
- SystemMessage result = errorMessage != null ? errorMessage.toSystemMessage() : null;
- return result;
- }
-
- private MyMessage getCurrentMessage() {
- return errorMessage != null ? errorMessage : infoMessage;
- }
-
- /**
- * Shows the top message on the stack. If the stack is empty it will "show" nothing.
- */
- private void showCurrentMessage() {
- MyMessage message = getCurrentMessage();
- setIcon(message);
- setText(message);
- setMoreButton(message);
- layout();
- }
-
- /**
- * Sets the icon field of the widget to the appropriate symbol depending on the
- * type of message.
- * @param message the message used to determine the icon type.
- */
- private void setIcon(MyMessage message) {
- Image t = (message == null) ? null : message.getImage();
- image.setImage(t);
- }
-
- /**
- * Write the text from a MyMessage to the widget.
- * @param message the message from which to get the text.
- */
- private void setText(MyMessage message) {
- String text = ""; //$NON-NLS-1$
- String toolTip = null;
- Color color = null;
- if (message != null) {
- text = message.getText() != null ? message.getText() : "";
- toolTip = message.getTooltip() != null ? message.getTooltip() : "";
- color = message.getColor();
- }
-
-
- widget.setToolTipText(toolTip);
- widget.setForeground(color);
- widget.setText(text);
- widget.setData(text);
- widget.setVisible(text.length() > 0);
- adjustText();
-
- }
-
- /**
- * Hide or show the "more" button. If the message has second level text then
- * the more button is shown.
- */
- private void setMoreButton(MyMessage message) {
- boolean visible = message != null && message.hasMore();
- moreButton.setVisible(visible);
- }
-
- /**
- * Adjusts the text in the widget. The full text is stored in the data field of the
- * Text widget. The partial text is shown if the width of the containing control
- * is too small to hold it.
- */
- private void adjustText() {
- GC gc = new GC(widget);
- int maxWidth = getSize().x;
- maxWidth -= moreButton.getSize().x;
- maxWidth -= image.getSize().x;
- maxWidth -= 17; // a guess at the padding between controls
- maxWidth = (maxWidth >= 0) ? maxWidth : 0;
- String text = (String) widget.getData();
- if (text != null) {
- if (gc.stringExtent(text).x > maxWidth) {
- StringBuffer head = new StringBuffer(text);
- int n = head.length();
- head.append("..."); //$NON-NLS-1$
- while (n > 0) {
- text = head.toString();
- if (gc.stringExtent(text).x <= maxWidth) break;
- head.deleteCharAt(--n);
- }
- if (n == 0) text = ""; //$NON-NLS-1$
- }
- widget.setText(text);
- }
- gc.dispose();
- }
-
- /**
- * Logs a message in the appropriate log according to the current preferences.
- * @param message The SystemMessage to be logged.
- */
- private void logMessage(SystemMessage message) {
- MyMessage m = new MySystemMessage(message);
- Object[] data = m.getData();
- for (int i = 0; i < data.length; i++) {
- Object object = data[i];
- StringBuffer buffer = new StringBuffer(200);
- buffer.append(m.getID());
- buffer.append(": SUB#"); //$NON-NLS-1$
- buffer.append(Integer.toString(i));
- buffer.append(":"); //$NON-NLS-1$
- buffer.append(object.toString());
- logMessage(m.getType(), buffer.toString(), false);
- }
- logMessage(m.getType(), m.getID(), m.isStrange());
- }
-
- /**
- * Sends a text message to the log. Will log messages only if the RSEUIPlugin has been
- * set to log these.
- * @param type The type of the message - NONE, INFO, WARNING or ERROR.
- * @param text The text to log.
- * @param stackTrace If true then generate a stack trace in the log. Ignored if the
- * type is not ERROR.
- */
- private void logMessage(int type, String text, boolean stackTrace) {
- boolean logging = RSEUIPlugin.getDefault().getLoggingSystemMessageLine();
- if (logging) {
- switch (type) {
- case ERROR:
- Exception e = stackTrace ? new Exception("Stack Trace") : null; //$NON-NLS-1$
- SystemBasePlugin.logError(text, e);
- break;
- case WARNING:
- SystemBasePlugin.logWarning(text);
- break;
- default:
- SystemBasePlugin.logInfo(text);
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java
deleted file mode 100644
index 726c38a8b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemMessageStatus.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-
-/**
- * A SystemMessageStatus object encapsulates a SystemMessage or a
- * SystemMessageException as a Status object. Could be used when creating a
- * CoreException from a SystemMessageException.
- */
-public class SystemMessageStatus implements IStatus {
- private SystemMessage message;
- private SystemMessageException exception;
- public SystemMessageStatus(SystemMessage message) {
- this.message = message;
- }
-
- public SystemMessageStatus(SystemMessageException exception) {
- this.message = exception.getSystemMessage();
- this.exception = exception;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IStatus#isOK()
- */
- public boolean isOK() {
- int severity = getSeverity();
- return severity <= IStatus.OK;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IStatus#getPlugin()
- */
- public String getPlugin() {
- String id = SystemBasePlugin.getBaseDefault().getBundle().getSymbolicName();
- return id;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IStatus#getChildren()
- */
- public IStatus[] getChildren() {
- return new IStatus[0];
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IStatus#getCode()
- */
- public int getCode() {
- String codeString = message.getMessageNumber();
- int code = 0;
- try {
- code = Integer.parseInt(codeString);
- } catch (NumberFormatException e) {
- }
- return code;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IStatus#getException()
- */
- public Throwable getException() {
- return exception;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IStatus#getMessage()
- */
- public String getMessage() {
- return message.getLevelOneText();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IStatus#getSeverity()
- */
- public int getSeverity() {
- char ind = message.getIndicator();
- switch (ind) {
- case SystemMessage.COMPLETION:
- return IStatus.OK;
- case SystemMessage.INFORMATION:
- return IStatus.INFO;
- case SystemMessage.INQUIRY:
- return IStatus.INFO;
- case SystemMessage.WARNING:
- return IStatus.WARNING;
- case SystemMessage.UNEXPECTED:
- return IStatus.WARNING;
- case SystemMessage.ERROR:
- return IStatus.ERROR;
- default:
- return IStatus.OK;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IStatus#isMultiStatus()
- */
- public boolean isMultiStatus() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IStatus#matches(int)
- */
- public boolean matches(int severityMask) {
- int severity = getSeverity();
- int matching = severity & severityMask;
- return matching > 0;
- }
-
- /**
- * @return the SystemMessage encapsulated by this status.
- */
- public SystemMessage getSystemMessage() {
- return message;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java
deleted file mode 100644
index a5b3b3d7b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessage.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [219975] Fix SystemMessage#clone()
- ********************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.rse.services.clientserver.messages.IndicatorException;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-
-
-
-public class SystemUIMessage extends SystemMessage
-{
- protected static final int displayMask = IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR; // for IStatus substitution variables
-
- public SystemUIMessage(String comp, String sub, String number, char ind, String l1, String l2) throws IndicatorException
- {
- super(comp,sub,number,ind,l1,l2);
- }
-
- /**
- * used to determine the string value of the object
- * it calls toString for all object types except for Exceptions
- * where the stack is also rendered
- * @param sub the substitution object
- * @return the string value for the object
- */
- public String getSubValue(Object sub)
- {
- if (sub == null)
- return ""; //$NON-NLS-1$
-
- if (sub instanceof IStatus)
- {
- return populateList("", (IStatus)sub); //$NON-NLS-1$
- }
- else
- {
- return super.getSubValue(sub);
- }
- }
-
-/**
- * Populates the list using this error dialog's status object.
- * This walks the child stati of the status object and
- * displays them in a list. The format for each entry is
- * status_path : status_message
- * If the status's path was null then it (and the colon)
- * are omitted.
- */
- private static String populateList(String list, IStatus status) {
- java.util.List statusList = Arrays.asList(status.getChildren());
- Iterator enumer = statusList.iterator();
- while (enumer.hasNext()) {
- IStatus childStatus = (IStatus) enumer.next();
- list = populateList(list, childStatus, 0);
- }
- return list;
- }
- private static String populateList(String list, IStatus status, int nesting) {
- if (!status.matches(displayMask)) {
- return list;
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < nesting; i++) {
- sb.append(NESTING_INDENT);
- }
- sb.append(status.getMessage());
- //list.add(sb.toString());
- list = list + sb.toString() + "\n"; //$NON-NLS-1$
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- list = populateList(list, children[i], nesting + 1);
- }
- return list;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java
deleted file mode 100644
index 2b448f0e0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/messages/SystemUIMessageFile.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.messages;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.eclipse.rse.services.clientserver.messages.IndicatorException;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageFile;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-/**
- * A SystemUIMessageFile extends SystemMessageFile and makes it more compatible
- * with Eclipse
- */
-public class SystemUIMessageFile extends SystemMessageFile {
-
- /**
- * Factory method for constructing a SystemUIMessageFile. If an error occurs when
- * reading the message file DTD then that is logged.
- * @param messageFileName The "registered" name of the message file. Used to determine
- * if the message file has been loaded.
- * @param messageFileStream The stream containing the message file. It is the
- * caller's responsibility to close this stream.
- * @return The message file that was constructed.
- */
- public static SystemUIMessageFile getMessageFile(String messageFileName,
- InputStream messageFileStream) {
- SystemUIMessageFile result = null;
- URL dtdURL = RSEUIPlugin.getDefault().getMessageFileDTD();
- if (dtdURL != null) {
- try {
- InputStream dtdStream = dtdURL.openStream();
- result = new SystemUIMessageFile(messageFileName,
- messageFileStream, dtdStream);
- dtdStream.close();
- } catch (IOException e) {
- SystemBasePlugin.logError("Could not open message file DTD.", e); //$NON-NLS-1$
- }
- } else {
- SystemBasePlugin.logError("Could not find mesage file DTD."); //$NON-NLS-1$
- }
- return result;
- }
-
- private SystemUIMessageFile(String messageFileName,
- InputStream messageFileStream, InputStream dtdStream) {
- super(messageFileName, messageFileStream, dtdStream);
- }
-
- /**
- * Override this to provide different extended SystemMessage implementation
- *
- * @param componentAbbr
- * @param subComponentAbbr
- * @param msgNumber
- * @param msgIndicator
- * @param msgL1
- * @param msgL2
- * @return The SystemMessage for the given message information
- * @throws IndicatorException
- */
- protected SystemMessage loadSystemMessage(String componentAbbr,
- String subComponentAbbr, String msgNumber, char msgIndicator,
- String msgL1, String msgL2) throws IndicatorException {
- return new SystemUIMessage(componentAbbr, subComponentAbbr, msgNumber,
- msgIndicator, msgL1, msgL2);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java
deleted file mode 100644
index 5071debd1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPage.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.open;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-
-/**
- * Defines a page inside the quick open dialog.
- * Clients can contribute their own quick open page to the
- * dialog by implementing this interface, typically as a subclass
- * of <code>DialogPage</code>.
- * <p>
- * The quick open dialog calls the <code>performAction</code> method when the Ok
- * button is pressed.
- * <p>
- *
- * @see org.eclipse.jface.dialogs.IDialogPage
- * @see org.eclipse.jface.dialogs.DialogPage
- */
-public interface ISystemQuickOpenPage extends IDialogPage {
-
- /**
- * Performs the action for this page.
- * The quick open dialog calls this method when the Ok button is pressed.
- * @return <code>true</code> if the dialog can be closed after execution.
- */
- public boolean performAction();
-
- /**
- * Sets the container of this page.
- * The quick open dialog calls this method to initialize this page.
- * Implementations may store the reference to the container.
- * @param container the container for this page.
- */
- public void setContainer(ISystemQuickOpenPageContainer container);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java
deleted file mode 100644
index fb0fb2d1d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/ISystemQuickOpenPageContainer.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.open;
-
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.viewers.ISelection;
-
-public interface ISystemQuickOpenPageContainer {
-
- /**
- * Returns the selection with which this container was opened.
- *
- * @return the selection passed to this container when it was opened
- */
- public ISelection getSelection();
-
- /**
- * Returns the context for the search operation.
- * This context allows progress to be shown inside the search dialog.
- *
- * @return the <code>IRunnableContext</code> for the search operation
- */
- public IRunnableContext getRunnableContext();
-
- /**
- * Sets the enable state of the perform action button
- * of this container.
- *
- * @param state <code>true</code> to enable the button which performs the action
- */
- public void setPerformActionEnabled(boolean state);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java
deleted file mode 100644
index ac032443b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemOpenQuickOpenDialogAction.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.open;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-
-public class SystemOpenQuickOpenDialogAction extends Action implements IWorkbenchWindowActionDelegate {
-
- private IWorkbenchWindow window;
- private String pageId;
-
- /**
- * Constructor for the action.
- * @param text the text.
- * @param tooltip the tooltip.
- * @param image the image.
- * @param parent the parent shell.
- */
- public SystemOpenQuickOpenDialogAction(String text, String tooltip, ImageDescriptor image) {
- super(text, image);
- setToolTipText(tooltip);
- }
-
- /**
- * Constructor for the action.
- * @param text the text.
- * @param tooltip the tooltip.
- * @param parent the parent shell.
- */
- public SystemOpenQuickOpenDialogAction(String text, String tooltip) {
- this(text, tooltip, null);
- }
-
- /**
- * @param window the workbench window
- */
- public SystemOpenQuickOpenDialogAction(IWorkbenchWindow window, String pageId) {
- this((String)null, (String)null);
- this.window = window;
- this.pageId = pageId;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- run();
- }
-
- /**
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
-
- // if there is no active page, then beep
- if (getWindow().getActivePage() == null) {
- SystemBasePlugin.getActiveWorkbenchWindow().getShell().getDisplay().beep();
- return;
- }
-
- SystemQuickOpenDialog dialog = new SystemQuickOpenDialog(getWindow().getShell(), getSelection(), pageId);
- dialog.open();
- }
-
- /**
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- /**
- * Gets the current selection.
- * @return the current selection.
- */
- private ISelection getSelection() {
- return getWindow().getSelectionService().getSelection();
- }
-
- /**
- * Gets the window. If the current window is <code>null</code>, the current window is set to the active
- * workbench window, and then returned.
- * @return the current workench window, or the active workbench window if the current window is <code>null</code>.
- */
- private IWorkbenchWindow getWindow() {
-
- if (window == null) {
- window = SystemBasePlugin.getActiveWorkbenchWindow();
- }
-
- return window;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java
deleted file mode 100644
index 6aa5194fb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenDialog.java
+++ /dev/null
@@ -1,802 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [216252] canceled --> cancelled in comments
- *******************************************************************************/
-
-package org.eclipse.rse.ui.open;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ControlEnableState;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.wizard.ProgressMonitorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-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.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-
-public class SystemQuickOpenDialog extends Dialog implements ISystemQuickOpenPageContainer, IRunnableContext {
-
- // the tab folder layout
- private class TabFolderLayout extends Layout {
-
- /**
- * @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) {
-
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) {
- return new Point(wHint, hHint);
- }
-
- int x = 0;
- int y = 0;
-
- Control[] children = composite.getChildren();
-
- for (int i= 0; i < children.length; i++) {
- Point size = children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- x = Math.max(x, size.x);
- y = Math.max(y, size.y);
- }
-
- Point minSize = getMinSize();
- x = Math.max(x, minSize.x);
- y = Math.max(y, minSize.y);
-
- if (wHint != SWT.DEFAULT) {
- x = wHint;
- }
-
- if (hHint != SWT.DEFAULT) {
- y = hHint;
- }
-
- return new Point(x, y);
- }
-
-
- /**
- * @see org.eclipse.swt.widgets.Layout#layout(org.eclipse.swt.widgets.Composite, boolean)
- */
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle rect = composite.getClientArea();
-
- Control[] children = composite.getChildren();
-
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
- }
-
- // contents and buttons
- private Control contents;
- private Button cancelButton;
- private Button openButton;
-
- //private String performActionLabel = JFaceResources.getString("finish");
-
- // the number of long running operations being executed from the dialog
- private long activeRunningOperations;
-
- // cursors during operation
- private Cursor waitCursor;
- private Cursor arrowCursor;
-
- // progress monitor
- private ProgressMonitorPart progressMonitorPart;
-
- // window closing dialog
- private MessageDialog windowClosingDialog;
-
- // minimum size for tab folder
- private Point minSize;
-
- private ISelection selection;
- private String initialPageId;
- private ISystemQuickOpenPage currentPage;
- private int currentIndex;
- private List descriptors;
-
- /**
- * The constructor for the quick open dialog.
- * @param shell the shell.
- * @param selection the current selection.
- * @param pageId the initial page id.
- */
- public SystemQuickOpenDialog(Shell shell, ISelection selection, String pageId) {
- super(shell);
- this.selection = selection;
- this.initialPageId = pageId;
- this.descriptors = SystemQuickOpenUtil.getInstance().getQuickOpenPageDescriptors(initialPageId);
- }
-
-
- // ------------------------------- UI creation and handling ---------------------------------------
-
- /**
- * @see org.eclipse.jface.window.Window#create()
- */
- public void create() {
- super.create();
-
- if (currentPage != null) {
- currentPage.setVisible(true);
- }
- }
-
- /**
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText("Open"); //$NON-NLS-1$
- // TODO: add image and F1 help
- }
-
- /**
- * Creates a page area, a progress monitor and a separator.
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
- protected Control createDialogArea(Composite parent) {
-
- // call super to get a standard composite
- Composite composite = (Composite)(super.createDialogArea(parent));
-
- // create a grid layout
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
-
- // set layout for composite
- composite.setLayout(layout);
-
- // set layout data for composite
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // create the page area
- contents = createPageArea(composite);
-
- // create a progress monitor and make it invisible initially
- GridLayout pmlayout = new GridLayout();
- pmlayout.numColumns = 1;
- progressMonitorPart = new ProgressMonitorPart(composite, pmlayout, SWT.DEFAULT);
- progressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- progressMonitorPart.setVisible(false);
-
- // add a separator
- Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // apply dialog font
- applyDialogFont(composite);
-
- return composite;
- }
-
- /**
- * Creates the page area.
- * @param parent the parent composite.
- * @return the page area control.
- */
- protected Control createPageArea(Composite parent) {
-
- int numPages = descriptors.size();
-
- // if number of pages is 0, then just show a label
- if (numPages == 0) {
- Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
- // TODO: set text
- //label.setText(SearchMessages.getString("SearchDialog.noSearchExtension")); //$NON-NLS-1$
- return label;
- }
-
- // get the preferred index, which is the index of the page with the initial page id, or depends on
- // the current selection
- currentIndex = getPreferredPageIndex();
-
- // get the current page from the index
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- currentPage = getDescriptorAt(currentIndex).createObject();
- }
- });
-
- // set the current page container
- currentPage.setContainer(this);
-
- // if number of pages is 1, simple get the control representing the page and return it
- if (numPages == 1) {
- return getControl(currentPage, parent);
- }
- // if number of pages is more than 1, then we create a tab folder
- else {
-
- // create a border composite
- Composite border = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth= 7;
- layout.marginHeight= 7;
- border.setLayout(layout);
-
- // create a tab folder
- TabFolder folder = new TabFolder(border, SWT.NONE);
- folder.setLayoutData(new GridData(GridData.FILL_BOTH));
- folder.setLayout(new TabFolderLayout());
-
- // go through all descriptors
- for (int i = 0; i < numPages; i++) {
- SystemQuickOpenPageDescriptor descriptor = (SystemQuickOpenPageDescriptor)(descriptors.get(i));
-
- // create a tab item for each descriptor
- final TabItem item = new TabItem(folder, SWT.NONE);
-
- // set the text of the tab item to the label of the descriptor
- item.setText(descriptor.getLabel());
-
- // add a dispose listener which destroys the image
- item.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- item.setData(null);
-
- if (item.getImage() != null) {
- item.getImage().dispose();
- }
- }
- });
-
- // get the image descriptor from the page descriptor
- ImageDescriptor imageDesc = descriptor.getImage();
-
- // if image descriptor exists, create image and set it for the tab item
- if (imageDesc != null) {
- item.setImage(imageDesc.createImage());
- }
-
- // set item data to the descriptor
- item.setData(descriptor);
-
- // now if index is the current index (i.e. the preferred index)
- if (i == currentIndex) {
-
- // get control corresponding to current page with folder as the parent
- item.setControl(getControl(currentPage, folder));
-
- // set the data to the actual page
- item.setData(currentPage);
- }
- }
-
- // add a selection listener to the folder
- folder.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- turnToPage(event);
- }
- });
-
- // set the selection to the current index
- folder.setSelection(currentIndex);
-
- // finally, return the border
- return border;
- }
- }
-
- /**
- * Returns the index of the page to be displayed. If a particular page id was requested, then the index
- * of the page that has that id is returned. Otherwise the index depends on the page most appropriate for
- * the current selection.
- * @return the index of the page to be displayed.
- */
- private int getPreferredPageIndex() {
-
- // TODO: calculate the most appropriate page depending on the selection
- int result = 0;
-
- int size = descriptors.size();
-
- for (int i = 0; i < size; i++) {
-
- SystemQuickOpenPageDescriptor descriptor = (SystemQuickOpenPageDescriptor)(descriptors.get(i));
-
- // if we have an initial page id then we must return the index
- if (initialPageId != null && initialPageId.equals(descriptor.getId())) {
- return i;
- }
-
- // TODO: find out the most appropriate page and return its index
- }
-
- return result;
- }
-
- /**
- * Gets the page descriptor at the specified index.
- * @param index the index.
- * @return the page descriptor at the specified index.
- */
- private SystemQuickOpenPageDescriptor getDescriptorAt(int index) {
- return (SystemQuickOpenPageDescriptor)(descriptors.get(index));
- }
-
- /**
- * Returns the control representing the given page.
- * If the control for the page hasn't been created yet, it is created.
- * The parent of the page control is returned, i.e. we have a wrapper for a page and that is what is returned.
- * @param page the quick open page.
- * @param parent the parent in which to create the page wrapper where the page control will be created.
- * @return the parent of the page control, i.e. a wrapper for the page. The wrapper's parent is the given parent.
- */
- private Control getControl(ISystemQuickOpenPage page, Composite parent) {
-
- // if the page control is null, create it
- if (page.getControl() == null) {
-
- // create a wrapper for the page
- Composite pageWrapper = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- pageWrapper.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- pageWrapper.setLayout(layout);
-
- // create the page in the wrapper
- page.createControl(pageWrapper);
- }
-
- // returns the wrapper
- return page.getControl().getParent();
- }
-
- /**
- * Turns to the page which has been selected.
- * @param event the selection event.
- */
- private void turnToPage(SelectionEvent event) {
- final TabItem item = (TabItem)(event.item);
-
- // if control for tab item hasn't been created yet
- if (item.getControl() == null) {
-
- // get the data which is the descriptor
- final SystemQuickOpenPageDescriptor descriptor = (SystemQuickOpenPageDescriptor)(item.getData());
-
- // set the data to be the actual quick open page
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- item.setData(descriptor.createObject());
- }
- });
-
- // now get the data, which is the quick open page
- ISystemQuickOpenPage page = (ISystemQuickOpenPage)(item.getData());
-
- // set the container of the page
- page.setContainer(this);
-
- // get the control represeting the page
- // note that the widget for the event is the tab folder
- Control newControl = getControl(page, (Composite)(event.widget));
-
- // set the item control
- item.setControl(newControl);
- }
-
- // get the item data and check whether it is an instance of quick open page
- if (item.getData() instanceof ISystemQuickOpenPage) {
-
- // the item data is the new current page
- currentPage = (ISystemQuickOpenPage)(item.getData());
-
- // the current index is the selection index of the item parent (i.e. the tab folder)
- currentIndex = item.getParent().getSelectionIndex();
-
- // resize dialog if needed and pass in the page wrapper
- // that method will test if the control in the page is smaller than the wrapper (i.e. its parent)
- resizeDialogIfNeeded(item.getControl());
-
- // make the current page visible
- currentPage.setVisible(true);
- }
- }
-
- /**
- * Resizes dialog if needed. Tests the given control size with the size of the current page control.
- * If the current page control is smaller, then resize.
- * @param newControl the control whose size we want to test against the size of the page control.
- */
- private void resizeDialogIfNeeded(Control newControl) {
- Point currentSize = currentPage.getControl().getSize();
- Point newSize = newControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-
- // if we must resize, then compute size of shell again, and set it
- if (mustResize(currentSize, newSize)) {
- Shell shell = getShell();
- shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
- }
- }
-
- /**
- * Returns whether we must resize.
- * @param currentSize the current size.
- * @param newSize the new size.
- * @return <code>true</code> if current size is smaller than new size, <code>false</code> otherwise.
- */
- private boolean mustResize(Point currentSize, Point newSize) {
- return currentSize.x < newSize.x || currentSize.y < newSize.y;
- }
-
- /**
- * Gets the minimum size for the tab folder.
- */
- private Point getMinSize() {
-
- if (minSize != null) {
- return minSize;
- }
-
- int x = 0;
- int y = 0;
- int length = descriptors.size();
-
- for (int i = 0; i < length; i++) {
- Point size = getDescriptorAt(i).getPreferredSize();
-
- if (size.x != SWT.DEFAULT) {
- x = Math.max(x, size.x);
- }
- if (size.y != SWT.DEFAULT) {
- y = Math.max(y, size.y);
- }
- }
-
- minSize = new Point(x, y);
- return minSize;
- }
-
- /**
- * Calls the super class method if there are no running operations.
- * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
- */
- protected void cancelPressed() {
-
- if (activeRunningOperations == 0) {
- super.cancelPressed();
- }
- }
-
- /**
- * Calls <code>performAction</code>. If the result of calling this method is <code>true</code>
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- boolean result = performAction();
-
- if (result) {
- super.okPressed();
- }
- }
-
- /**
- * Returns whether ok to close. Asks the current page, if any, whether it is ok to close.
- * @return <code>true</code> if the dialog can be closed, <code>false</code> otherwise.
- */
- protected boolean performAction() {
-
- if (currentPage == null) {
- return true;
- }
-
- return currentPage.performAction();
- }
-
-
- // ----------------------------------------- Interface methods ----------------------------------
-
- /**
- * @see org.eclipse.rse.ui.open.ISystemQuickOpenPageContainer#getRunnableContext()
- */
- public IRunnableContext getRunnableContext() {
- return this;
- }
-
- /**
- * @see org.eclipse.rse.ui.open.ISystemQuickOpenPageContainer#getSelection()
- */
- public ISelection getSelection() {
- return selection;
- }
-
- /**
- * @see org.eclipse.rse.ui.open.ISystemQuickOpenPageContainer#setPerformActionEnabled(boolean)
- */
- public void setPerformActionEnabled(boolean state) {
-
- if (openButton != null) {
- openButton.setEnabled(state);
- }
- }
-
-
- // ----------------------------- Operation related methods --------------------------
-
- /**
- * @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
-
- // The operation can only be cancelled if it is executed in a separate thread.
- // Otherwise the UI is blocked anyway.
- HashMap state = null;
-
- try {
- activeRunningOperations++;
- state = aboutToStart(fork && cancelable);
- ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
- }
- finally {
-
- if (state != null) {
- stopped(state);
- }
-
- activeRunningOperations--;
- }
- }
-
- /**
- * Returns the progress monitor. If the dialog doesn't
- * have a progress monitor, <code>null</code> is returned.
- */
- protected IProgressMonitor getProgressMonitor() {
- return progressMonitorPart;
- }
-
- /**
- * About to start a long running operation tiggered through the dialog.
- * Shows the progress monitor and disables the dialog.
- * @param enableCancelButton <code>true</code> if cancel button should be enabled, <code>false</code> otherwise.
- * @return the saved UI state.
- * @see #stopped(HashMap)
- */
- protected synchronized HashMap aboutToStart(boolean enableCancelButton) {
- HashMap savedState = null;
-
- Shell shell = getShell();
-
- if (shell != null) {
- Display d = shell.getDisplay();
-
- // get focus control
- Control focusControl = d.getFocusControl();
-
- if (focusControl != null && focusControl.getShell() != shell) {
- focusControl = null;
- }
-
- // set the busy cursor to all shells
- waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
- setDisplayCursor(d, waitCursor);
-
- // set the arrow cursor to the cancel component
- arrowCursor = new Cursor(d, SWT.CURSOR_ARROW);
- cancelButton.setCursor(arrowCursor);
-
- // deactivate shell
- savedState = saveUIState(enableCancelButton);
-
- // save focus control
- if (focusControl != null) {
- savedState.put("focusControl", focusControl); //$NON-NLS-1$
- }
-
- // attach the progress monitor part to the cancel button and make it visible
- progressMonitorPart.attachToCancelComponent(cancelButton);
- progressMonitorPart.setVisible(true);
- }
-
- return savedState;
- }
-
- /**
- * A long running operation triggered through the wizard
- * was stopped either by user input or by normal end.
- * @param savedState The saveState returned by <code>aboutToStart</code>.
- * @see #aboutToStart(boolean)
- */
- protected synchronized void stopped(HashMap state) {
-
- Shell shell = getShell();
-
- if (shell != null) {
-
- progressMonitorPart.setVisible(false);
- progressMonitorPart.removeFromCancelComponent(cancelButton);
-
- restoreUIState(state);
-
- setDisplayCursor(shell.getDisplay(), null);
- cancelButton.setCursor(null);
- waitCursor.dispose();
- waitCursor = null;
- arrowCursor.dispose();
- arrowCursor = null;
- Control focusControl = (Control)(state.get("focusControl")); //$NON-NLS-1$
-
- if (focusControl != null && ! focusControl.isDisposed()) {
- focusControl.setFocus();
- }
- }
- }
-
- /**
- * Sets a cursor for all shells in a display.
- * @param d the display.
- * @param c the cursor.
- */
- private void setDisplayCursor(Display d, Cursor c) {
-
- Shell[] shells = d.getShells();
-
- for (int i= 0; i < shells.length; i++) {
- shells[i].setCursor(c);
- }
- }
-
-
- //------------------------ UI state save and restoring -------------------------------------
-
- /**
- * Restores the enable state of the UI, i.e. all dialog contents.
- * @param state the hashmap that contains the enable state of the UI.
- */
- private void restoreUIState(HashMap state) {
- restoreEnableState(cancelButton, state, "cancel"); //$NON-NLS-1$
- restoreEnableState(openButton, state, "open"); //$NON-NLS-1$
- ControlEnableState pageState = (ControlEnableState)state.get("tabForm"); //$NON-NLS-1$
- pageState.restore();
- }
-
- /**
- * Restores the enable state of a control.
- * @param w the control whose state needs to be restored.
- * @param h the hashmap containing the enable state of the control.
- * @param key the key to use to retrieve the enable state.
- */
- protected void restoreEnableState(Control w, HashMap h, String key) {
-
- if (!w.isDisposed()) {
- Boolean b = (Boolean)h.get(key);
-
- if (b != null) {
- w.setEnabled(b.booleanValue());
- }
- }
- }
-
- /**
- * Disables all dialog contents, except maybe the cancel button, depending on the given boolean.
- * @param keepCancelEnabled <code>true</code> if cancel button is enabled, <code>false</code> otherwise.
- * @return the saved state.
- */
- private HashMap saveUIState(boolean keepCancelEnabled) {
- HashMap savedState = new HashMap();
-
- saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$
- saveEnableStateAndSet(openButton, savedState, "open", false); //$NON-NLS-1$
- savedState.put("tabForm", ControlEnableState.disable(contents)); //$NON-NLS-1$
-
- return savedState;
- }
-
- /**
- * Saves the enable state of a control and sets it as well.
- * @param w the control whose enable state we want to set and save.
- * @param h the hashmap where the enable state of the control will be saved.
- * @param key the key with which to save the enable state.
- * @param enabled <code>true</code> if control is to be enabled, <code>false</code> otherwise.
- */
- private void saveEnableStateAndSet(Control w, HashMap h, String key, boolean enabled) {
-
- if (!w.isDisposed()) {
- h.put(key, new Boolean(w.isEnabled()));
- w.setEnabled(enabled);
- }
- }
-
-
- // ------------------------------- Handle shell closing ------------------------------
-
- /**
- * Checks to see if there are any long running operations. If there are, a dialog is shown
- * @see org.eclipse.jface.window.Window#handleShellCloseEvent()
- */
- protected void handleShellCloseEvent() {
-
- if (okToClose()) {
- super.handleShellCloseEvent();
- }
- }
-
- /**
- * Checks if any operations are running. If so, shows a message dialog alerting the user, and returns <code>false</code>
- * indicating the dialog should not be closed.
- * @return <code>true</code> if it is ok to close the dialog, <code>false</code> otherwise.
- */
- public boolean okToClose() {
-
- if (activeRunningOperations > 0) {
-
- // get closing dialog
- synchronized (this) {
- windowClosingDialog = createClosingDialog();
- }
-
- // open it
- windowClosingDialog.open();
-
- // make it null
- synchronized (this) {
- windowClosingDialog = null;
- }
-
- // indicate that operations are running, so not ok to close
- return false;
- }
-
- return true;
- }
-
- /**
- * Creates a dialog with the message that the quick open dialog is closing.
- * @return the message dialog.
- */
- private MessageDialog createClosingDialog() {
- MessageDialog result = new MessageDialog(getShell(), JFaceResources.getString("WizardClosingDialog.title"), //$NON-NLS-1$
- null, JFaceResources.getString("WizardClosingDialog.message"), //$NON-NLS-1$
- MessageDialog.QUESTION, new String[] {IDialogConstants.OK_LABEL}, 0);
- return result;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java
deleted file mode 100644
index 2ccd16259..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenPageDescriptor.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.open;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.StringConverter;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.osgi.framework.Bundle;
-
-
-public class SystemQuickOpenPageDescriptor implements Comparable {
-
- public final static String PAGE_TAG = "page"; //$NON-NLS-1$
- private final static String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
- private final static String ICON_ATTRIBUTE = "icon"; //$NON-NLS-1$
- private final static String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
- private final static String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$
- private final static String SIZE_ATTRIBUTE = "sizeHint"; //$NON-NLS-1$
- private final static String TAB_POSITION_ATTRIBUTE = "tabPosition"; //$NON-NLS-1$
- // private final static String SSF_ID = "ssfid";
-
- public final static Point UNKNOWN_SIZE = new Point(SWT.DEFAULT, SWT.DEFAULT);
-
- private IConfigurationElement element;
-
- /**
- * Constructor for quick open page descriptor.
- * @param a configuration element.
- */
- public SystemQuickOpenPageDescriptor(IConfigurationElement element) {
- this.element = element;
- }
-
- /**
- * Creates a new quick open page from the descriptor.
- */
- public ISystemQuickOpenPage createObject() {
- ISystemQuickOpenPage result = null;
-
- try {
- result = (ISystemQuickOpenPage)(element.createExecutableExtension(CLASS_ATTRIBUTE));
- }
- catch (CoreException e) {
- SystemBasePlugin.logError("Error trying to create a quick open page from configuration element", e); //$NON-NLS-1$
- return null;
- }
- catch (ClassCastException e) {
- SystemBasePlugin.logError("Error trying to create a quick open page from configuration element", e); //$NON-NLS-1$
- return null;
- }
-
- if (result != null) {
- result.setTitle(getLabel());
- }
-
- return result;
- }
-
-
- // --------------------------------------------------------------
- // XML attributes
- // --------------------------------------------------------------
-
- /**
- * Returns the id of the page.
- * @return the id of the page.
- */
- public String getId() {
- return element.getAttribute(ID_ATTRIBUTE);
- }
-
- /**
- * Returns the label of the page.
- */
- public String getLabel() {
- return element.getAttribute(LABEL_ATTRIBUTE);
- }
-
- /**
- * Returns the image for the page.
- */
- public ImageDescriptor getImage() {
-
- String imageName = element.getAttribute(ICON_ATTRIBUTE);
-
- if (imageName == null) {
- return null;
- }
-
- URL url = null;
-
- try {
- String nameSpace = element.getDeclaringExtension().getNamespaceIdentifier();
- Bundle bundle = Platform.getBundle(nameSpace);
- url = new URL(bundle.getEntry("/"), imageName); //$NON-NLS-1$
- }
- catch (java.net.MalformedURLException e) {
- SystemBasePlugin.logError("Error trying to get image", e); //$NON-NLS-1$
- return null;
- }
-
- return ImageDescriptor.createFromURL(url);
- }
-
- /**
- * Returns the page's preferred size
- */
- public Point getPreferredSize() {
- return StringConverter.asPoint(element.getAttribute(SIZE_ATTRIBUTE), UNKNOWN_SIZE);
- }
-
- /**
- * Returns the page's tab position relative to the other tabs.
- * @return the tab position or <code>Integer.MAX_VALUE</code> if not defined in
- the plugins.xml file
- *
- */
- public int getTabPosition() {
-
- int position = Integer.MAX_VALUE / 2;
-
- String str = element.getAttribute(TAB_POSITION_ATTRIBUTE);
-
- if (str != null) {
-
- try {
- position = Integer.parseInt(str);
- }
- catch (NumberFormatException e) {
- SystemBasePlugin.logError("Error trying to get tab position", e); //$NON-NLS-1$
- }
- }
-
- return position;
- }
-
- /**
- * Returns whether the page is enabled.
- * @return <code>true</code> if the page is enabled, <code>false</code> otherwise.
- */
- public boolean isEnabled() {
- return true;
- }
-
-
- // -----------------------------------------------------------
- // compare
- // -----------------------------------------------------------
-
- /**
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Object o) {
-
- int myPos = getTabPosition();
- int objsPos = ((SystemQuickOpenPageDescriptor)o).getTabPosition();
-
- if (myPos == Integer.MAX_VALUE && objsPos == Integer.MAX_VALUE || myPos == objsPos) {
- return getLabel().compareTo(((SystemQuickOpenPageDescriptor)o).getLabel());
- }
- else {
- return myPos - objsPos;
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java
deleted file mode 100644
index ed7b168db..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUI.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.open;
-
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.IWorkbenchWindow;
-
-public class SystemQuickOpenUI {
-
- /**
- * Constructor.
- */
- public SystemQuickOpenUI() {
- super();
- }
-
- /**
- * Opens the quick open dialog in the active workbench window.
- * If <code>pageId</code> is specified and a corresponding page is found then it is brought to top.
- * @param pageId the page to select or <code>null</code> if the best fitting page should be selected.
- */
- public static void openSearchDialog(String pageId) {
- openSearchDialog(SystemBasePlugin.getActiveWorkbenchWindow(), pageId);
- }
-
- /**
- * Opens the quick open dialog.
- * If <code>pageId</code> is specified and a corresponding page is found then it is brought to top.
- * @param window the workbench window to open the dialog in.
- * @param pageId the page to select or <code>null</code> if the best fitting page should be selected.
- */
- public static void openSearchDialog(IWorkbenchWindow window, String pageId) {
- new SystemOpenQuickOpenDialogAction(window, pageId).run();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java
deleted file mode 100644
index e258860e6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/open/SystemQuickOpenUtil.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.open;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * A utility class for quick open. It is a singleton.
- */
-public class SystemQuickOpenUtil {
-
- public static final String QUICK_OPEN_PAGE_EXTENSION_POINT= "quickOpenPages"; //$NON-NLS-1$
-
- // singleton instance
- private static SystemQuickOpenUtil instance;
-
- // a list of page descriptors
- private List pageDescriptors;
-
- /**
- * Constructor for the utility.
- */
- private SystemQuickOpenUtil() {
- super();
- }
-
- /**
- * Returns the singleton instance.
- * @return the singleton instance.
- */
- public static SystemQuickOpenUtil getInstance() {
-
- if (instance == null) {
- instance = new SystemQuickOpenUtil();
- }
-
- return instance;
- }
-
- /**
- * Returns all quick open pages contributed to the workbench.
- * @param pageId a page id for which a descriptor must be returned.
- * @return a list of quick open page descriptors.
- */
- public List getQuickOpenPageDescriptors(String pageId) {
- Iterator iter = getQuickOpenPageDescriptors().iterator();
- List enabledDescriptors = new ArrayList();
-
- while (iter.hasNext()) {
- SystemQuickOpenPageDescriptor desc = (SystemQuickOpenPageDescriptor)(iter.next());
-
- if (desc.isEnabled() || desc.getId().equals(pageId)) {
- enabledDescriptors.add(desc);
- }
- }
-
- return enabledDescriptors;
- }
-
- /**
- * Returns all quick open pages contributed to the workbench.
- * @return a list of quick open pages.
- */
- public List getQuickOpenPageDescriptors() {
-
- if (pageDescriptors == null) {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] elements = registry.getConfigurationElementsFor(RSEUIPlugin.PLUGIN_ID, QUICK_OPEN_PAGE_EXTENSION_POINT);
- pageDescriptors = createQuickOpenPageDescriptors(elements);
- }
-
- return pageDescriptors;
- }
-
- /**
- * Creates quick open page descriptors.
- * @param an array of elements.
- * @return a list of descriptors that correspond to the given elements.
- */
- private List createQuickOpenPageDescriptors(IConfigurationElement[] elements) {
- List result = new ArrayList();
-
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
-
- if (SystemQuickOpenPageDescriptor.PAGE_TAG.equals(element.getName())) {
- SystemQuickOpenPageDescriptor desc = new SystemQuickOpenPageDescriptor(element);
- result.add(desc);
- }
- }
-
- // sort the list of descriptors
- Collections.sort(result);
-
- return result;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java
deleted file mode 100644
index f363cf595..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/ISystemRunnableContext.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Interface for a system runnable context.
- */
-public interface ISystemRunnableContext {
-
- /**
- * Runs the given runnable in the context of the receiver. By default, the
- * progress is provided by the active workbench window but subclasses may
- * override this to provide progress in some other way (through Progress view using Eclipse Job support).
- */
- public abstract void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
-
- /**
- * Returns a shell that can be used to prompt the user.
- * @return a shell.
- */
- public abstract Shell getShell();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java
deleted file mode 100644
index 4a1cbd18f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/Policy.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006,2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- ********************************************************************************/
-
-package org.eclipse.rse.ui.operations;
-
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-
-public class Policy {
-
-
- protected static ResourceBundle bundle = null;
-
- /**
- * Creates a NLS catalog for the given locale.
- */
- public static void localize(String bundleName) {
- bundle = ResourceBundle.getBundle(bundleName);
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] { binding });
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given strings.
- */
- public static String bind(String id, String binding1, String binding2) {
- return bind(id, new String[] { binding1, binding2 });
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of a missing String.
- * Returns the key if not found.
- */
- public static String bind(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it with the given arguments. If the key is
- * not found, return the key.
- */
- public static String bind(String key, Object[] args) {
- try {
- return NLS.bind(bind(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Progress monitor helpers
- */
- public static void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled())
- cancelOperation();
- }
- public static void cancelOperation() {
- throw new OperationCanceledException();
- }
- public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks);
- }
- public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks, int style) {
- if (monitor == null)
- return new NullProgressMonitor();
- if (monitor instanceof NullProgressMonitor)
- return monitor;
- return new SubProgressMonitor(monitor, ticks, style);
- }
-
-
-
- public static ResourceBundle getBundle() {
- return bundle;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemDeferredTreeContentManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemDeferredTreeContentManager.java
deleted file mode 100644
index ff85a76f6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemDeferredTreeContentManager.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [181145] restore selection after deferred query
- ********************************************************************************/
-package org.eclipse.rse.ui.operations;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.ui.progress.DeferredTreeContentManager;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.PendingUpdateAdapter;
-
-public class SystemDeferredTreeContentManager extends
- DeferredTreeContentManager {
-
- private List _pendingQueries;
-
- public SystemDeferredTreeContentManager(ITreeContentProvider provider,
- AbstractTreeViewer viewer)
- {
- super(provider, viewer);
- _pendingQueries = new ArrayList();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.progress.DeferredTreeContentManager#getAdapter(java.lang.Object)
- */
- protected IDeferredWorkbenchAdapter getAdapter(Object element)
- {
-
- if (element instanceof IContextObject)
- {
- element = ((IContextObject)element).getModelObject();
- }
- return super.getAdapter(element);
- }
-
- /**
- * Returns the child elements of the given element, or in the case of a
- * deferred element, returns a placeholder. If a deferred element is used, a
- * job is created to fetch the children in the background.
- *
- * When the job for fetching the children is finished and the placeholder
- * removed, the original selection is restored.
- *
- * @param parent
- * The parent object.
- * @param viewer
- * The viewer
- * @return Object[] or <code>null</code> if parent is not an instance of
- * IDeferredWorkbenchAdapter.
- */
- public Object[] getChildren(final Object parent, final Viewer viewer) {
- final ISelection selection = viewer.getSelection();
- IDeferredWorkbenchAdapter element = getAdapter(parent);
- if (element == null) {
- return null;
- }
- PendingUpdateAdapter placeholder = new PendingUpdateAdapter() {
- protected void setRemoved(boolean removedValue) {
- super.setRemoved(removedValue);
- ISelection curSel = viewer.getSelection();
- //Only restore selection if the user has not changed it manually.
- //TODO in some cases we might need to send an EVENT_SELECT_REMOTE
- //listing the absolute paths of the original selection, in order
- //to properly find the items that should be selected.
- if (isSelectionContainedIn(curSel, selection)) {
- viewer.setSelection(selection);
- }
- }
- };
-
- if (!_pendingQueries.contains(parent))
- {
- startFetchingDeferredChildren(parent, element, placeholder);
- _pendingQueries.add(parent);
- return new Object[] { placeholder };
- }
- return null;
- }
-
- /**
- * Test whether a given selection is a subset of another (parent) selection.
- * @param sel Selection to check
- * @param parent Parent selection
- * @return <code>true</code> if the given selection is a subset.
- */
- private boolean isSelectionContainedIn(ISelection sel, ISelection parent) {
- if (sel.isEmpty())
- return true;
- if (sel.equals(parent))
- return false;
- if ((sel instanceof IStructuredSelection) && (parent instanceof IStructuredSelection)) {
- IStructuredSelection ssel = (IStructuredSelection)sel;
- List spar = ((IStructuredSelection)parent).toList();
- Iterator it = ssel.iterator();
- while (it.hasNext()) {
- Object o = it.next();
- if (!spar.contains(o))
- return false;
- }
- return true;
- }
- return false;
- }
-
- protected void addChildren(final Object parent, final Object[] children,
- IProgressMonitor monitor)
- {
- super.addChildren(parent, children, monitor);
- _pendingQueries.remove(parent);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java
deleted file mode 100644
index 24ae5cc50..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemFetchOperation.java
+++ /dev/null
@@ -1,572 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189272] exception when canceling ssh connect
- * David Dykstal (IBM) - [189483] add notification when canceling password prompting
- * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
- * David McKnight (IBM) - [231964] [ssh] SSH login dialog appears twice after cancel, when doing Refresh on a node
- * David McKnight (IBM) - [235164] SystemView should allow to create filter in disconnected mode
- * David McKnight (IBM) - [239368] Expand to action ignores the filter string
- * David McKnight (IBM) - [244270] Explicit check for isOffline and just returning block implementing a cache for Work Offline
- * David McKnight (IBM) - [233160] [dstore] SSL/non-SSL alert are not appropriate
- * David McKnight (IBM) - [243263] NPE on expanding a filter
- *******************************************************************************/
-
-package org.eclipse.rse.ui.operations;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.subsystems.SubSystem;
-import org.eclipse.rse.core.subsystems.SubSystem.DisplayErrorMessageJob;
-import org.eclipse.rse.internal.ui.GenericMessages;
-import org.eclipse.rse.internal.ui.view.SystemView;
-import org.eclipse.rse.internal.ui.view.SystemViewPart;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.view.IContextObject;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.progress.IElementCollector;
-
-
-/**
- * A SystemFetchOperation is used to perform a query of a remote system on behalf of a subsystem. The operation
- * has some knowledge of the containing user interface, e.g. the workbench part which is responsible for
- * issuing the query. It is created with a "collector" that will contain the results of the query.
- * <p>
- * This class may be subclassed but usually is used directly.
- */
-public class SystemFetchOperation extends JobChangeAdapter implements IRunnableWithProgress
-{
- protected IWorkbenchPart _part;
- protected Object _remoteObject;
- protected IElementCollector _collector;
- private IRunnableContext context;
- protected ISystemViewElementAdapter _adapter;
- protected boolean _canRunAsJob;
- protected InvocationTargetException _exc;
-
- /**
- * Creates an instance of this fetch operation. This instance cannot be run in a job, but must be invoked directly.
- * @param part the workbench part associated with this fetch.
- * @param remoteObject the remote object that provides the context for this fetch
- * @param adapter the adapter that can be used to extract information from the remote objects that will be retrieved by this fetch.
- * @param collector the collector for the fetch results.
- */
- public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector)
- {
- _part = part;
- _remoteObject = remoteObject;
- _collector = collector;
- _adapter = adapter;
- _canRunAsJob = false;
- }
-
- /**
- * Creates an instance of this fetch operation.
- * @param part the workbench part associated with this fetch.
- * @param remoteObject the remote object that provides the context for this fetch
- * @param adapter the adapter that can be used to extract information from the remote objects that will be retrieved by this fetch.
- * @param collector the collector for the fetch results.
- * @param canRunAsJob true if this fetch operation can be run in a job of its own, false otherwise
- */
- public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob)
- {
- _part = part;
- _remoteObject = remoteObject;
- _collector = collector;
- _adapter = adapter;
- _canRunAsJob = canRunAsJob;
- }
-
- public void setException(InvocationTargetException exc)
- {
- _exc = exc;
- }
-
- /**
- * Return the part that is associated with this operation.
- *
- * @return Returns the part or <code>null</code>
- */
- public IWorkbenchPart getPart() {
- return _part;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
- */
- public final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- startOperation();
- try {
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100);
- monitor.setTaskName(getTaskName());
- execute(Policy.subMonitorFor(monitor, 100));
- endOperation();
- } catch (InterruptedException e) { // operation was cancelled
- endOperation();
- monitor.setCanceled(true);
- throw e;
- } catch (Exception e) {
- // TODO: errors may not be empty (i.e. endOperation has not been executed)
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-
- protected void startOperation() {
- //statusCount = 0;
- //resetErrors();
- //confirmOverwrite = true;
- }
-
- protected void endOperation() {
- //handleErrors((IStatus[]) errors.toArray(new IStatus[errors.size()]));
- }
-
-
- /**
- * An action that prompts the user for credentials to connect the subsystem that is issued the fetch.
- * <p>
- * This class is listed as public, but should not be used/referenced by others.
- */
- public class PromptForPassword implements Runnable
- {
- public SubSystem _ss;
- private volatile boolean isCancelled = false;
- public PromptForPassword(SubSystem ss)
- {
- _ss = ss;
- }
-
- public void run()
- {
- try
- {
- isCancelled = false;
- _ss.promptForPassword();
- }
- catch (InterruptedException e) {
- isCancelled = true;
- }
- catch (OperationCanceledException e) {
- isCancelled = true;
- }
- catch (Exception e)
- {
-
- }
- }
-
- /**
- * Test whether this operation is cancelled.
- *
- * This method was renamed from isCanceled to isCancelled in RSE 3.0.
- *
- * @since org.eclipse.rse.ui 3.0
- * @return true if cancelled
- */
- public boolean isCancelled() {
- return isCancelled;
- }
- }
-
- /**
- * A sub-operation that broadcasts any connection status change.
- * <p>
- * Listed as public, but should not be used or referenced by others.
- */
- public class UpdateRegistry implements Runnable
- {
- private SubSystem _ss;
- public UpdateRegistry(SubSystem ss)
- {
- _ss = ss;
- }
-
- public void run()
- {
- ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
- registry.connectedStatusChange(_ss, true, false);
- }
- }
-
- /**
- * Subclasses must override this method to perform the operation.
- * Clients should never call this method directly.
- *
- * @param monitor
- * @throws Exception
- * @throws InterruptedException
- */
- protected void execute(IProgressMonitor monitor) throws Exception, InterruptedException
- {
- SubSystem ss = null;
- Object actualRemoteObj = _remoteObject;
- if (_remoteObject instanceof IContextObject)
- {
- ss = (SubSystem)((IContextObject)_remoteObject).getSubSystem();
- actualRemoteObj = ((IContextObject)_remoteObject).getModelObject();
- }
- else
- {
- ss = (SubSystem)_adapter.getSubSystem(_remoteObject);
- }
-
-
- boolean isPromptable = false;
-
- if (actualRemoteObj instanceof IAdaptable){
- ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)actualRemoteObj).getAdapter(ISystemViewElementAdapter.class);
- if (adapter != null){
- isPromptable = adapter.isPromptable(actualRemoteObj);
- }
- }
-
- synchronized (ss.getConnectorService())
- {
- if (!ss.isConnected() && !isPromptable &&
- !ss.isOffline()) // skip the connect if offline, but still follow through because we need to follow through in the subsystem
- {
-
- Display dis = Display.getDefault();
- PromptForPassword prompter = new PromptForPassword(ss);
- dis.syncExec(prompter);
- if (prompter.isCancelled()) {
- SystemMessage cancelledMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_CANCELLED);
- SystemMessageObject cancelledMessageObject = new SystemMessageObject(cancelledMessage, ISystemMessageObject.MSGTYPE_CANCEL, _remoteObject);
- _collector.add(cancelledMessageObject, monitor);
- throw new InterruptedException();
- }
- try
- {
- ss.getConnectorService().connect(monitor);
- if (_exc != null)
- {
- showOperationErrorMessage(null, _exc, ss);
- }
- }
- catch (InvocationTargetException exc)
- {
- showOperationErrorMessage(null, exc, ss);
- return;
- }
- catch (Exception e)
- {
- showOperationErrorMessage(null, e, ss);
- return;
- }
-
- dis.asyncExec(new UpdateRegistry(ss));
-
- }
- }
-
- Object[] children = null;
- // we first test to see if this is an expand-to filter in effect for this
- // object, and if so use it...
- if ((_part==null || _part instanceof SystemViewPart) && _adapter instanceof ISystemRemoteElementAdapter)
- {
- class GetExpandToFilter implements Runnable
- {
- private String expandToFilter = null;
- public void run()
- {
- // fetching part here ourselves, because the correct part can not always be determined from a background Thread
- // see bug 244454 for details
- IWorkbenchPart activePart = _part;
- if (activePart==null) {
- IWorkbenchWindow win = SystemBasePlugin.getActiveWorkbenchWindow();
- if (win != null){
- IWorkbenchPage page = win.getActivePage();
- if (page != null){
- activePart = page.getActivePart();
- if (activePart != null){
- _part = activePart;
- }
- }
- }
- }
-
- if (activePart instanceof SystemViewPart){
- SystemView viewer = ((SystemViewPart)activePart).getSystemView();
- if (_remoteObject instanceof IContextObject){
- expandToFilter = viewer.getExpandToFilter(((IContextObject)_remoteObject).getModelObject());
- }
- else {
- expandToFilter = viewer.getExpandToFilter(_remoteObject);
- }
- }
- }
-
- public String getExpandToFilter()
- {
- return expandToFilter;
- }
- }
-
- Display dis = Display.getDefault();
- GetExpandToFilter getExpandTo = new GetExpandToFilter();
- dis.syncExec(getExpandTo);
- String expandToFilter = getExpandTo.getExpandToFilter();
-
- if (expandToFilter != null){
- if (_remoteObject instanceof IContextObject){
- children = _adapter.getChildrenUsingExpandToFilter(((IContextObject)_remoteObject).getModelObject(), expandToFilter);
- }
- else {
- children = _adapter.getChildrenUsingExpandToFilter(_remoteObject, expandToFilter);
- }
- }
- }
- if (children == null){
- if (_remoteObject instanceof IContextObject)
- {
- children = _adapter.getChildren((IContextObject)_remoteObject, monitor);
- }
- else
- {
- children = _adapter.getChildren((IAdaptable)_remoteObject, monitor);
- }
- }
- _collector.add(children, monitor);
- monitor.done();
- }
-
- /**
- * Show an error message as a result of running this operation.
- * Uses the user interface knowledge of this operation to show the message.
- * <p>
- * May be overridden by subclasses but it usually used directly.
- * @param shell The parent shell for a message dialog box.
- * @param exc the exception that was recieved and should be shown
- * @param ss the subsystem that this operation is being issued for
- */
- protected void showOperationErrorMessage(Shell shell, Throwable exc, SubSystem ss)
- {
- if (exc instanceof InvocationTargetException) {
- exc = ((InvocationTargetException)exc).getTargetException();
- }
- if (exc instanceof OperationCanceledException) {
- return; //don't log or display user cancellation
- }
- SystemMessage sysMsg = null;
- if (exc instanceof SystemMessageException)
- {
- displayAsyncMsg(ss, (SystemMessageException)exc);
- //sysMsg = ((SystemMessageException)exc).getSystemMessage();
- }
- else
- {
- String excMsg = exc.getMessage();
- if ((excMsg == null) || (excMsg.length()==0))
- excMsg = "Exception " + exc.getClass().getName(); //$NON-NLS-1$
- sysMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_OPERATION_FAILED);
- sysMsg.makeSubstitution(excMsg);
-
- SystemMessageDialog.displayErrorMessage(shell, sysMsg, exc);
- }
-
- }
-
- /**
- * Display message on message thread
- */
- protected void displayAsyncMsg(SubSystem ss, org.eclipse.rse.services.clientserver.messages.SystemMessageException msg)
- {
- DisplayErrorMessageJob job = new DisplayErrorMessageJob(null, msg);
- job.setPriority(Job.INTERACTIVE);
- job.setSystem(true);
- job.schedule();
- }
-
- protected String getTaskName()
- {
- return GenericMessages.RSEQuery_task;
- }
-
- /**
- * Run the operation in a context that is determined by the {@link #canRunAsJob()}
- * hint. If this operation can run as a job then it will be run in a background thread.
- * Otherwise it will run in the foreground and block the caller.
- */
- public final void run() throws InvocationTargetException, InterruptedException {
- if (shouldRun()) {
- getRunnableContext().run(this);
- }
- }
-
- /**
- * This method is invoked from the <code>run()</code> method before
- * the operation is run in the operation's context. Subclasses may
- * override in order to perform prechecks to determine if the operation
- * should run. This may include prompting the user for information, etc.
- *
- * @return whether the operation should be run.
- */
- protected boolean shouldRun() {
- return true;
- }
-
- /**
- * Returns the scheduling rule that is to be obtained before this
- * operation is executed by it's context or <code>null</code> if
- * no scheduling rule is to be obtained. If the operation is run
- * as a job, the schdulin rule is used as the schduling rule of the
- * job. Otherwise, it is obtained before execution of the operation
- * occurs.
- * <p>
- * By default, no scheduling
- * rule is obtained. Sublcasses can override to in order ot obtain a
- * scheduling rule or can obtain schduling rules withing their operation
- * if finer grained schduling is desired.
- *
- * @return the schduling rule to be obtained by this operation
- * or <code>null</code>.
- */
- protected ISchedulingRule getSchedulingRule() {
- return null;
- }
-
- /**
- * Return whether the auto-build should be postponed until after
- * the operation is complete. The default is to postpone the auto-build.
- * subclas can override.
- *
- * @return whether to postpone the auto-build while the operation is executing.
- */
- protected boolean isPostponeAutobuild() {
- return true;
- }
-
-
- /**
- * If this operation can safely be run in the background, then subclasses can
- * override this method and return <code>true</code>. This will make their
- * action run in a {@link org.eclipse.core.runtime.jobs.Job}.
- * Subsclass that override this method should
- * also override the <code>getJobName()</code> method.
- *
- * @return <code>true</code> if this action can be run in the background and
- * <code>false</code> otherwise.
- */
- protected boolean canRunAsJob() {
- return _canRunAsJob;
- }
-
- /**
- * Return the job name to be used if the action can run as a job. (i.e.
- * if <code>canRunAsJob()</code> returns <code>true</code>).
- *
- * @return the string to be used as the job name
- */
- protected String getJobName() {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * This method is called to allow subclasses to configure an action that could be run to show
- * the results of the action to the user. Default is to return null.
- *
- * @return an action that could be run to see the results of this operation
- */
- protected IAction getGotoAction() {
- return null;
- }
-
- /**
- * This method is called to allow subclasses to configure an icon to show when running this
- * operation.
- *
- * @return an URL to an icon
- */
- protected URL getOperationIcon() {
- return null;
- }
-
- /**
- * This method is called to allow subclasses to have the operation remain in the progress
- * indicator even after the job is done.
- *
- * @return <code>true</code> to keep the operation and <code>false</code> otherwise.
- */
- protected boolean getKeepOperation() {
- return false;
- }
-
- /**
- * Return a shell that can be used by the operation to display dialogs, etc.
- *
- * @return a shell
- */
- protected Shell getShell()
- {
- return SystemBasePlugin.getActiveWorkbenchShell();
- }
-
- private ISystemRunnableContext getRunnableContext() {
- if (context == null && canRunAsJob()) {
- SystemJobRunnableContext context = new SystemJobRunnableContext(getJobName(), getOperationIcon(), getGotoAction(), getKeepOperation(), this, getSite());
- context.setPostponeBuild(isPostponeAutobuild());
- context.setSchedulingRule(getSchedulingRule());
- return context;
- } else {
- SystemProgressDialogRunnableContext context = new SystemProgressDialogRunnableContext(getShell());
- context.setPostponeBuild(isPostponeAutobuild());
- context.setSchedulingRule(getSchedulingRule());
- if (this.context != null) {
- context.setRunnableContext(this.context);
- }
- return context;
- }
- }
-
-
-
-
- private IWorkbenchSite getSite() {
- IWorkbenchSite site = null;
- if(_part != null) {
- site = _part.getSite();
- }
- return site;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java
deleted file mode 100644
index c718edb6c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemJobRunnableContext.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- ********************************************************************************/
-
-package org.eclipse.rse.ui.operations;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.progress.IProgressConstants;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-
-
-/**
- * This runnable context executes its operation in the context of a background job.
- */
-public final class SystemJobRunnableContext implements ISystemRunnableContext {
-
- private IJobChangeListener listener;
- private IWorkbenchSite site;
- private String jobName;
- private ISchedulingRule schedulingRule;
- private boolean postponeBuild;
- private boolean isUser;
- private URL icon;
- private boolean keep;
- private IAction action;
-
- /**
- * Constructor.
- * @param jobName the name of the job.
- */
- public SystemJobRunnableContext(String jobName) {
- this(jobName, null, null, false, null, null);
- }
-
- /**
- * Constructor.
- * @param jobName the name of the job.
- * @param icon the icon for the job.
- * @param action the action for the job.
- * @param keep keep the job in the UI even after it is finished.
- * @param listener listener for job changes.
- * @param site the workbench site.
- */
- public SystemJobRunnableContext(String jobName, URL icon, IAction action, boolean keep, IJobChangeListener listener, IWorkbenchSite site) {
- this.jobName = jobName;
- this.listener = listener;
- this.site = site;
- this.isUser = true;
- this.action = action;
- this.icon = icon;
- this.keep = keep;
- }
-
- /**
- * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#run(org.eclipse.jface.operation.IRunnableWithProgress)
- */
- public void run(IRunnableWithProgress runnable) {
-
- // the job
- Job job;
-
- // if there is no scheduling rule, and auto-builds do not have to be postponed
- // then use a basic job
- if (schedulingRule == null && !postponeBuild) {
- job = getBasicJob(runnable);
- }
- // otherwise we need a workspace job for which a scheduling rule needs to be set
- else {
- job = getWorkspaceJob(runnable);
-
- // set scheduling rule if it exists
- if (schedulingRule != null) {
- job.setRule(schedulingRule);
- }
- }
-
- // add a job change listener if there is one
- if (listener != null) {
- job.addJobChangeListener(listener);
- }
-
- // sets whether the job is user initiated
- job.setUser(isUser());
-
- // configure the job
- configureJob(job);
-
- // schedult the job
- schedule(job, site);
- }
-
- /**
- * Configures the properties of the given job.
- * @param job the job to configure.
- */
- private void configureJob(Job job) {
-
- // whether to keep the job in the UI after the job has finished to report results
- // back to the user
- if(keep) {
- job.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
- }
-
- // an action associated with the job if any
- if(action != null) {
- job.setProperty(IProgressConstants.ACTION_PROPERTY, action);
- }
-
- // an icon associated with the job if any
- if(icon != null) {
- job.setProperty(IProgressConstants.ICON_PROPERTY, icon);
- }
- }
-
- /**
- * Returns the shell.
- * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#getShell()
- */
- public Shell getShell() {
- return SystemBasePlugin.getActiveWorkbenchShell();
- }
-
- /**
- * Returns whether auto-builds will be postponed while this
- * context is executing a runnable.
- * @return <code>true</code> if auto-builds will be postponed while this
- * context is executing a runnable, <code>false</code> otherwise.
- */
- public boolean isPostponeBuild() {
- return postponeBuild;
- }
-
- /**
- * Sets whether auto-builds will be postponed while this
- * context is executing a runnable.
- * @param postponeBuild <code>true</code> to postpone auto-builds, <code>false</code> otherwise.
- */
- public void setPostponeBuild(boolean postponeBuild) {
- this.postponeBuild = postponeBuild;
- }
-
- /**
- * Returns the scheduling rule that will be obtained before the context
- * executes a runnable, or <code>null</code> if no scheduling rule is to be obtained.
- * @return the schedulingRule to be used or <code>null</code>.
- */
- public ISchedulingRule getSchedulingRule() {
- return schedulingRule;
- }
-
- /**
- * Returns whether the job created by this runnable context is user initiated.
- * @return <code>true</code> if the job is a result of user initiated actions, <code>false</code> otherwise.
- */
- public boolean isUser() {
- return isUser;
- }
-
- /**
- * Sets wheter the job created by this runnable context is user initiated.
- * By default, the job is a user initiated job.
- * @param isUser <code>true</code> if the job is a result of user initiated actions, <code>false</code> otherwise.
- */
- public void setUser(boolean isUser) {
- this.isUser = isUser;
- }
-
- /**
- * Sets the scheduling rule that will be obtained before the context
- * executes a runnable, or <code>null</code> if no scheduling rule is to be obtained.
- * @param schedulingRule the scheduling rule to be used or <code>null</code>.
- */
- public void setSchedulingRule(ISchedulingRule schedulingRule) {
- this.schedulingRule = schedulingRule;
- }
-
- /**
- * Runs the runnable with the given monitor.
- * @param runnable the runnable.
- * @param monitor the progress monitor.
- * @return the status of running the runnable.
- */
- IStatus run(IRunnableWithProgress runnable, IProgressMonitor monitor) {
-
- // run the runnable
- try {
- runnable.run(monitor);
- }
- catch (InvocationTargetException e) {
- Throwable target = e.getTargetException();
- String msg = ""; //$NON-NLS-1$
-
- if (target != null) {
- msg = target.getMessage();
- }
-
- // return an error status
- return new Status(IStatus.ERROR, RSEUIPlugin.getDefault().getSymbolicName(), 0, msg, target);
- }
- catch (InterruptedException e) {
- return Status.OK_STATUS;
- }
-
- return Status.OK_STATUS;
- }
-
- /**
- * Returns a basic job which simply runs the runnable.
- * @param runnable the runnable.
- * @return the basic job.
- */
- private Job getBasicJob(final IRunnableWithProgress runnable) {
- return new Job(jobName) {
- public IStatus run(IProgressMonitor monitor) {
- return SystemJobRunnableContext.this.run(runnable, monitor);
- }
- };
- }
-
- /**
- * Returns a workspace job which simply runs the runnable.
- * @param runnable the runnable.
- * @return the workspace job.
- */
- private Job getWorkspaceJob(final IRunnableWithProgress runnable) {
- return new WorkspaceJob(jobName) {
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- return SystemJobRunnableContext.this.run(runnable, monitor);
- }
- };
- }
-
- /**
- * Schedules the job.
- * @param job the job to schedule.
- * @param site the workbench site.
- */
- public static void schedule(Job job, IWorkbenchSite site) {
-
- if (site != null) {
-
- // get the site progress service
- IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService)(site.getAdapter(IWorkbenchSiteProgressService.class));
-
- // if there is one, schedule the job with a half-busy cursor
- if (siteProgress != null) {
- siteProgress.schedule(job, 0, true);
- return;
- }
- }
-
- // if no site progress service, just schedule the job in the job queue
- job.schedule();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java
deleted file mode 100644
index 02c827f98..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemProgressDialogRunnableContext.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.operations;
-
-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.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * This runnable context blocks the UI and can therefore have a shell assigned to
- * it (since the shell won't be closed by the user before the runnable completes).
- */
-public class SystemProgressDialogRunnableContext implements ISystemRunnableContext {
-
- private Shell shell;
- private IRunnableContext runnableContext;
- private ISchedulingRule schedulingRule;
- private boolean postponeBuild;
-
- /**
- * Constructor.
- * @param shell the shell for the runnable context.
- */
- public SystemProgressDialogRunnableContext(Shell shell) {
- this.shell = shell;
- }
-
- /**
- * Returns whether the auto-build will be postponed while this
- * context is executing a runnable.
- * @return <code>true</code> if the auto-build will be postponed while this
- * context is executing a runnable, <code>false</code> otherwise.
- */
- public boolean isPostponeBuild() {
- return postponeBuild;
- }
-
- /**
- * Sets whether the auto-build will be postponed while this
- * context is executing a runnable.
- * @param postponeBuild <code>true</code> to postpone the auto-build, <code>false</code< otherwise.
- */
- public void setPostponeBuild(boolean postponeBuild) {
- this.postponeBuild = postponeBuild;
- }
-
- /**
- * Returns the scheduling rule that will be obtained before the context
- * executes a runnable or <code>null</code> if no scheduling rule is to be obtained.
- * @return the scheduling rule to be obtained or <code>null</code>.
- */
- public ISchedulingRule getSchedulingRule() {
- return schedulingRule;
- }
-
- /**
- * Sets the scheduling rule that will be obtained before the context
- * executes a runnable or <code>null</code> if no scheduling rule is to be obtained.
- * @param schedulingRule the scheduling rule to be obtained or <code>null</code>.
- */
- public void setSchedulingRule(ISchedulingRule schedulingRule) {
- this.schedulingRule = schedulingRule;
- }
-
- /**
- * Returns the shell.
- * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#getShell()
- */
- public Shell getShell() {
- return shell;
- }
-
- /**
- * Sets the runnable context that is used to execute the runnable. By default,
- * the workbench's progress service is used, but clients can provide their own.
- * @param runnableContext the runnable contenxt used to execute runnables.
- */
- public void setRunnableContext(IRunnableContext runnableContext) {
- this.runnableContext = runnableContext;
- }
-
- /**
- * Runs the runnable.
- * @see org.eclipse.rse.ui.operations.ISystemRunnableContext#run(org.eclipse.jface.operation.IRunnableWithProgress)
- */
- public void run(IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- // fork and cancellable
- getRunnableContext().run(true, true, wrapRunnable(runnable));
- }
-
- /**
- * Returns the runnable context. If a runnable context was not set, the default is to use the workbench
- * progress service.
- * @return the runnable context.
- */
- private IRunnableContext getRunnableContext() {
-
- // no runnable context set, so we create our default
- if (runnableContext == null) {
-
- return new IRunnableContext() {
-
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
-
- // get the workbench progress service
- IProgressService manager = PlatformUI.getWorkbench().getProgressService();
-
- // run the runnable in a non-UI thread and set the cursor to busy
- manager.busyCursorWhile(runnable);
- }
- };
- }
-
- return runnableContext;
- }
-
- /**
- * Wraps the runnable as required and returns the wrapper runnable. If there is no scheduling rule, and
- * auto-builds do not have to be postponed, then the wrapper simply defers to the runnable. Otherwise,
- * we execute the runnable as an atomic workspace operation.
- * @param runnable the runnable to wrap.
- * @return the wrapper runnable.
- */
- private IRunnableWithProgress wrapRunnable(final IRunnableWithProgress runnable) {
-
- // wrap the runnable in another runnable
- return new IRunnableWithProgress() {
-
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
-
- try {
-
- // if there is no scheduling rule, and if auto-build does not have to be postponed
- // then simply use the given runnable
- if (schedulingRule == null && !postponeBuild) {
- runnable.run(monitor);
- }
- // otherwise, we need to run taking into account the scheduling rule
- else {
-
- // array for holding exceptions
- final Exception[] exception = new Exception[] { null };
-
- // we run as an atomic workspace operation with a scheduling rule and allow updates
- // create a workspace runnable
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- // just use the given runnable
- runnable.run(pm);
- }
- catch (InvocationTargetException e) {
- exception[0] = e;
- }
- catch (InterruptedException e) {
- exception[0] = e;
- }
- }
- }, schedulingRule, 0, monitor);
-
- if (exception[0] != null) {
- if (exception[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException)exception[0];
- }
- else if (exception[0] instanceof InterruptedException) {
- throw (InterruptedException)exception[0];
- }
- }
- }
- }
- catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java
deleted file mode 100644
index 6b2bbb675..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/operations/SystemSchedulingRule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.operations;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-
-/**
- * A simple job scheduling rule for serializing jobs for an ICVSRepositoryLocation
- */
-public class SystemSchedulingRule implements ISchedulingRule {
- IAdaptable _location;
-
- public SystemSchedulingRule(IAdaptable location)
- {
- _location = location;
- }
-
- public boolean isConflicting(ISchedulingRule rule)
- {
- if(rule instanceof SystemSchedulingRule)
- {
- return ((SystemSchedulingRule)rule)._location.equals(_location);
- }
- return false;
- }
-
- public boolean contains(ISchedulingRule rule)
- {
- return isConflicting(rule);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java
deleted file mode 100644
index 8af6597aa..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/AbstractSystemSubSystemPropertyPageCoreForm.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * The form for the property page for core subsystem properties.
- */
-public abstract class AbstractSystemSubSystemPropertyPageCoreForm
- implements ISystemSubSystemPropertyPageCoreForm
-{
-
- protected Label labelTypePrompt, labelVendorPrompt, labelNamePrompt, labelConnectionPrompt, labelProfilePrompt;
-
- protected Label labelType, labelVendor, labelName, labelConnection, labelProfile;
-
- protected SystemMessage errorMessage;
- protected ResourceBundle rb;
- protected boolean initDone = false;
- protected String xlatedNotApplicable = null;
- // Inputs from caller
- protected ISystemMessageLine msgLine;
- protected Object inputElement;
- protected Shell shell;
- protected Object caller;
- protected boolean callerInstanceOfWizardPage, callerInstanceOfSystemPromptDialog, callerInstanceOfPropertyPage;
-
- /**
- * Constructor
- */
- public AbstractSystemSubSystemPropertyPageCoreForm(ISystemMessageLine msgLine, Object caller)
- {
- super();
- this.msgLine = msgLine;
- this.caller = caller;
- callerInstanceOfWizardPage = (caller instanceof WizardPage);
- callerInstanceOfSystemPromptDialog = (caller instanceof SystemPromptDialog);
- callerInstanceOfPropertyPage = (caller instanceof PropertyPage);
- }
- /**
- * Get the input element
- */
- private Object getElement()
- {
- return inputElement;
- }
- /**
- * Get the shell
- */
- protected Shell getShell()
- {
- return shell;
- }
-
-
-
- /**
- * Create the GUI contents.
- */
- public Control createContents(Composite parent, Object inputElement, Shell shell)
- {
- this.shell = shell;
- this.inputElement = inputElement;
- String labelText = null;
- // Inner composite
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
-
- // Type display
- labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_TYPE_LABEL);
- labelTypePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
- labelType = SystemWidgetHelpers.createLabel(composite_prompts, SystemResources.RESID_SUBSYSTEM_TYPE_VALUE);
-
- // Vendor display
- labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_VENDOR_LABEL);
- labelVendorPrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
- labelVendor = SystemWidgetHelpers.createLabel(composite_prompts, " "); //$NON-NLS-1$
-
- // Name display
- labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_NAME_LABEL);
- labelNamePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
- labelName = SystemWidgetHelpers.createLabel(composite_prompts, " "); //$NON-NLS-1$
-
- // Connection display
- labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_CONNECTION_LABEL);
- labelConnectionPrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
- labelConnection = SystemWidgetHelpers.createLabel(composite_prompts, " "); //$NON-NLS-1$
-
- // Profile display
- labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_PROFILE_LABEL);
- labelProfilePrompt = SystemWidgetHelpers.createLabel(composite_prompts, labelText);
- labelProfile = SystemWidgetHelpers.createLabel(composite_prompts, " "); //$NON-NLS-1$
-
- createInner(composite_prompts, inputElement, shell);
-
- return composite_prompts;
- }
-
- /**
- * Return control to recieve initial focus
- */
- public Control getInitialFocusControl()
- {
- return null;
- }
- /**
- * Get the input subsystem object
- */
- protected ISubSystem getSubSystem()
- {
- Object element = getElement();
- if (element instanceof ISubSystem)
- return (ISubSystem)element;
- else
- return null;
- }
-
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISubSystem ss = getSubSystem();
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
-
- //getPortValidator();
- // vendor
- labelVendor.setText(ssFactory.getVendor());
- // name
- labelName.setText(ss.getName());
- // connection
- labelConnection.setText(ss.getHostAliasName());
- // profile
- labelProfile.setText(ss.getSystemProfileName());
-
- doInitializeInnerFields();
- }
-
-
-
-
-
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = false;
- return pageComplete;
- }
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- boolean complete = isPageComplete();
- if (callerInstanceOfWizardPage)
- {
- ((WizardPage)caller).setPageComplete(complete);
- }
- else if (callerInstanceOfSystemPromptDialog)
- {
- ((SystemPromptDialog)caller).setPageComplete(complete);
- }
- else if (callerInstanceOfPropertyPage)
- {
- ((PropertyPage)caller).setValid(complete);
- }
- }
-
-
-
-
-
-
- /*
- * Create the inner portion of the contents. These include any additional fields for the subsystem
- */
- protected abstract Control createInner(Composite parent, Object inputElement, Shell shell);
-
- /*
- * Initialize the inner portion of the contents. These include any additional fields for the subsystem
- */
- protected abstract void doInitializeInnerFields();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java
deleted file mode 100644
index 9391d4d61..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardErrorUpdater.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import org.eclipse.rse.ui.ISystemVerifyListener;
-
-/**
- * @author mjberger
- */
-public interface ISystemConnectionWizardErrorUpdater
-{
- public boolean isPageComplete();
- public void addVerifyListener(ISystemVerifyListener listener);
- public String getTheErrorMessage();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java
deleted file mode 100644
index d72999205..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemSubSystemPropertyPageCoreForm.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-
-/**
- * interface for a property page that can be shown in the new connection wizard
- */
-public interface ISystemSubSystemPropertyPageCoreForm
-{
- /**
- * Create the GUI contents.
- */
- public Control createContents(Composite parent, Object inputElement, Shell shell);
-
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk();
-
- /**
- * Validate the form
- * <p>
- * Subclasses should override to do full error checking on all
- * the widgets on the form.
- */
- public boolean verifyFormContents();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ServicesPropertyPage.java
deleted file mode 100644
index 0fe735ba1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ServicesPropertyPage.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * David Dykstal (IBM) - [217556] remove service subsystem types
- * David Dykstal (IBM) - [231630] add help for services property page
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
-import org.eclipse.rse.ui.widgets.services.RootServiceElement;
-import org.eclipse.rse.ui.widgets.services.ServiceElement;
-import org.eclipse.rse.ui.widgets.services.ServicesForm;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-public abstract class ServicesPropertyPage extends SystemBasePropertyPage
-{
- protected ServicesForm _form;
- protected String _hostname;
- protected IRSESystemType _hosttype;
- protected ServiceElement _rootElement;
-
- protected Control createContentArea(Composite parent)
- {
- _form = new ServicesForm(parent.getShell(), getMessageLine());
- _form.createContents(parent);
-
- // init services
- initServices();
- SystemWidgetHelpers.setCompositeHelp(parent, "org.eclipse.rse.ui.ServicesPropertyPage"); //$NON-NLS-1$
- return parent;
- }
-
-
- protected boolean verifyPageContents()
- {
- return _form.verify();
- }
-
- protected void initServices()
- {
- ServiceElement[] elements = getServiceElements();
- _rootElement = new RootServiceElement(elements);
- _form.init(_rootElement);
- }
-
- /**
- * @since 3.0 returning ISubSystem rather than IServiceSubSystem
- * @return
- */
- protected ISubSystem getServiceSubSystem()
- {
- return (ISubSystem)getElement();
- }
-
- protected abstract ServiceElement[] getServiceElements();
-
- /**
- * @since 3.0
- */
- protected abstract ISubSystemConfiguration getCurrentSubSystemConfiguration();
-
- public boolean performOk()
- {
- boolean result = super.performOk();
- if (result)
- {
- commitChanges();
- return applyValues(getServiceSubSystem().getConnectorService());
- }
- else
- {
- return result;
- }
- }
-
- protected void commitChanges()
- {
- _rootElement.commit();
- }
-
- protected void revertChanges()
- {
- _rootElement.revert();
- }
-
- public boolean applyValues(IConnectorService connectorService)
- {
- FactoryServiceElement selectedService = (FactoryServiceElement)_form.getSelectedService();
- ISubSystemConfiguration factory = selectedService.getFactory();
- ISubSystemConfiguration currentFactory = getCurrentSubSystemConfiguration();
- if (factory != currentFactory)
- {
- getServiceSubSystem().switchServiceFactory(factory);
- }
- return true;
- }
-
- public void setHostname(String hostname)
- {
- _hostname = hostname;
- }
-
- public void setSystemType(IRSESystemType systemType)
- {
- _hosttype = systemType;
- }
-
- public String getHostname()
- {
- return _hostname;
- }
-
- public IRSESystemType getSystemType()
- {
- return _hosttype;
- }
-
-
- public boolean performCancel()
- {
- _rootElement.revert();
- return super.performCancel();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java
deleted file mode 100644
index 321fdc2a9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.core.PasswordPersistenceManager;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.SystemSignonInformation;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPasswordPersistencePrompt;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-
-/**
- * Remote systems preference page which allows users to manage (add / change /
- * remove) their saved passwords.
- */
-public final class SignonPreferencePage extends PreferencePage implements IWorkbenchPreferencePage,
- Listener{
-
-
- // SWT Widgets and content providers
- private Table pwdTable;
- private TableViewer pwdTableViewer;
- private PasswordContentProvider provider;
- private Button addButton, changeButton, removeButton;
-
- // List of information for table
- private List passwords;
-
- // List to keep track of additions / deletions / changes. We need to
- // keep track of these until the user decides whether to cancel the preference
- // page (and we forget about the changes) or press ok (and we commit the changes)
- private List modifications;
-
- /**
- * Inner class to keep track of password modifications (without committing them
- * to the keyring) while the user modifies the preferences.
- */
- protected class PasswordModification
- {
- protected static final int ADD = 1;
- protected static final int DELETE = 2;
-
- protected int changeFlag;
- protected SystemSignonInformation info;
-
- protected PasswordModification(int changeFlag, SystemSignonInformation info)
- {
- this.changeFlag = changeFlag;
- this.info = info;
- }
- }
-
- private final class PasswordContentProvider implements IStructuredContentProvider, ITableLabelProvider {
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object inputElement) {
- return passwords.toArray();
- }
-
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- switch (columnIndex) {
- case 0:
- return ((SystemSignonInformation) element).getHostname();
-
- case 1:
- return ((SystemSignonInformation) element).getSystemType().getLabel();
-
- case 2:
- return ((SystemSignonInformation) element).getUserId();
- }
-
- // Should never get here
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(Object, String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
- }
-
-
- /**
- *
- */
- public SignonPreferencePage() {
- noDefaultAndApplyButton();
- provider = new PasswordContentProvider();
- modifications = new ArrayList();
- }
-
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent)
- {
-
- Composite page = SystemWidgetHelpers.createComposite(parent, 2);
- GridData gd = (GridData) page.getLayoutData();
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
-
-// SystemWidgetHelpers.createLabel(page, SystemResources.RESID_PREF_SIGNON_DESCRIPTION, 2);
-
- // Password table
- pwdTable = new Table(page, SWT.FULL_SELECTION |SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- pwdTable.setLinesVisible(true);
- pwdTable.setHeaderVisible(true);
- pwdTable.addListener(SWT.Selection, this);
- SystemWidgetHelpers.setHelp(pwdTable, RSEUIPlugin.HELPPREFIX + "pwdi0000"); //$NON-NLS-1$
-
- TableLayout tableLayout = new TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(100, true));
- tableLayout.addColumnData(new ColumnWeightData(100, true));
- tableLayout.addColumnData(new ColumnWeightData(100, true));
- pwdTable.setLayout(tableLayout);
-
- gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
-
- pwdTable.setLayoutData(gd);
-
- // Hostname column
- TableColumn hostnameColumn = new TableColumn(pwdTable, SWT.NONE);
- hostnameColumn.setText(SystemResources.RESID_PREF_SIGNON_HOSTNAME_TITLE);
-
- // System type column
- TableColumn sysTypeColumn = new TableColumn(pwdTable, SWT.NONE);
- sysTypeColumn.setText(SystemResources.RESID_PREF_SIGNON_SYSTYPE_TITLE);
-
- // User ID column
- TableColumn useridColumn = new TableColumn(pwdTable, SWT.NONE);
- useridColumn.setText(SystemResources.RESID_PREF_SIGNON_USERID_TITLE);
-
- pwdTableViewer = new TableViewer(pwdTable);
- pwdTableViewer.setContentProvider(provider);
- pwdTableViewer.setLabelProvider(provider);
- pwdTableViewer.setInput(passwords);
-
- // Create the Button bar for add, change and remove
- Composite buttonBar = SystemWidgetHelpers.createComposite(page, 1);
- gd = (GridData) buttonBar.getLayoutData();
- gd.grabExcessHorizontalSpace = false;
- gd.grabExcessVerticalSpace = true;
-
- addButton = SystemWidgetHelpers.createPushButton(buttonBar, this, SystemResources.RESID_PREF_SIGNON_ADD_LABEL, SystemResources.RESID_PREF_SIGNON_ADD_TOOLTIP);
- changeButton = SystemWidgetHelpers.createPushButton(buttonBar, this, SystemResources.RESID_PREF_SIGNON_CHANGE_LABEL, SystemResources.RESID_PREF_SIGNON_CHANGE_TOOLTIP);
- removeButton = SystemWidgetHelpers.createPushButton(buttonBar, this, SystemResources.RESID_PREF_SIGNON_REMOVE_LABEL, SystemResources.RESID_PREF_SIGNON_REMOVE_TOOLTIP);
-
- changeButton.setEnabled(false);
- removeButton.setEnabled(false);
-
- SystemWidgetHelpers.setHelp(addButton, RSEUIPlugin.HELPPREFIX + "pwdi0000"); //$NON-NLS-1$
- SystemWidgetHelpers.setHelp(changeButton, RSEUIPlugin.HELPPREFIX + "pwdi0000"); //$NON-NLS-1$
- SystemWidgetHelpers.setHelp(removeButton, RSEUIPlugin.HELPPREFIX + "pwdi0000"); //$NON-NLS-1$
-
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "pwdi0000"); //$NON-NLS-1$
- SystemWidgetHelpers.setMnemonics(parent);
-
- return parent;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- // reinit passwords list
- passwords = PasswordPersistenceManager.getInstance().getSavedUserIDs();
-
- // refresh password table
- if (pwdTableViewer != null)
- {
- pwdTableViewer.refresh();
- }
- }
-
-
- /**
- * @see org.eclipse.swt.widgets.Listener#handleEvent(Event)
- */
- public void handleEvent(Event event) {
- if (event.type == SWT.Selection) {
- if (event.widget == addButton) {
- SystemPasswordPersistencePrompt dialog = new SystemPasswordPersistencePrompt(getShell(), SystemResources.RESID_PREF_SIGNON_ADD_DIALOG_TITLE, passwords, false);
- if (dialog.open() == Window.OK)
- {
- SystemSignonInformation info = dialog.getSignonInformation();
- passwords.add(info);
- modifications.add(new PasswordModification(PasswordModification.ADD, info));
-
- pwdTableViewer.refresh();
- pwdTable.select(passwords.size() - 1); // select the new entry
- }
-
- } else if (event.widget == changeButton) {
- SystemPasswordPersistencePrompt dialog = new SystemPasswordPersistencePrompt(getShell(), SystemResources.RESID_PREF_SIGNON_CHANGE_DIALOG_TITLE, passwords, true);
- int index = pwdTable.getSelectionIndex();
- SystemSignonInformation info = (SystemSignonInformation) passwords.get(index);
- dialog.setInputData(info.getSystemType(), info.getHostname(), info.getUserId());
- if (dialog.open() == Window.OK)
- {
- // Remove old and add new
- info = dialog.getSignonInformation();
- SystemSignonInformation oldInfo = (SystemSignonInformation) passwords.remove(index);
- passwords.add(index, info);
-
- modifications.add(new PasswordModification(PasswordModification.DELETE, oldInfo));
- modifications.add(new PasswordModification(PasswordModification.ADD, info));
-
- pwdTableViewer.refresh();
- pwdTable.select(index);
- }
-
- } else if (event.widget == removeButton) {
- int[] indicies = pwdTable.getSelectionIndices();
- for (int idx = indicies.length - 1; idx >= 0; idx--)
- {
- PasswordPersistenceManager.getInstance().remove((SystemSignonInformation)passwords.get(indicies[idx]));
- modifications.add(new PasswordModification(PasswordModification.DELETE,
- (SystemSignonInformation) passwords.remove(indicies[idx])));
- }
-
- pwdTableViewer.refresh();
- }
-
- // Update table buttons based on changes
- switch (pwdTable.getSelectionCount())
- {
- case 0:
- changeButton.setEnabled(false);
- removeButton.setEnabled(false);
- break;
-
- case 1:
- changeButton.setEnabled(true);
- removeButton.setEnabled(true);
- break;
-
- default:
- changeButton.setEnabled(false);
- removeButton.setEnabled(true);
- break;
- }
- }
- }
-
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
-
- if (modifications.size() > 0)
- {
- PasswordModification mod;
- PasswordPersistenceManager manager = PasswordPersistenceManager.getInstance();
- IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHosts();
- ISubSystem[] subsystems;
- IConnectorService system;
-
- for (int i = 0; i < modifications.size(); i++)
- {
- mod = (PasswordModification) modifications.get(i);
-
- if (mod.changeFlag == PasswordModification.ADD)
- {
- manager.add(mod.info, true);
-
- // yantzi: artemis 6.0, clear any cached passwords that are affected additions
- // (this is either a real add or a change (which is really a remove followed
- // by an add)
- if (connections != null)
- {
- for (int j = 0; j < connections.length; j++)
- {
- if (connections[j].getHostName().equalsIgnoreCase(mod.info.getHostname()))
- {
- subsystems = connections[j].getSubSystems();
- if (subsystems != null)
- {
- for (int k = 0; k < subsystems.length; k++)
- {
- system = subsystems[k].getConnectorService();
- if (system != null)
- {
- system.clearPassword(false, true);
- }
- }
- }
- }
- }
- }
- }
- else if (mod.changeFlag == PasswordModification.DELETE)
- {
- manager.remove(mod.info);
- }
- }
-
- modifications.clear();
- }
-
- return super.performOk();
- }
-
- /**
- * @see org.eclipse.jface.preference.IPreferencePage#performCancel()
- */
- public boolean performCancel() {
- modifications.clear();
- return super.performCancel();
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java
deleted file mode 100644
index 1387e7bb9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBasePropertyPage.java
+++ /dev/null
@@ -1,534 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.ISystemMessageLineTarget;
-import org.eclipse.rse.ui.messages.SystemMessageLine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * A base class for property pages that offers value over the base Eclipse PropertyPage
- * class:
- * <ul>
- * <li>Adds a message line and {@link org.eclipse.rse.ui.messages.ISystemMessageLine} message methods.
- * <li>Automatically assigns mnemonics to controls on this page, simplifying this common task. See {#wantMnemonics()}.
- * <li>If no Default and Apply buttons wanted (default), the area reserved for this is removed, removing extra white space.
- * <li>For pages with input controls, simplifies the page validation burden: only one method need be overridden: {@link #verifyPageContents()}
- * <br>To do on-the-fly validation, in your handler calling setErrorMessage/clearErrorMessage automatically calls setValid, although
- * you can call it directly too if you desire.
- * <br>verifyPageContents is called by default by performOk (be sure to call super.performOk if you override), and
- * for multiple property pages, is called when another one is selected.
- * </ul>
- * <p>To get these benefits you must override {@link #createContentArea(Composite)} instead of createContents.
- * Our base implementation of createContents configures the message line and then calls
- * createContentArea and then assigns mnemonics to the content area.
- * </p>
- *
- */
-public abstract class SystemBasePropertyPage extends PropertyPage
- implements ISystemMessageLine, ISystemMessageLineTarget
-{
-
-
- protected ISystemMessageLine msgLine;
- protected boolean msgLineSet = false;
- protected Composite contentArea, buttonsComposite;
- private Cursor waitCursor;
- private String helpId;
-
- /**
- * Constructor for SystemBasePropertyPage
- */
- public SystemBasePropertyPage()
- {
- super();
- }
-
- /**
- * <i>Parent intercept. No need to call or override.</i><br>
- * Our base implementation of createContents configures them message line and then calls
- * {@link #createContentArea(Composite)} and then assigns mnemonics to the content area.
- * Also calls {@link #noDefaultAndApplyButton()} if {@link #wantDefaultAndApplyButton()} returns false.
- *
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- * @see #createContentArea(Composite)
- */
- protected Control createContents(Composite parent)
- {
- // TODO - redesign message line so it works in Eclipse 3.0
- // DKM commenting this out for now to avoid exceptions
- //configureMessageLine();
- if (!wantDefaultAndApplyButton())
- noDefaultAndApplyButton();
- Control c = createContentArea(parent);
- if ((c != null) && (c instanceof Composite))
- {
- contentArea = (Composite)c;
- if (helpId != null)
- SystemWidgetHelpers.setHelp(contentArea, helpId);
- if (wantMnemonics())
- (new Mnemonics()).setOnPreferencePage(true).setMnemonics(contentArea);
- }
- configureMessageLine();
- return c;
- }
-
- /**
- * <i>Configuration method. Override only to change the default. </i><br>
- * Return true if you want to see Apply and Restore Defaults buttons. This is queried by
- * the default implementation of createContents and the default is false, we don't want
- * to see them. Default is <b>false</b>.
- */
- protected boolean wantDefaultAndApplyButton()
- {
- return false;
- }
-
- /**
- * <i>Configuration method. Override only to change the default. </i><br>
- * Return false if you don't want to have mnemonics automatically applied to your page
- * by this parent class. Default is <b>true</b>.
- */
- protected boolean wantMnemonics()
- {
- return true;
- }
- /**
- * <i>Configuration method. Override only to change the default. </i><br>
- * Return false if you don't want to automatically set whether the page is valid based
- * on error message status. Default is <b>true</b>
- */
- protected boolean wantAutomaticValidManagement()
- {
- return true;
- }
-
- /**
- * For setting the default overall help for the dialog.
- * This can be overridden per control by calling {@link SystemWidgetHelpers#setHelp(Control, String)}
- */
- public void setHelp(String helpId)
- {
- if (contentArea != null)
- {
- SystemWidgetHelpers.setHelp(contentArea, helpId);
- SystemWidgetHelpers.setHelp(contentArea, helpId);
- //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
- //SystemWidgetHelpers.setCompositeHelp(buttonsComposite, helpId, helpIdPerControl);
- }
- this.helpId = helpId;
- }
-
- /**
- * <i><b>Abstract</b>. You must override.</i><br>
- * This is where child classes create their content area versus createContent,
- * in order to have the message line configured for them and mnemonics assigned.
- */
- protected abstract Control createContentArea(Composite parent);
-
-
- /**
- * <i><b>Private</b>. No need to call or override.</i><br>
- * Configure the message line if not already. Called for you if you override createContentArea
- * versus createContents, else you might choose to call it yourself.
- */
- protected void configureMessageLine()
- {
-// if (msgLine == null)
- //msgLine = SystemPropertiesMessageLine.configureMessageLine(this);
- // msgLine = SystemDialogPageMessageLine.createPropertyPageMsgLine(this);
- }
-
- /**
- * <i><b>Private</b>. No need to call or override.</i><br>
- * Override of parent to delete the button bar since we don't use it, and to make this
- * page fit on a 800x600 display
- */
- protected void contributeButtons(Composite buttonBar)
- {
- this.buttonsComposite = buttonBar;
- if (helpId != null)
- SystemWidgetHelpers.setHelp(buttonsComposite, helpId);
-
- if (wantDefaultAndApplyButton())
- super.contributeButtons(buttonBar);
- else
- {
- // see createControl method in org.eclipse.jface.preference.PreferencePage
- Composite content = buttonBar.getParent();
- //Composite pageContainer = content.getParent();
- //DY The parent PreferencePage class handles this now for us
- //DY buttonBar.setVisible(false);
- //DY buttonBar.dispose();
-
- if ((contentArea != null) && (contentArea.getLayout() != null) &&
- (contentArea.getLayout() instanceof GridLayout))
- {
- ((GridLayout)contentArea.getLayout()).marginHeight = 0;
- if (contentArea.getLayoutData() instanceof GridData)
- ((GridData)contentArea.getLayoutData()).grabExcessVerticalSpace = false;
- contentArea.pack();
- }
- if (content != null)
- {
-// if (content.getLayout() instanceof GridLayout)
-// {
-// GridLayout layout = (GridLayout)content.getLayout();
-// layout.marginHeight= 0; layout.marginWidth= 0;
-// }
- content.pack();
- }
- }
- }
-
- /**
- * <i>Parent intercept. No need to call or override.</i><br>
- * The <code>PreferencePage</code> implementation of this
- * <code>IPreferencePage</code> method returns <code>true</code>
- * if the page is valid.
- * <p>
- * We first test isValid() just like our parent implementation does,
- * but since that only represents the valid state of the
- * last control the user interacted with, we also call verifyPageContents.
- * <p>
- * Subclasses must override {@link #verifyPageContents()} to do full error checking on all
- * the widgets on the page.
- */
- public boolean okToLeave()
- {
- super.okToLeave();
- boolean ok = isValid();
- if (ok)
- {
- ok = verifyPageContents();
- }
- //System.out.println("Inside okToLeave. returning "+ok);
- return ok;
- }
-
- /**
- * <i><b>Abstract</b>. You must override. Return true if no input fields to check.</i><br>
- * Validate all the widgets on the page. Based on this, the Eclipse framework will know whether
- * to veto any user attempt to select another property page from the list on the left in the
- * Properties dialog.
- * <p>
- * Subclasses should override to do full error checking on all the widgets on the page. Recommendation:<br>
- * <ul>
- * <li>If an error is detected, issue a {@link SystemMessage} via {@link #setErrorMessage(SystemMessage)} or text message via {@link #setErrorMessage(String)}.
- * <li>If no errors detected, clear the message line via {@link #clearErrorMessage()}
- * </ul>
- *
- * @return true if there are no errors, false if any errors were found.
- */
- protected abstract boolean verifyPageContents();
- /*
- {
- return true;
- }*/
-
- /**
- * Method declared on IPreferencePage.
- * Our implementation is to call okToLeave(), which in turn calls verifyPageContents,
- * returning true iff they do.
- * If you override, call super.performOk() to get default processing, and return false if that returns false.
- * @return true if all is well, false if there is an error.
- */
- public boolean performOk()
- {
- boolean oldValid = isValid();
- boolean newValid = okToLeave();
- setValid(oldValid);
- return newValid;
- }
- // -----------------------------------
- // ISystemMessageLineTarget methods...
- // -----------------------------------
- /**
- * <i>ISystemMessageLineTarget method.</i><br>
- * Set the message line to use for issuing messages
- */
- public void setMessageLine(ISystemMessageLine msgLine)
- {
- //System.out.println("Inside setMessageLine");
- this.msgLine = msgLine;
- msgLineSet = (msgLine != null);
- }
- /**
- * <i>ISystemMessageLineTarget method.</i><br>
- * Get the message line to use for issuing messages
- */
- public ISystemMessageLine getMessageLine()
- {
- //if (msgLineSet)
- // return msgLine;
- //else
- return this;
- }
-
- // -----------------------------
- // Helper methods...
- // -----------------------------
- /**
- * <i>Helper method.</i><br>
- * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
- */
- public void setBusyCursor(boolean setBusy)
- {
- if (setBusy)
- {
- // Set the busy cursor to all shells.
- Display d = getShell().getDisplay();
- waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
- org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), waitCursor);
- }
- else
- {
- org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), null);
- if (waitCursor != null)
- waitCursor.dispose();
- waitCursor = null;
- }
- }
-
- /**
- * <i>Helper method.</i><br>
- * Add a separator line. This is a physically visible line.
- */
- protected Label addSeparatorLine(Composite parent, int nbrColumns)
- {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(data);
- return separator;
- }
- /**
- * <i>Helper method.</i><br>
- * Add a spacer line
- */
- protected Label addFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- filler.setLayoutData(data);
- return filler;
- }
-
- /**
- * Sets this control to grab any excess horizontal space
- * left in the window. This is useful to do in a property page
- * to force all the labels on the right to not be squished up on the left.
- *
- * @param control the control for which to grab excess space
- */
- protected Control grabExcessSpace(Control control)
- {
- GridData gd = (GridData) control.getLayoutData();
- if (gd != null)
- gd.grabExcessHorizontalSpace = true;
- return control;
- }
-
- /**
- * Create a labeled label, where the label on the right grabs excess space and has an indent so it
- * isn't smashed up against the prompt on the left.
- * @see SystemWidgetHelpers#createLabeledLabel(Composite, String, String, boolean)
- * @see #grabExcessSpace(Control)
- */
- protected Label createLabeledLabel(Composite c, String label, String tooltip)
- {
- Label l = SystemWidgetHelpers.createLabeledLabel(c, label, tooltip, false);
- GridData gd = (GridData)l.getLayoutData();
- if (gd != null)
- {
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalIndent = 10;
- }
- return l;
- }
- /**
- * Create a labeled combo, where the combo on the right grabs excess space and has an indent so it
- * isn't smashed up against the prompt on the left.
- * @see SystemWidgetHelpers#createLabeledCombo(Composite, Listener, String, String)
- * @see #grabExcessSpace(Control)
- */
- protected Combo createLabeledCombo(Composite c, String label, String tooltip)
- {
- Combo combo = SystemWidgetHelpers.createLabeledCombo(c, null, label, tooltip);
- GridData gd = (GridData)combo.getLayoutData();
- if (gd != null)
- {
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalIndent = 10;
- }
- return combo;
- }
- /**
- * Create a labeled entry field, where the field on the right grabs excess space and has an indent so it
- * isn't smashed up against the prompt on the left.
- * @see SystemWidgetHelpers#createLabeledTextField(Composite, Listener, String, String)
- * @see #grabExcessSpace(Control)
- */
- protected Text createLabeledText(Composite c, String label, String tooltip)
- {
- Text field = SystemWidgetHelpers.createLabeledTextField(c, null, label, tooltip);
- GridData gd = (GridData)field.getLayoutData();
- if (gd != null)
- {
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalIndent = 10;
- }
- return field;
- }
- /**
- * Create a labeled verbiage field, where the field on the right grabs excess space and has an indent so it
- * isn't smashed up against the prompt on the left.
- * @see SystemWidgetHelpers#createLabeledTextField(Composite, Listener, String, String)
- * @see #grabExcessSpace(Control)
- */
- protected Label createLabeledVerbiage(Composite c, String label, String tooltip)
- {
- Label verbiage = SystemWidgetHelpers.createLabeledVerbiage(c, label, tooltip, 1, false, 200);
- GridData gd = (GridData)verbiage.getLayoutData();
- if (gd != null)
- {
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalIndent = 10;
- }
- return verbiage;
- }
- // -----------------------------
- // ISystemMessageLine methods...
- // -----------------------------
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage()
- {
- if (msgLine!=null)
- msgLine.clearErrorMessage();
- else
- super.setErrorMessage(null);
- if (wantAutomaticValidManagement())
- setValid(true);
- }
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Clears the currently displayed message.
- */
- public void clearMessage()
- {
- if (msgLine!=null)
- msgLine.clearMessage();
- else
- super.setMessage(null);
- }
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage()
- {
- if (msgLine!=null)
- return msgLine.getSystemErrorMessage();
- else
- return null;
- }
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message)
- {
- super.setErrorMessage(message);
- if (wantAutomaticValidManagement())
- setValid(message == null);
- if (msgLine != null)
- ((SystemMessageLine)msgLine).setErrorMessage(message);
- }
-
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message)
- {
- if (msgLine!=null)
- msgLine.setErrorMessage(message);
- else
- super.setErrorMessage(message.getLevelOneText());
- if (wantAutomaticValidManagement())
- setValid(message == null);
- }
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Convenience method to set an error message from an exception
- */
- public void setErrorMessage(Throwable exc)
- {
- if (msgLine != null)
- msgLine.setErrorMessage(exc);
- }
-
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Set the error message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message)
- {
- if (msgLine!=null)
- msgLine.setMessage(message);
- else
- super.setMessage(message.getLevelOneText());
- }
- /**
- * <i>ISystemMessageLine method.</i><br>
- * Set the non-error message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message)
- {
- super.setMessage(message);
- if (msgLine!=null)
- ((SystemMessageLine)msgLine).setMessage(message);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java
deleted file mode 100644
index 023dcc2df..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemBooleanFieldEditor.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Thin subclass so we can support setToolTipText!!
- */
-public class SystemBooleanFieldEditor extends BooleanFieldEditor
-{
- private Button button;
- private String tip;
- private Composite parent;
-
- /**
- * Constructor for SystemBooleanFieldEditor
- */
- protected SystemBooleanFieldEditor()
- {
- super();
- }
-
- /**
- * Constructor for SystemBooleanFieldEditor
- * @param name the preference-store-key of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param style the style, either <code>DEFAULT</code> or
- * <code>SEPARATE_LABEL</code>
- * @param parent the parent of the field editor's control
- * @see #DEFAULT
- * @see #SEPARATE_LABEL
- */
- public SystemBooleanFieldEditor(String name, String labelText, int style, Composite parent)
- {
- super(name, labelText, style, parent);
- this.parent = parent;
- }
-
- /**
- * Constructor for SystemBooleanFieldEditor, using DEFAULT for the style
- * @param name the preference-store-key of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
- public SystemBooleanFieldEditor(String name, String labelText, Composite parent)
- {
- super(name, labelText, parent);
- this.parent = parent;
- }
- /**
- * Constructor for SystemBooleanFieldEditor, using DEFAULT for the style, and
- * specifying a resource bundle and key from which the label (_LABEL and
- * tooltip text (_TOOLTIP are retrieved.
- * @param name the preference-store-key of the preference this field editor works on
- * @param rb the ResourceBundle we will query the label and tooltip from
- * @param labelKey the resource bundle key from which we get the label (_LABEL and tooltip (_TOOLTIP
- * @param parent the parent of the field editor's control
- */
- public SystemBooleanFieldEditor(String name, ResourceBundle rb, String labelKey, Composite parent)
- {
- super(name, rb.getString(labelKey+"label"), parent); //$NON-NLS-1$
- setToolTipText(rb.getString(labelKey+"tooltip")); //$NON-NLS-1$
- this.parent = parent;
- }
-
- /**
- * Returns the change button for this field editor.
- * This is an override of our parent's method because this is the
- * only way for us to gain access to the checkbox so that we can
- * apply our tooltip text.
- */
- protected Button getChangeControl(Composite parent)
- {
- button = super.getChangeControl(parent);
- if (tip != null)
- button.setToolTipText(tip);
- return button;
- }
- /**
- * Set the tooltip text
- */
- public void setToolTipText(String tip)
- {
- if (button != null)
- button.setToolTipText(tip);
- this.tip = tip;
- }
- /**
- * Get the tooltip text
- */
- public String getToolTipText()
- {
- return tip;
- }
-
- /**
- * Set the help for the control
- */
- public void setHelp(String helpID)
- {
- if (button != null) {
- SystemWidgetHelpers.setHelp(button, helpID);
- }
- }
-
- /**
- * Method setEnabled
- * @param enablement state
- */
- public void setEnabled( boolean enablement )
- {
- getChangeControl(parent).setEnabled(enablement);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java
deleted file mode 100644
index 9928aee40..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemChangeFilterPropertyPage.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
- * David McKnight (IBM) - [252011] NPE On Promptable Filter's Filter Strings Property Page when Clicking Okay
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.SubSystemHelpers;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemPageCompleteListener;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.filters.ISystemChangeFilterPaneEditPaneSupplier;
-import org.eclipse.rse.ui.filters.SystemChangeFilterPane;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.view.SubSystemConfigurationAdapter;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This is the property page for changing filters. This page used to be the
- * Change dialog. The plugin.xml file registers this for objects of class
- * org.eclipse.rse.internal.filters.SystemFilter or
- * org.eclipse.rse.filters.SystemFilterReference.
- * <p>
- * If you have your own change filter dialog (versus configuring ours) you must
- * configure this pane yourself by overriding
- * {@link SubSystemConfigurationAdapter#customizeChangeFilterPropertyPage(ISubSystemConfiguration, SystemChangeFilterPropertyPage, ISystemFilter, Shell)}
- * and configuring the pane as described in that method's javadoc.
- */
-public class SystemChangeFilterPropertyPage extends SystemBasePropertyPage
- implements ISystemPageCompleteListener, ISystemChangeFilterPaneEditPaneSupplier
-{
-
- protected String errorMessage;
- protected boolean initDone = false;
-
- protected SystemChangeFilterPane changeFilterPane;
- protected SystemFilterStringEditPane editPane;
-
- /**
- * Constructor for SystemFilterPropertyPage
- */
- public SystemChangeFilterPropertyPage()
- {
- super();
- changeFilterPane = new SystemChangeFilterPane(null, this, this);
- changeFilterPane.addPageCompleteListener(this);
- setHelp(RSEUIPlugin.HELPPREFIX+"dufr0000"); //$NON-NLS-1$
- }
-
- // INPUT/CONFIGURATION
- /**
- * <i>Configuration method</i><br>
- * Specify an edit pane that prompts the user for the contents of a filter string.
- */
- public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
- {
- this.editPane = editPane;
- }
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool reference manager provider. Will be non-null if the
- * current selection is a reference to a filter pool or filter, or a reference manager
- * provider itself (eg subsystem)
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- changeFilterPane.setSystemFilterPoolReferenceManagerProvider(provider);
- }
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool manager provider. Will be non-null if the
- * current selection is a filter pool or filter or reference to either, or a manager
- * provider itself (eg subsystemconfiguration)
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
- {
- changeFilterPane.setSystemFilterPoolManagerProvider(provider);
- }
-
- /**
- * <i>Configuration method</i><br>
- * Set the Parent Filter Pool prompt label and tooltip text.
- */
- public void setParentPoolPromptLabel(String label, String tip)
- {
- changeFilterPane.setParentPoolPromptLabel(label, tip);
- }
- /**
- * <i>Configuration method</i><br>
- * Set the name prompt label and tooltip text.
- */
- public void setNamePromptLabel(String label, String tip)
- {
- changeFilterPane.setNamePromptLabel(label, tip);
- }
- /**
- * <i>Configuration method</i><br>
- * Set the label shown in group box around the filter string list, and the tooltip text for the
- * list box.
- */
- public void setListLabel(String label, String tip)
- {
- changeFilterPane.setListLabel(label, tip);
- }
- /**
- * Set the string to show as the first item in the list.
- * The default is "New filter string"
- */
- public void setNewListItemText(String label)
- {
- changeFilterPane.setNewListItemText(label);
- }
- /**
- * <i>Configuration method</i><br>
- * Call this to specify a validator for the filter string. It will be called per keystroke.
- * A default validator is supplied otherwise: ValidatorFilterString.
- * <p>
- * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
- * <p>
- * Alternatively, if all you want is a unique error message for the case when duplicates are found,
- * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
- */
- public void setFilterStringValidator(ISystemValidator v)
- {
- changeFilterPane.setFilterStringValidator(v);
- }
- /**
- * <i>Configuration method</i><br>
- * Set the error message to use when the user is editing or creating a filter string, and the
- * Apply processing detects a duplicate filter string in the list.
- */
- public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
- {
- changeFilterPane.setDuplicateFilterStringErrorMessage(msg);
- }
- /**
- * <i>Configuration method</i><br>
- * Specify if you want to include a test button or not. Appears with "Apply" and "Reset"
- */
- public void setWantTestButton(boolean wantTestButton)
- {
- changeFilterPane.setWantTestButton(wantTestButton);
- }
-
- /**
- * Set if the edit pane is not to be editable
- */
- public void setEditable(boolean editable)
- {
- changeFilterPane.setEditable(editable);
- }
-
- /**
- * Set if the user is to be allowed to create multiple filter strings or not. Default is true
- */
- public void setSupportsMultipleStrings(boolean multi)
- {
- changeFilterPane.setSupportsMultipleStrings(multi);
- }
-
- // OVERRIDABLE METHODS...
-
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- Shell shell = getShell();
- if (shell == null)
- {
- System.out.println("Damn, shell is still null!"); //$NON-NLS-1$
-
- }
- changeFilterPane.setShell(shell);
-
- ISystemFilter selectedFilter = getFilter();
- if (selectedFilter.isPromptable())
- {
- changeFilterPane.setEditable(false); // for bug 252011 - we don't verify promptable filters
- int nbrColumns = 1;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
- /*Label test =*/ SystemWidgetHelpers.createLabel(composite_prompts, SystemPropertyResources.RESID_TERM_NOTAPPLICABLE, nbrColumns, false);
- return composite_prompts;
- }
-
- if (getElement() instanceof ISystemFilterReference)
- {
- ISystemFilterReference filterRef = (ISystemFilterReference)getElement();
- changeFilterPane.setSystemFilterPoolReferenceManagerProvider(filterRef.getProvider());
- }
- changeFilterPane.setSystemFilterPoolManagerProvider(selectedFilter.getProvider());
-
- ISubSystemConfiguration ssf = SubSystemHelpers.getParentSubSystemConfiguration(selectedFilter);
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter == null) {
- // lazy loading: load adapter if necessary
- Platform.getAdapterManager().loadAdapter(ssf, ISubSystemConfigurationAdapter.class.getName());
- adapter = (ISubSystemConfigurationAdapter) ssf.getAdapter(ISubSystemConfigurationAdapter.class);
- }
- adapter.customizeChangeFilterPropertyPage(ssf, this, selectedFilter, shell);
-
- changeFilterPane.setInputObject(getElement());
-
- /*
- // ensure the page has no special buttons
- noDefaultAndApplyButton();
-
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- Label test = SystemWidgetHelpers.createLabel(composite_prompts, "Testing", nbrColumns);
-
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- */
- return changeFilterPane.createContents(parent);
- }
- /**
- * Intercept of parent so we can reset the default button
- */
- protected void contributeButtons(Composite parent)
- {
- super.contributeButtons(parent);
- getShell().setDefaultButton(changeFilterPane.getApplyButton()); // defect 46129
- }
-
- /**
- * Parent-required method.
- * Do full page validation.
- * Return true if ok, false if there is an error.
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Get the input filter object
- */
- protected ISystemFilter getFilter()
- {
- Object element = getElement();
- if (element instanceof ISystemFilter)
- return (ISystemFilter)element;
- else
- return ((ISystemFilterReference)element).getReferencedFilter();
- }
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk()
- {
- if (!super.performOk())
- return false;
- else
- return changeFilterPane.processOK();
- }
- /**
- * Called by parent when user presses Cancel
- */
- public boolean performCancel()
- {
- return changeFilterPane.processCancel();
- }
-
- /**
- * The comleteness of the page has changed.
- * This is a callback from SystemChangeFilterPane.
- */
- public void setPageComplete(boolean complete)
- {
- //super.setPageComplete(complete);
- super.setValid(complete); // we'll see if this is the right thing to do
- }
-
- /**
- * Return our edit pane. Overriding this is an alternative to calling setEditPane.
- * Method is declared in {@link ISystemChangeFilterPaneEditPaneSupplier}.
- */
- public SystemFilterStringEditPane getFilterStringEditPane(Shell shell)
- {
- // this method is called from SystemChangeFilterPane via callback
- if (editPane == null)
- editPane = new SystemFilterStringEditPane(shell);
- return editPane;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java
deleted file mode 100644
index 4915fb4c8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemComboBoxFieldEditor.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.rse.ui.ISystemMassager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-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.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Widget;
-
-
-/**
- * For string properties that have a discrete list of possibilities.
- */
-public class SystemComboBoxFieldEditor extends FieldEditor
-{
-
- private Combo textField;
- private String[] contentArray;
- private boolean contentInited = false;
- private boolean readOnly = true;
- private boolean isValid = true;
- private String tip;
- private SelectionListener selectionListener = null;
- private ModifyListener modifyListener = null;
- private boolean ignoreSelection = false;
- private ISystemValidator validator = null;
- private ISystemMassager massager = null;
- private Composite parentComposite;
- private String oldValue;
- private int numColumnsInParentComposite;
-
-
- /**
- * Constructor for SystemComboBoxFieldEditor
- */
- private SystemComboBoxFieldEditor()
- {
- super();
- }
-
- /**
- * Constructor for SystemComboBoxFieldEditor, using a Vector for the contents
- * @param name - the unique ID for this editor. Used as index in preference store
- * @param labelText - the label to show as the prompt preceding the dropdown
- * @param contents - the list of strings to show in the dropdown, as a vector
- * @param readOnly - true if the user is to be prevented from entering text into the combo
- * @param parent - the parent composite to host this editor
- */
- public SystemComboBoxFieldEditor(String name, String labelText, Vector contents, boolean readOnly, Composite parent)
- {
- super(name, labelText, parent);
- this.readOnly = readOnly;
- this.oldValue = ""; //$NON-NLS-1$
- contentArray = new String[contents.size()];
- for (int idx=0; idx<contentArray.length; idx++)
- contentArray[idx] = contents.elementAt(idx).toString();
- doOurFillIntoGrid();
- initContents();
- }
- /**
- * Constructor for SystemComboBoxFieldEditor, using an array for the contents
- * @param name - the unique ID for this editor. Used as index in preference store
- * @param labelText - the label to show as the prompt preceding the dropdown
- * @param contents - the list of strings to show in the dropdown, as an array
- * @param readOnly - true if the user is to be prevented from entering text into the combo
- * @param parent - the parent composite to host this editor
- */
- public SystemComboBoxFieldEditor(String name, String labelText, String[] contents, boolean readOnly, Composite parent)
- {
- super(name, labelText, parent);
- this.readOnly = readOnly;
- this.oldValue = ""; //$NON-NLS-1$
- contentArray = contents;
- doOurFillIntoGrid();
- initContents();
- }
- /**
- * Constructor for SystemComboBoxFieldEditor, using an array for the contents,
- * and specifying a resource bundle and key, from which we will retrieve the label
- * and the tooltip text
- * @param name - the unique ID for this editor. Used as index in preference store
- * @param rb - the resource bundle from which to retrieve the mri
- * @param rbKey - the key into the resource bundle, to get the label (+"label") and tooltip text (+"tooltip")
- * @param contents - the list of strings to show in the dropdown, as an array
- * @param readOnly - true if the user is to be prevented from entering text into the combo
- * @param parent - the parent composite to host this editor
- */
- public SystemComboBoxFieldEditor(String name, ResourceBundle rb, String rbKey, String[] contents, boolean readOnly, Composite parent)
- {
- super(name, rb.getString(rbKey+"label"), parent); //$NON-NLS-1$
- this.readOnly = readOnly;
- this.oldValue = ""; //$NON-NLS-1$
- contentArray = contents;
- doOurFillIntoGrid();
- setToolTipText(rb.getString(rbKey+"tooltip")); //$NON-NLS-1$
- initContents();
- }
-
- /**
- * If this combobox is editable, set the validator to use here per keystroke
- */
- public void setValidator(ISystemValidator validator)
- {
- this.validator = validator;
- if (textField != null)
- textField.setTextLimit(validator.getMaximumNameLength());
- }
-
- /**
- * Set the massager that is used to affect the user-entered text before
- * saving it to the preference store
- */
- public void setMassager(ISystemMassager massager)
- {
- this.massager = massager;
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls()
- {
- return 2;
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#doStore()
- */
- protected void doStore()
- {
- String text = textField.getText();
- if (massager != null)
- {
- text = massager.massage(text);
- ignoreSelection = true;
- textField.setText(text);
- ignoreSelection = false;
- }
-
- getPreferenceStore().setValue(getPreferenceName(), text);
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault()
- {
- if (textField != null)
- {
- String value = getPreferenceStore().getDefaultString(getPreferenceName());
- initSelection(value);
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#doLoad()
- */
- protected void doLoad()
- {
- if (textField != null)
- {
- String value = getPreferenceStore().getString(getPreferenceName());
- initSelection(value);
- }
- }
-
- private void initSelection(String value)
- {
- if (value != null)
- {
- ignoreSelection = true;
- textField.setText(value);
- oldValue = value;
- ignoreSelection = false;
- }
- else
- oldValue = ""; //$NON-NLS-1$
- }
-
- private void initContents()
- {
- if ((contentArray!=null) && (textField!=null) && !contentInited)
- {
- textField.setItems(contentArray);
- contentInited = true;
- }
- }
-
- /**
- * This is called by our parent's constructor, which is too soon for us!
- * So, we do nothing here and then call doOurFillIntoGrid later within our own
- * constructor.
- * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns)
- {
- parentComposite = parent;
- numColumnsInParentComposite = numColumns;
- }
- /**
- * Create controls
- */
- protected void doOurFillIntoGrid()
- {
- getLabelControl(parentComposite);
-
- textField = getTextControl(parentComposite);
- GridData gd = (GridData)textField.getLayoutData();
- gd.horizontalSpan = numColumnsInParentComposite - 1;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- textField.setLayoutData(gd);
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns)
- {
- GridData gd = (GridData)textField.getLayoutData();
- gd.horizontalSpan = numColumns - 1;
- // We only grab excess space if we have to
- // If another field editor has more columns then
- // we assume it is setting the width.
- gd.grabExcessHorizontalSpace = gd.horizontalSpan == 1;
- }
-
- /**
- * Returns this field editor's Combo control.
- */
- public Combo getTextControl()
- {
- return textField;
- }
-
- /**
- * Returns this field editor's text control.
- * <p>
- * The control is created if it does not yet exist
- * </p>
- *
- * @param parent the parent
- * @return the text control
- */
- public Combo getTextControl(Composite parent)
- {
- if (textField == null)
- {
- if (isReadOnly())
- textField = SystemWidgetHelpers.createReadonlyCombo(parent, null);
- else
- textField = SystemWidgetHelpers.createCombo(parent, null);
- if (tip != null)
- textField.setToolTipText(tip);
- initContents();
-
- textField.addSelectionListener(getSelectionListener());
- if (!isReadOnly())
- {
- textField.addModifyListener(getModifyListener());
- if (validator != null)
- textField.setTextLimit(validator.getMaximumNameLength());
-
- textField.addFocusListener(new FocusAdapter()
- {
- public void focusGained(FocusEvent e) {
- refreshValidState();
- }
- public void focusLost(FocusEvent e) {
- clearErrorMessage();
- }
- });
- }
-
- textField.addDisposeListener(new DisposeListener()
- {
- public void widgetDisposed(DisposeEvent event)
- {
- textField = null; // not sure why we have to do this
- }
- });
- } else {
- checkParent(textField, parent); // not sure what this is, came from some earlier eclipse example
- }
- return textField;
- }
-
- /**
- * Allows setting of tooltip text
- */
- public void setToolTipText(String tip)
- {
- if (textField != null)
- textField.setToolTipText(tip);
- this.tip = tip;
- }
-
- /**
- * Is this a readonly combo?
- */
- protected boolean isReadOnly()
- {
- return readOnly;
- }
-
- /**
- * Returns this field editor's selection listener.
- * The listener is created if nessessary.
- *
- * @return the selection listener
- */
- private SelectionListener getSelectionListener()
- {
- if (selectionListener == null)
- createSelectionListener();
- return selectionListener;
- }
-
- /**
- * Creates a selection listener.
- */
- protected void createSelectionListener()
- {
- selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- Widget widget = event.widget;
- if (widget == textField)
- selectionChanged();
- }
- };
- }
-
- /**
- * Combobox selection changed
- */
- protected void selectionChanged()
- {
- if (!ignoreSelection)
- setPresentsDefaultValue(false);
- ignoreSelection = false;
- }
-
- /**
- * Returns this field editor's selection listener.
- * The listener is created if nessessary.
- *
- * @return the selection listener
- */
- private ModifyListener getModifyListener()
- {
- if (modifyListener == null)
- createModifyListener();
- return modifyListener;
- }
-
- /**
- * Creates a modify text listener.
- * Ony used for non-readonly flavours
- */
- protected void createModifyListener()
- {
- modifyListener = new ModifyListener()
- {
- public void modifyText(ModifyEvent event)
- {
- Widget widget = event.widget;
- if ((widget == textField) && !ignoreSelection)
- valueChanged();
- }
- };
- }
-
- /**
- * Validate contents of combo field
- */
- protected void validate()
- {
- if (!ignoreSelection)
- {
- setPresentsDefaultValue(false);
- if (validator != null)
- {
- String errmsg = null;
- String value = textField.getText();
- if (!isSpecialValue(value))
- errmsg = validator.isValid(value);
- if (errmsg != null)
- showErrorMessage(errmsg);
- else
- clearErrorMessage();
- isValid = (errmsg == null);
- }
- }
- ignoreSelection = false;
- }
- /**
- * Test if current value is one of the special values
- */
- private boolean isSpecialValue(String input)
- {
- if (contentArray == null)
- return false;
- else
- {
- boolean match = false;
- for (int idx=0; !match && (idx<contentArray.length); idx++)
- if (input.equalsIgnoreCase(contentArray[idx]))
- match = true;
- return match;
- }
- }
-
- /**
- * Informs this field editor's listener, if it has one, about a change
- * to the value (<code>VALUE</code> property) provided that the old and
- * new values are different.
- * <p>
- * This hook is <em>not</em> called when the text is initialized
- * (or reset to the default value) from the preference store.
- * </p>
- */
- protected void valueChanged()
- {
- setPresentsDefaultValue(false);
- boolean oldState = isValid;
- refreshValidState();
-
- if (isValid != oldState)
- fireStateChanged(IS_VALID, oldState, isValid);
-
- String newValue = textField.getText();
- fireValueChanged(VALUE, oldValue, newValue);
- oldValue = newValue;
- }
-
- /**
- * Override of parent to return validity state.
- * If this readonly, we always return true, else we return result of last validation
- */
- public boolean isValid()
- {
- return isValid;
- }
-
- /**
- * Override of parent to refresh validity state by checking if the
- * input is valid. Does nothing unless this is not a readonly combo.
- */
- protected void refreshValidState()
- {
- isValid = true;
- if (!isReadOnly())
- {
- validate();
- }
- }
-
- /**
- * Set focus
- */
- public void setFocus()
- {
- if (textField!= null)
- textField.setFocus();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java
deleted file mode 100644
index 015f6ffa8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemFilterStringPropertyPage.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- *******************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import java.util.Arrays;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManagerProvider;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener;
-import org.eclipse.rse.ui.filters.SystemFilterStringEditPane;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorFilterString;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * The property page for filter string properties.
- * This is an output-only page.
- * The plugin.xml file registers this for objects of class org.eclipse.rse.internal.filters.SystemFilterString
- */
-public class SystemFilterStringPropertyPage extends SystemBasePropertyPage implements ISystemFilterStringEditPaneListener
-{
- //gui
- protected Label labelType, labelFilter, labelFilterPool, labelProfile;
- //protected Label labelString;
- //input
- protected SystemFilterStringEditPane editPane;
- protected ISystemValidator filterStringValidator;
- protected SystemMessage dupeFilterStringMessage;
- protected boolean editable = true;
- //state
- protected Composite composite_prompts;
- protected SystemMessage errorMessage;
- protected ResourceBundle rb;
- protected boolean initDone = false;
-
- /**
- * Constructor
- */
- public SystemFilterStringPropertyPage()
- {
- super();
- }
-
- // configuration methods, called by customizeFilterStringPropertyPage in SubSystemConfigurationImpl...
-
- /**
- * <i>Configuration method</i><br>
- * Specify an edit pane that prompts the user for the contents of a filter string.
- */
- public void setFilterStringEditPane(SystemFilterStringEditPane editPane)
- {
- this.editPane = editPane;
- }
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool reference manager provider. Will be non-null if the
- * current selection is a reference to a filter pool or filter, or a reference manager
- * provider itself (eg subsystem)
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolReferenceManagerProvider(ISystemFilterPoolReferenceManagerProvider provider)
- {
- editPane.setSystemFilterPoolReferenceManagerProvider(provider);
- }
- /**
- * <i>Configuration method</i><br>
- * Set the contextual system filter pool manager provider. Will be non-null if the
- * current selection is a filter pool or filter or reference to either, or a manager
- * provider itself (eg subsystemconfiguration)
- * <p>
- * This is passed into the filter and filter string wizards and dialogs in case it is needed
- * for context.
- */
- public void setSystemFilterPoolManagerProvider(ISystemFilterPoolManagerProvider provider)
- {
- editPane.setSystemFilterPoolManagerProvider(provider);
- }
- /**
- * <i>Configuration method</i><br>
- * Call this to specify a validator for the filter string. It will be called per keystroke.
- * A default validator is supplied otherwise: ValidatorFilterString.
- * <p>
- * Your validator should extend ValidatorFilterString to inherited the uniqueness error checking.
- * <p>
- * Alternatively, if all you want is a unique error message for the case when duplicates are found,
- * call setDuplicateFilterStringErrorMessage, and it will be used in the default validator.
- */
- public void setFilterStringValidator(ISystemValidator v)
- {
- filterStringValidator = v;
- }
- /**
- * <i>Configuration method</i><br>
- * Set the error message to use when the user is editing or creating a filter string, and the
- * Apply processing detects a duplicate filter string in the list.
- */
- public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
- {
- dupeFilterStringMessage = msg;
- }
- /**
- * Set if the edit pane is not to be editable
- */
- public void setEditable(boolean editable)
- {
- this.editable = editable;
- }
-
- // lifecyle methods...
-
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // Inner composite
- composite_prompts = SystemWidgetHelpers.createComposite(parent, 2);
-
- // Type display
- labelType = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_PROPERTIES_TYPE_LABEL, SystemResources.RESID_PP_PROPERTIES_TYPE_TOOLTIP);
- labelType.setText(SystemResources.RESID_PP_FILTERSTRING_TYPE_VALUE);
-
- // String display
- //labelString = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_STRING_ROOT);
-
- // Parent Filter display
- labelFilter = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_FILTER_LABEL, SystemResources.RESID_PP_FILTERSTRING_FILTER_TOOLTIP);
-
- // Parent Filter Pool display
- labelFilterPool = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_FILTERPOOL_LABEL, SystemResources.RESID_PP_FILTERSTRING_FILTERPOOL_TOOLTIP);
-
- // Parent Profile display
- labelProfile = createLabeledLabel(composite_prompts, SystemResources.RESID_PP_FILTERSTRING_PROFILE_LABEL, SystemResources.RESID_PP_FILTERSTRING_PROFILE_TOOLTIP);
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- }
- /**
- * From parent: do full page validation
- */
- protected boolean verifyPageContents()
- {
- boolean ok = false;
- clearErrorMessage();
- errorMessage = editPane.verify();
- if (errorMessage == null)
- {
- ok = true;
- String editedFilterString = editPane.getFilterString();
- if (filterStringValidator != null)
- {
- errorMessage = filterStringValidator.validate(editedFilterString);
- }
- }
- if (errorMessage != null)
- {
- ok = false;
- setErrorMessage(errorMessage);
- }
- //System.out.println("Inside verifyPageContents. errorMessage = "+errorMessage);
- return ok;
- }
-
- /**
- * Get the input filter string object
- */
- protected ISystemFilterString getFilterString()
- {
- Object element = getElement();
- return ((ISystemFilterString)element);
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISystemFilterString filterstring = getFilterString();
- ISystemFilter filter = filterstring.getParentSystemFilter();
- // string
- //labelString.setText(filterstring.getString());
- // filter
- labelFilter.setText(filter.getName());
- // pool
- ISystemFilterPool pool = filter.getParentFilterPool();
- labelFilterPool.setText(pool.getName());
- // profile
- ISubSystemConfiguration ssFactory = (ISubSystemConfiguration)(pool.getProvider());
- String profileName = ssFactory.getSystemProfile(pool).getName();
- labelProfile.setText( profileName );
-
- // edit pane
- ISubSystemConfiguration factory = (ISubSystemConfiguration)filter.getProvider();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class);
- adapter.customizeFilterStringPropertyPage(factory, this, filterstring, getShell());
- if (editPane == null)
- {
- Shell shell = getShell();
- //System.out.println("Shell is: "+shell);
- editPane = new SystemFilterStringEditPane(shell);
- }
- editPane.setSystemFilterPoolManagerProvider(filter.getProvider());
- editPane.setChangeFilterMode(true);
- editPane.addChangeListener(this);
- Control editPaneComposite = editPane.createContents(composite_prompts);
- ((GridData)editPaneComposite.getLayoutData()).horizontalSpan = 2;
-
- editPane.setFilterString(filterstring.getString(), 0);
- if (!editable || filter.isNonChangable())
- editPaneComposite.setEnabled(false);
- else if (filterStringValidator == null)
- {
- String[] filterStrings = filter.getFilterStrings();
- Vector existingStrings = new Vector(filterStrings.length);
- existingStrings.addAll(Arrays.asList(filterStrings));
- existingStrings.remove(filterstring);
- filterStringValidator = new ValidatorFilterString(existingStrings, filter.isStringsCaseSensitive());
- if (dupeFilterStringMessage != null)
- ((ValidatorFilterString)filterStringValidator).setDuplicateFilterStringErrorMessage(dupeFilterStringMessage);
- }
- }
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk()
- {
- boolean ok = super.performOk();
- if (!ok)
- return false;
- ISystemFilterString filterstring = getFilterString();
- ISystemFilter filter = filterstring.getParentSystemFilter();
- ISystemFilterPool pool = filter.getParentFilterPool(); // recurses for nested filter
- ISystemFilterPoolManager mgr = pool.getSystemFilterPoolManager();
- try
- {
- mgr.updateSystemFilterString(filterstring, editPane.getFilterString());
- }
- catch (SystemMessageException e)
- {
- SystemBasePlugin.logError("Error updating filter string from property page", e); //$NON-NLS-1$
- e.printStackTrace();
- SystemMessageDialog.displayMessage(getShell(), e);
- ok = false;
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError("Error updating filter string from property page", e); //$NON-NLS-1$
- e.printStackTrace();
- SystemMessageDialog.displayExceptionMessage(getShell(), e);
- ok = false;
- }
-
- /*
- String[] listItems = listView.getItems();
- String[] filterStrings = new String[listItems.length - 1];
- for (int idx=0; idx<filterStrings.length; idx++)
- filterStrings[idx] = listItems[idx+1];
- try {
- mgr.updateSystemFilter(inputFilter, inputFilter.getName(), filterStrings);
- }
- catch (SystemMessageException exc)
- {
- getMessageLine().setErrorMessage(exc.getSystemMessage());
- return false;
- }
- catch (Exception exc)
- {
- //displayErrorMessage("Error updating filter: " + exc.getMessage());
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_UPDATEFILTER_FAILED);
- String excText = exc.getMessage();
- if (excText == null)
- excText = exc.getClass().getName();
- msg.makeSubstitution(excText,exc);
- getMessageLine().setErrorMessage(msg);
- return false;
- }*/
- return ok;
- }
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener#filterStringChanged(org.eclipse.rse.core.ui.messages.SystemMessage)
- */
- public void filterStringChanged(SystemMessage message)
- {
- if (message == null)
- clearErrorMessage();
- else
- setErrorMessage(message);
- }
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener#backupChangedState()
- */
- public void backupChangedState()
- {
- }
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.filters.ISystemFilterStringEditPaneListener#restoreChangedState()
- */
- public void restoreChangedState()
- {
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemIntegerFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemIntegerFieldEditor.java
deleted file mode 100644
index 04fda078f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemIntegerFieldEditor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * A version of an IntegerFieldEditor which allows setting tooltip and help
- * If value is outside of valid range, message will tell user what the valid range is
- */
-public class SystemIntegerFieldEditor extends IntegerFieldEditor {
-
- public static final String Copyright = "(C) Copyright IBM Corp. 2003 All Rights Reserved."; //$NON-NLS-1$
-
-
- /**
- * the message for an empty field
- */
- private static final String RANGE_MESSAGE = "RSEG0402"; //$NON-NLS-1$
-
- protected Composite composite_parent = null;
-
- /**
- * @see java.lang.Object#Object()
- */
- public SystemIntegerFieldEditor() {
- super();
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#FieldEditor(String, String, Composite)
- */
- public SystemIntegerFieldEditor(
- String name,
- String labelText,
- Composite parent) {
- super(name, labelText, parent);
- composite_parent = parent;
- }
-
- /**
- * @see org.eclipse.jface.preference.IntegerFieldEditor#setValidRange(int, int)
- */
- public void setValidRange(int min,int max) {
- super.setValidRange(min, max);
- SystemMessage msg = RSEUIPlugin.getPluginMessage(RANGE_MESSAGE);
- setErrorMessage(msg.makeSubstitution(getLabelControl().getText(), new Integer(min), new Integer(max)).getLevelOneText());
- }
-
- /**
- * Method setHelp.
- * Sets the info pop help for this field editor
- * @param contextId the context ID for the help
- */
- public void setHelp(String contextId) {
- SystemWidgetHelpers.setHelp(getTextControl(), contextId);
- }
-
- /**
- * Method setToolTipText.
- * The tooltip text
- * @param tip the tip to set for the entry field
- */
- public void setToolTipText(String tip) {
- getTextControl().setToolTipText(tip);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#setEnabled(boolean, org.eclipse.swt.widgets.Composite)
- */
- public void setEnabled(boolean enabled)
- {
- super.setEnabled(enabled, composite_parent);
- }
-
- /* (non-Javadoc)
- * Method declared on FieldEditor.
- */
- public void refreshValidState() {
- super.refreshValidState();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemKeyValueFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemKeyValueFieldEditor.java
deleted file mode 100644
index ee585ef6e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemKeyValueFieldEditor.java
+++ /dev/null
@@ -1,641 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorSpecialChar;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-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.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-
-
-/**
- * For string key,value pair properties that have a discrete list of key values.
- * Used in preference pages.
- */
-public class SystemKeyValueFieldEditor extends FieldEditor
-{
- private List keysField;
- private Text valueField;
- private Label keysLabel, valueLabel;
- private Composite keysComposite, valueComposite;
- private Group boxComposite;
- private Button setButton, clearButton;
- private String keysLabelString, valueLabelString;
- private char keyValueDelimiter='=';
- private char keyValuePairDelimiter=';';
- private SystemMessage errorMessage;
- private boolean contentInited;
- protected ISystemValidator valueValidator, defaultValueValidator;
- private String[] contentArray;
- private Hashtable keyValues;
- private SelectionListener selectionListener;
-
- private static boolean boxFlavor = true;
-
- /**
- * Constructor
- */
- private SystemKeyValueFieldEditor()
- {
- super();
- }
-
- /**
- * Constructor
- */
- public SystemKeyValueFieldEditor(String name, String labelText, String[] keys,
- String keysLabelString, String valueLabelString, Composite parent)
- {
- super(name, labelText, parent);
- keyValues = new Hashtable();
- contentArray = keys;
- this.keysLabelString = keysLabelString;
- this.valueLabelString = valueLabelString;
- // the ctor's call to super causes the controls to be created before this
- // instance data is accessible, so we do it now...
- keysLabel.setText(keysLabelString);
- valueLabel.setText(valueLabelString);
- //if (boxFlavor)
- // boxComposite.setText(labelText);
- initContents();
-
- String specialChars = makeString(keyValueDelimiter,keyValuePairDelimiter);
- defaultValueValidator = new ValidatorSpecialChar(specialChars, ValidatorSpecialChar.EMPTY_ALLOWED_YES);
- }
-
- /**
- * Call this to specify a validator for the value entry field. It will be called per keystroke.
- * By default we just check against the special characters used to delimit the key and value (=)
- * and to delimiter each key/value pair (;)
- */
- public void setValueValidator(ISystemValidator v)
- {
- valueValidator = v;
- }
- /**
- * Call this to set the characters used to delimit the strings in the preferences store
- * @param keyValueDelimiter The char to distinguish between key and value. Default is =
- * @param keyValuePairDelimiter The char to distinguish between each key/value pair. Default is ;
- */
- public void setDelimiterCharacters(char keyValueDelimiter, char keyValuePairDelimiter)
- {
- this.keyValueDelimiter = keyValueDelimiter;
- this.keyValuePairDelimiter = keyValuePairDelimiter;
- String specialChars = makeString(keyValueDelimiter,keyValuePairDelimiter);
- defaultValueValidator = new ValidatorSpecialChar(specialChars, ValidatorSpecialChar.EMPTY_ALLOWED_YES);
- }
-
- /**
- * @see FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls()
- {
- return boxFlavor ? 1 : 2;
- }
-
- /**
- * @see FieldEditor#doStore()
- */
- protected void doStore()
- {
- String s = createString(keyValues);
- if (s != null)
- getPreferenceStore().setValue(getPreferenceName(), s);
- }
-
- /**
- * @see FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault()
- {
- if (keysField != null)
- {
- String value = getPreferenceStore().getDefaultString(getPreferenceName());
- if (value != null)
- keyValues = parseString(value);
- else
- keyValues = new Hashtable();
- valueField.setText(""); //$NON-NLS-1$
- keysField.select(0);
- clearButton.setEnabled(false);
- setButton.setEnabled(false);
- //selectionChanged();
- }
- }
-
- /**
- * @see FieldEditor#doLoad()
- */
- protected void doLoad()
- {
- //if (keysField != null)
- //{
- String value = getPreferenceStore().getString(getPreferenceName());
- if ((value == null) || (value.length()==0))
- value = getPreferenceStore().getDefaultString(getPreferenceName());
- if (value != null)
- keyValues = parseString(value);
- if (keysField != null)
- {
- keysField.select(0);
- selectionChanged();
- }
- //}
- }
-
- /**
- * Parse out list of key-value pairs into a hashtable
- */
- public Hashtable parseString(String allvalues)
- {
- StringTokenizer tokens = new StringTokenizer(allvalues, makeString(keyValueDelimiter, keyValuePairDelimiter));
- Hashtable keyValues = new Hashtable(10);
- int count = 0;
- String token1=null;
- String token2=null;
- while (tokens.hasMoreTokens())
- {
- count++;
- if ((count % 2) == 0) // even number
- {
- token2 = tokens.nextToken();
- keyValues.put(token1, token2);
- }
- else
- token1 = tokens.nextToken();
- }
- return keyValues;
- }
- /**
- * Convert hashtable of key-value pairs into a single string
- */
- protected String createString(Hashtable keyValues)
- {
- Enumeration keys = keyValues.keys();
- StringBuffer sb = new StringBuffer();
- while (keys.hasMoreElements())
- {
- String key = (String)keys.nextElement();
- String value = (String)keyValues.get(key);
- if ((value != null) && (value.length()>0))
- {
- sb.append(key);
- sb.append(keyValueDelimiter);
- sb.append(value);
- sb.append(keyValuePairDelimiter);
- }
- }
- //System.out.println("Pref String: " + sb);
- return sb.toString();
- }
-
-
- private String makeString(char charOne, char charTwo)
- {
- StringBuffer s = new StringBuffer(2);
- s.append(charOne);
- s.append(charTwo);
- return s.toString();
- }
-
- private void initContents()
- {
- if ((contentArray!=null) && (keysField!=null) && !contentInited)
- {
- keysField.setItems(contentArray);
- contentInited = true;
- }
- }
-
- /**
- * @see FieldEditor#doFillIntoGrid(Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns)
- {
- GridData gd = null;
- // label goes all the way across top
- if (!boxFlavor)
- {
- Control control = getLabelControl(parent);
- if (control!=null)
- {
- gd = new GridData();
- gd.horizontalSpan = numColumns;
- control.setLayoutData(gd);
- }
- }
-
-boxComposite = SystemWidgetHelpers.createGroupComposite(parent, 2, getLabelText());
- ((GridData)boxComposite.getLayoutData()).horizontalSpan = numColumns;
-// parentComposite = boxComposite;
-// numparentcols = 2;
-
- // under the label we place a labeled combo box, and so on
- keysComposite = getKeysControl(boxComposite);
-// gd = new GridData();
-// gd.horizontalAlignment = GridData.FILL;
-// gd.grabExcessHorizontalSpace = true;
-// gd = new GridData(GridData.FILL_BOTH); //dwd
-// keysComposite.setLayoutData(gd);
-
- valueComposite = getValueControl(boxComposite);
-// gd = new GridData();
-// gd.horizontalSpan = numparentcols - 1;
-// gd.horizontalAlignment = GridData.FILL;
-// gd.grabExcessHorizontalSpace = true;
-// gd = new GridData(GridData.FILL_BOTH); //dwd
-// keysComposite.setLayoutData(gd);
-
- }
-
-
- /**
- * @see FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns)
- {
- Control control = getLabelControl();
- if (control != null)
- ((GridData)control.getLayoutData()).horizontalSpan = numColumns;
- if (boxComposite != null)
- ((GridData)boxComposite.getLayoutData()).horizontalSpan = numColumns;
- }
-
-
-
- /**
- * Returns this field editor's List control for the keys.
- */
- protected List getKeysControl()
- {
- return keysField;
- }
- /**
- * Returns this field editor's Text control for the key value.
- */
- protected Text getValueControl()
- {
- return valueField;
- }
-
-
- /**
- * Returns this field editor's text control.
- * <p>
- * The control is created if it does not yet exist
- * </p>
- *
- * @param parent the parent
- * @return the text control
- */
- public Composite getKeysControl(Composite parent)
- {
- if (keysComposite == null)
- {
- // create composite
- keysComposite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- keysComposite.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH); // dwd was FILL_HORIZONTAL
- data.heightHint = 150; // dwd was 100
- keysComposite.setLayoutData(data);
- // populate with label
- keysLabel = new Label(keysComposite, SWT.NULL);
- if (keysLabelString != null)
- keysLabel.setText(keysLabelString);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 150;
- keysLabel.setLayoutData(data);
- // populate with list
- int options = SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL;
- keysField = new List(keysComposite, options);
- data = new GridData(GridData.FILL_BOTH); // dwd was FILL_HORIZONTAL
- data.widthHint = 150;
- keysField.setLayoutData(data);
- keysField.addSelectionListener(getSelectionListener());
-
- keysComposite.addDisposeListener(new DisposeListener()
- {
- public void widgetDisposed(DisposeEvent event)
- {
- keysComposite = null;
- keysField = null;
- keysLabel = null;
- }
- });
- }
- // else
- // {
- // checkParent(keysComposite, parent);
- // }
- return keysComposite;
- }
-
- /**
- * Returns this field editor's value entry field control.
- *
- * @param parent the parent control
- * @return the list control
- */
- public Composite getValueControl(Composite parent)
- {
- if (valueComposite == null)
- {
- // create composite
- valueComposite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- valueComposite.setLayout(layout);
- //GridData data = new GridData(GridData.FILL_HORIZONTAL);
- // DKM: not filling vertical causes trucations on linux
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 150; // dwd was 100
- valueComposite.setLayoutData(data);
- // populate with label
- valueLabel = new Label(valueComposite, SWT.NULL);
- if (valueLabelString != null)
- valueLabel.setText(valueLabelString);
- data = new GridData(GridData.FILL_HORIZONTAL);
- valueLabel.setLayoutData(data);
- // populate with entry field
- valueField = new Text(valueComposite, SWT.BORDER | SWT.SINGLE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = 150;
- valueField.setLayoutData(data);
- // populate with button
- setButton = createPushButton(valueComposite, SystemResources.ACTION_SET_LABEL, SystemResources.ACTION_SET_TOOLTIP);
- clearButton = createPushButton(valueComposite, SystemResources.ACTION_CLEAR_LABEL, SystemResources.ACTION_CLEAR_TOOLTIP);
-
- // add keystroke listener...
- valueField.addModifyListener(
- new ModifyListener()
- {
- public void modifyText(ModifyEvent e)
- {
- validateValueInput();
- }
- }
- );
- // add dispose listener
- valueComposite.addDisposeListener(new DisposeListener()
- {
- public void widgetDisposed(DisposeEvent event)
- {
- valueComposite = null;
- valueField = null;
- valueLabel = null;
- setButton = null;
- }
- });
- }
- // else
- // {
- // checkParent(valueComposite, parent);
- // }
- return valueComposite;
- }
-
- /**
- * Helper method to create a push button.
- *
- * @param parent the parent control
- * @param label
- * @param tooltip
- */
- private Button createPushButton(Composite parent, String label, String tooltip)
- {
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- button.setToolTipText(tooltip);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(data);
- button.addSelectionListener(getSelectionListener());
- return button;
- }
-
- /**
- * Returns this field editor's selection listener.
- * The listener is created if nessessary.
- *
- * @return the selection listener
- */
- private SelectionListener getSelectionListener()
- {
- if (selectionListener == null)
- createSelectionListener();
- return selectionListener;
- }
-
- /**
- * Creates a selection listener.
- */
- public void createSelectionListener()
- {
- selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- Widget widget = event.widget;
- if (widget == setButton)
- setPressed();
- else if (widget == clearButton)
- clearPressed();
- else if (widget == keysField)
- selectionChanged();
- }
- };
- }
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the PreferencePage's message line.
- * @see #setValueValidator(ISystemValidator)
- */
- protected SystemMessage validateValueInput()
- {
- errorMessage= null;
- String valueInput = valueField.getText().trim();
- if (valueValidator != null)
- errorMessage = valueValidator.validate(valueInput);
- else if (defaultValueValidator != null)
- errorMessage = defaultValueValidator.validate(valueInput);
- if (errorMessage != null)
- showErrorMessage(errorMessage.getLevelOneText());
- else
- clearErrorMessage();
- setButton.setEnabled((errorMessage == null) && (valueInput.length()>0));
- //clearButton.setEnabled(true);
- return errorMessage;
- }
-
- /**
- * Notifies that the Set button has been pressed.
- */
- private void setPressed()
- {
- setPresentsDefaultValue(false);
- int index = keysField.getSelectionIndex();
- if (index >= 0)
- {
- String value = valueField.getText().trim();
- valueField.setText(value);
- if (value.length() == 0)
- keyValues.remove(contentArray[index]);
- else
- keyValues.put(contentArray[index],value);
- selectionChanged();
- }
- else
- setButton.setEnabled(false);
- }
-
- /**
- * Notifies that the Clear button has been pressed.
- */
- private void clearPressed()
- {
- setPresentsDefaultValue(false);
- int index = keysField.getSelectionIndex();
- if (index >= 0)
- {
- //valueField.setText("");
- keyValues.remove(contentArray[index]);
- selectionChanged();
- }
- else
- clearButton.setEnabled(false);
- }
- /**
- * Notifies that the list selection has changed.
- */
- private void selectionChanged()
- {
- int index = keysField.getSelectionIndex();
- if (index >= 0)
- {
- String key = contentArray[index];
- String value = (String)keyValues.get(key);
- if (value == null)
- {
- valueField.setText(""); //$NON-NLS-1$
- clearButton.setEnabled(false);
- }
- else
- {
- valueField.setText(value);
- clearButton.setEnabled(true);
- }
- }
- else
- {
- clearButton.setEnabled(false);
- }
- setButton.setEnabled(false);
- }
-
- /**
- * Change the height hint for this composite.
- * Default is 100 pixels.
- */
- public void setHeightHint(int hint)
- {
- if (keysComposite != null)
- ((GridData)keysComposite.getLayoutData()).heightHint = hint;
- if (valueComposite != null)
- ((GridData)valueComposite.getLayoutData()).heightHint = hint;
-
- }
- /**
- * Change the width hint for the keys list
- * Default is 150 pixels.
- */
- public void setKeysWidthHint(int hint)
- {
- if (keysComposite != null)
- ((GridData)keysComposite.getLayoutData()).widthHint = hint;
- }
- /**
- * Change the width hint for the values fields on the right
- * Default is not set
- */
- public void setValuesWidthHint(int hint)
- {
- if (valueComposite != null)
- ((GridData)valueComposite.getLayoutData()).widthHint = hint;
- }
-
- /**
- * Set the tooltip text
- */
- public void setToolTipText(String tip)
- {
- if (boxFlavor)
- boxComposite.setToolTipText(tip);
- else
- {
- keysComposite.setToolTipText(tip);
- valueComposite.setToolTipText(tip);
- }
- }
- /**
- * Get the tooltip text
- */
- public String getToolTipText()
- {
- if (boxFlavor)
- return boxComposite.getToolTipText();
- else
- return keysComposite.getToolTipText();
- }
-
- /*
- * Override to return null!
- *
- public Label getLabelControl(Composite parent)
- {
- System.out.println("Inside getLabelControl");
- return super.getLabelControl(parent);
- }*/
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java
deleted file mode 100644
index 121eae632..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemStringFieldEditor.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.rse.ui.ISystemMassager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-
-
-/**
- * A preference page field editor that prompts for a string.
- * Unlike the eclipse-supplied StringFieldEditor, this one allows
- * use of RSE validators and massagers for error checking and
- * massaging of the user-entered input prior to persisting.
- */
-public class SystemStringFieldEditor extends FieldEditor
-{
-
- private Text textField;
- private String tip;
- private boolean isValid = true;
- private ModifyListener modifyListener = null;
- private boolean ignoreSelection = false;
- private ISystemValidator validator = null;
- private ISystemMassager massager = null;
- private Composite parentComposite;
- private String oldValue;
- private int numColumnsInParentComposite;
-
-
- /**
- * Default constructor for SystemStringFieldEditor.
- * Not permitted to be used.
- */
- private SystemStringFieldEditor()
- {
- super();
- }
-
- /**
- * Constructor for SystemStringFieldEditor
- * @param name - the unique ID for this editor. Used as index in preference store
- * @param rb - the resource bundle from which to retrieve the mri
- * @param rbKey - the key into the resource bundle, to get the label (_LABEL and tooltip text (_TOOLTIP
- * @param parent - the parent composite to host this editor
- */
- public SystemStringFieldEditor(String name, ResourceBundle rb, String rbKey, Composite parent)
- {
- super(name, rb.getString(rbKey+"label"), parent); //$NON-NLS-1$
- this.oldValue = ""; //$NON-NLS-1$
- //createControl(parent);
- doOurFillIntoGrid();
- setToolTipText(rb.getString(rbKey+"tooltip")); //$NON-NLS-1$
- }
-
- /**
- * Set the validator to use per keystroke. If not set, no validation is done
- */
- public void setValidator(ISystemValidator validator)
- {
- this.validator = validator;
- if (textField != null)
- textField.setTextLimit(validator.getMaximumNameLength());
- }
-
- /**
- * Set the massager that is used to affect the user-entered text before
- * saving it to the preference store.
- */
- public void setMassager(ISystemMassager massager)
- {
- this.massager = massager;
- }
-
- /**
- * Return number of columns we need. We return 2.
- * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls()
- {
- return 2;
- }
-
- /**
- * Save the user-entered value to the preference store.
- * @see org.eclipse.jface.preference.FieldEditor#doStore()
- */
- protected void doStore()
- {
- String text = textField.getText();
- if (massager != null)
- {
- text = massager.massage(text);
- ignoreSelection = true;
- textField.setText(text);
- ignoreSelection = false;
- }
- getPreferenceStore().setValue(getPreferenceName(), text);
- }
-
- /**
- * Load the entry field contents from the preference store default value
- * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault()
- {
- if (textField != null)
- {
- String value = getPreferenceStore().getDefaultString(getPreferenceName());
- initSelection(value);
- }
- }
-
- /**
- * Load the entry field contents from the preference store current value
- * @see org.eclipse.jface.preference.FieldEditor#doLoad()
- */
- protected void doLoad()
- {
- if (textField != null)
- {
- String value = getPreferenceStore().getString(getPreferenceName());
- initSelection(value);
- }
- }
-
- private void initSelection(String value)
- {
- if (value != null)
- {
- ignoreSelection = true;
- textField.setText(value);
- oldValue = value;
- ignoreSelection = false;
- }
- else
- oldValue = ""; //$NON-NLS-1$
- }
-
- /**
- * This is called by our parent's constructor, which is too soon for us!
- * So, we do nothing here and then call doOurFillIntoGrid later within our own
- * constructor.
- * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns)
- {
- parentComposite = parent;
- numColumnsInParentComposite = numColumns;
- }
-
- /**
- * Create controls
- */
- protected void doOurFillIntoGrid()
- {
- getLabelControl(parentComposite);
-
- textField = getTextControl(parentComposite);
- GridData gd = (GridData)textField.getLayoutData();
- gd.horizontalSpan = numColumnsInParentComposite - 1;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- textField.setLayoutData(gd);
- }
-
- /**
- * Adjust grid data to support the number of columns, after all field editors
- * have been added to the page.
- *
- * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns)
- {
- GridData gd = (GridData)textField.getLayoutData();
- gd.horizontalSpan = numColumns - 1;
- // We only grab excess space if we have to
- // If another field editor has more columns then
- // we assume it is setting the width.
- gd.grabExcessHorizontalSpace = gd.horizontalSpan == 1;
- }
-
- /**
- * Returns this field editor's Text control.
- */
- protected Text getTextControl()
- {
- return textField;
- }
-
- /**
- * Returns this field editor's text control.
- * <p>
- * The control is created if it does not yet exist
- * </p>
- *
- * @param parent the parent
- * @return the text control
- */
- public Text getTextControl(Composite parent)
- {
- if (textField == null)
- {
- textField = SystemWidgetHelpers.createTextField(parent, null);
- if (tip != null)
- textField.setToolTipText(tip);
-
- textField.addModifyListener(getModifyListener());
- if (validator != null)
- textField.setTextLimit(validator.getMaximumNameLength());
-
- textField.addFocusListener(new FocusAdapter()
- {
- public void focusGained(FocusEvent e) {
- refreshValidState();
- }
- public void focusLost(FocusEvent e) {
- clearErrorMessage();
- }
- });
-
- textField.addDisposeListener(new DisposeListener()
- {
- public void widgetDisposed(DisposeEvent event)
- {
- textField = null; // not sure why we have to do this
- }
- });
- } else {
- checkParent(textField, parent); // not sure what this is, came from some earlier eclipse example
- }
- return textField;
- }
-
- /**
- * Allows setting of tooltip text
- */
- public void setToolTipText(String tip)
- {
- if (textField != null)
- textField.setToolTipText(tip);
- this.tip = tip;
- }
-
- /**
- * Returns this field editor's selection listener.
- * The listener is created if nessessary.
- *
- * @return the selection listener
- */
- private ModifyListener getModifyListener()
- {
- if (modifyListener == null)
- createModifyListener();
- return modifyListener;
- }
-
- /**
- * Creates a modify text listener used in per-keystroke validation
- */
- protected void createModifyListener()
- {
- modifyListener = new ModifyListener()
- {
- public void modifyText(ModifyEvent event)
- {
- Widget widget = event.widget;
- if (widget == textField)
- valueChanged();
- }
- };
- }
-
- /**
- * Validate contents of text field
- */
- protected void validate()
- {
- if (!ignoreSelection)
- {
- setPresentsDefaultValue(false);
- if (validator != null)
- {
- String value = textField.getText();
- String errmsg = validator.isValid(value);
- if (errmsg != null)
- showErrorMessage(errmsg);
- else
- clearErrorMessage();
- isValid = (errmsg == null);
- }
- }
- ignoreSelection = false;
- }
-
- /**
- * Informs this field editor's listener, if it has one, about a change
- * to the value (<code>VALUE</code> property) provided that the old and
- * new values are different.
- * <p>
- * This hook is <em>not</em> called when the text is initialized
- * (or reset to the default value) from the preference store.
- * </p>
- */
- protected void valueChanged()
- {
- setPresentsDefaultValue(false);
- boolean oldState = isValid;
- refreshValidState();
-
- if (isValid != oldState)
- fireStateChanged(IS_VALID, oldState, isValid);
-
- String newValue = textField.getText();
- fireValueChanged(VALUE, oldValue, newValue);
- oldValue = newValue;
- }
-
- /**
- * Override of parent to return validity state.
- * If this readonly, we always return true, else we return result of last validation
- */
- public boolean isValid()
- {
- return isValid;
- }
-
- /**
- * Override of parent to refresh validity state by checking if the
- * input is valid. Does nothing unless this is not a readonly combo.
- */
- protected void refreshValidState()
- {
- validate();
- }
-
- /**
- * Set focus
- */
- public void setFocus()
- {
- if (textField!= null)
- textField.setFocus();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCore.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCore.java
deleted file mode 100644
index 830cac5d1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCore.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * The property page for core subsystem properties.
- * The plugin.xml file registers this for objects of class org.eclipse.rse.internal.subsystems.SubSystem
- */
-public class SystemSubSystemPropertyPageCore extends SystemBasePropertyPage
- implements ISystemMessageLine//, ISystemMessageLineTarget
-{
-
- private ISystemSubSystemPropertyPageCoreForm form = null;
-
- /**
- * Constructor
- */
- public SystemSubSystemPropertyPageCore()
- {
- super();
-
- }
- /**
- * Create the page's GUI contents.
- */
- protected Control createContentArea(Composite parent)
- {
- Object element = getElement();
- if (element instanceof ISubSystem)
- {
- ISubSystemConfiguration factory = ((ISubSystem)element).getSubSystemConfiguration();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factory.getAdapter(ISubSystemConfigurationAdapter.class);
- form = adapter.getSubSystemPropertyPageCoreFrom(factory, this, this);
- }
- else
- {
- form = new SystemSubSystemPropertyPageCoreForm(this, this);
- }
- Control c = form.createContents(parent, getElement(), getShell());
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "psubs0000"); //$NON-NLS-1$
- return c;
- }
-
- /**
- * Called by parent when user presses OK
- */
- public boolean performOk()
- {
- if (super.performOk())
- return form.performOk();
- else
- return false;
- }
- /**
- * Validate all the widgets on the page
- * <p>
- * Subclasses should override to do full error checking on all
- * the widgets on the page.
- */
- public boolean verifyPageContents()
- {
- return form.verifyFormContents();
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java
deleted file mode 100644
index 12d810175..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemSubSystemPropertyPageCoreForm.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [195399] Improve String display for default port 0
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.widgets.InheritableEntryField;
-import org.eclipse.rse.ui.widgets.SystemPortPrompt;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * The form for the property page for core subsystem properties.
- */
-public class SystemSubSystemPropertyPageCoreForm extends AbstractSystemSubSystemPropertyPageCoreForm
-{
-
- protected SystemPortPrompt portPrompt;
- protected Label labelUserId, labelUserIdPrompt;
- protected InheritableEntryField textUserId;
- protected boolean portEditable=true, portApplicable=true, userIdApplicable=true;
- // validators
- protected ISystemValidator portValidator;
- protected ISystemValidator userIdValidator;
-
- /**
- * Constructor
- */
- public SystemSubSystemPropertyPageCoreForm(ISystemMessageLine msgLine, Object caller)
- {
- super(msgLine, caller);
- }
-
- /**
- * Create the GUI contents.
- */
- public Control createInner(Composite composite_prompts, Object inputElement, Shell shell)
- {
- this.shell = shell;
- this.inputElement = inputElement;
-
-
- // Port prompt
- // Composite portComposite = SystemWidgetHelpers.createComposite(composite_prompts, 2, 1, false, null, 0, 0);
- // labelPortPrompt = SystemWidgetHelpers.createLabel(composite_prompts, rb.getString(RESID_SUBSYSTEM_PORT_LABEL)+": ");
- portPrompt = new SystemPortPrompt(composite_prompts, msgLine, true, isPortEditable(), getSubSystem().getConnectorService().getPort(), getPortValidator());
-
-
- // UserId Prompt
- String temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_USERID_LABEL);
- labelUserIdPrompt = SystemWidgetHelpers.createLabel(composite_prompts, temp);
- userIdApplicable = isUserIdApplicable();
- if (userIdApplicable)
- {
- textUserId = SystemWidgetHelpers.createInheritableTextField(
- composite_prompts,SystemResources.RESID_SUBSYSTEM_USERID_INHERITBUTTON_TIP,SystemResources.RESID_SUBSYSTEM_USERID_TIP);
- textUserId.setFocus();
- }
- else
- labelUserId = SystemWidgetHelpers.createLabel(composite_prompts, getTranslatedNotApplicable());
-
- if (!initDone)
- doInitializeFields();
-
- if (textUserId != null)
- textUserId.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateUserIdInput();
- }
- }
- );
-
- return composite_prompts;
- }
-
- /**
- * Return control to recieve initial focus
- */
- public Control getInitialFocusControl()
- {
- if (portPrompt.isEditable())
- return portPrompt.getPortField();
- else if (userIdApplicable)
- return textUserId;
- else
- return null;
- }
-
- /**
- * Return true if the port is editable for this subsystem
- */
- protected boolean isPortEditable()
- {
- return getSubSystem().getSubSystemConfiguration().isPortEditable();
- }
- /**
- * Return true if the userId is applicable for this subsystem
- */
- protected boolean isUserIdApplicable()
- {
- return getSubSystem().getConnectorService().supportsUserId();
- }
-
- private ISystemValidator getPortValidator()
- {
- if (portValidator == null)
- {
- ISubSystemConfiguration ssFactory = getSubSystem().getSubSystemConfiguration();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
- portValidator = adapter.getPortValidator(ssFactory);
- }
- return portValidator;
- }
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- ISubSystem ss = getSubSystem();
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
-
- userIdValidator = adapter.getUserIdValidator(ssFactory);
- //getPortValidator();
- // vendor
- labelVendor.setText(ssFactory.getVendor());
- // name
- labelName.setText(ss.getName());
- // connection
- labelConnection.setText(ss.getHostAliasName());
- // profile
- labelProfile.setText(ss.getSystemProfileName());
- /*
- // port
- if (portEditable || portApplicable)
- {
- Integer port = ss.getPort();
- String localPort = null;
- if (port==null)
- port = new Integer(0);
- localPort = port.toString();
- int iPort = port.intValue();
- if (!portEditable)
- labelPort.setText(localPort);
- else
- {
- textPort.setLocalText(localPort);
- textPort.setInheritedText(NLS.bind(SystemPropertyResources.RESID_PORT_DYNAMICSELECT, new Integer(0)));
- textPort.setLocal(iPort != 0);
- }
- }
- */
-
- // userId
- if (userIdApplicable)
- {
- String localUserId = ss.getLocalUserId();
- textUserId.setLocalText(localUserId);
- String parentUserId = ss.getHost().getDefaultUserId();
- textUserId.setInheritedText(parentUserId+" "+SystemPropertyResources.RESID_PROPERTY_INHERITED); //$NON-NLS-1$
- textUserId.setLocal((localUserId!=null)&&(localUserId.length()>0));
- }
- }
-
- public void doInitializeInnerFields()
- {
- initDone = true;
- ISubSystem ss = getSubSystem();
- ISubSystemConfiguration ssFactory = ss.getSubSystemConfiguration();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssFactory.getAdapter(ISubSystemConfigurationAdapter.class);
-
- userIdValidator = adapter.getUserIdValidator(ssFactory);
-
- // userId
- if (userIdApplicable)
- {
- String localUserId = ss.getLocalUserId();
- textUserId.setLocalText(localUserId);
- String parentUserId = ss.getHost().getDefaultUserId();
- textUserId.setInheritedText(parentUserId+" "+SystemPropertyResources.RESID_PROPERTY_INHERITED); //$NON-NLS-1$
- textUserId.setLocal((localUserId!=null)&&(localUserId.length()>0));
- }
- }
-
- /**
- * Validate user id value per keystroke
- */
- protected SystemMessage validateUserIdInput() {
- errorMessage = null;
- if (textUserId != null) {
- if (textUserId.isLocal()) {
- if (userIdValidator != null) {
- errorMessage = userIdValidator.validate(textUserId.getText());
- } else if (getUserId().equals("")) { //$NON-NLS-1$
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
- }
- }
- }
- setErrorMessage(errorMessage);
- return errorMessage;
- }
-
- /*
- * Validate port value per keystroke
- *
- protected SystemMessage validatePortInput()
- {
- errorMessage= null;
- if (textPort!=null)
- {
- if (!textPort.isLocal())
- return null;
- if (portValidator != null)
- errorMessage= portValidator.validate(textPort.getText());
- else if (getPort().equals(""))
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
- }
- setErrorMessage(errorMessage);
- //setPageComplete();
- return errorMessage;
- }*/
-
-
- /**
- * Return user-entered User Id.
- */
- protected String getUserId()
- {
- return textUserId.getText().trim();
- }
- /*
- * Return user-entered Port number.
- *
- protected String getPort()
- {
- return textPort.getText().trim();
- }*/
-
- /**
- * This method can be called by the dialog or wizard page host, to decide whether to enable
- * or disable the next, final or ok buttons. It returns true if the minimal information is
- * available and is correct.
- */
- public boolean isPageComplete()
- {
- boolean pageComplete = false;
- if (errorMessage == null)
- pageComplete = (getUserId().length() > 0) && portPrompt.isComplete();
- return pageComplete;
- }
- /**
- * Inform caller of page-complete status of this form
- */
- public void setPageComplete()
- {
- boolean complete = isPageComplete();
- if (callerInstanceOfWizardPage)
- {
- ((WizardPage)caller).setPageComplete(complete);
- }
- else if (callerInstanceOfSystemPromptDialog)
- {
- ((SystemPromptDialog)caller).setPageComplete(complete);
- }
- else if (callerInstanceOfPropertyPage)
- {
- ((PropertyPage)caller).setValid(complete);
- }
- }
-
- /**
- * Validate all the widgets on the form
- */
- public boolean verifyFormContents()
- {
- boolean ok = true;
- SystemMessage errMsg = null;
- Control controlInError = null;
- clearErrorMessage();
- errMsg = portPrompt.validatePortInput();
- if (errMsg != null)
- controlInError = portPrompt.getPortField(); //textPort.getTextField();
- else
- {
- errMsg = validateUserIdInput();
- if (errMsg != null)
- controlInError = textUserId.getTextField();
- }
- if (errMsg != null)
- {
- ok = false;
- if (controlInError != null)
- controlInError.setFocus();
- setErrorMessage(errMsg);
- }
- return ok;
- }
-
-
- /**
- * Called by caller when user presses OK
- */
- public boolean performOk()
- {
- boolean ok = verifyFormContents();
- if (ok)
- {
- ISubSystem ss = getSubSystem();
- // PROCESS PORT...
- if (portPrompt.isEditable())
- updatePort(ss);
-
- // PROCESS USER ID...
- if (textUserId != null)
- {
- updateUserId(ss);
- }
- ss.commit();
- }
- return ok;
- }
-
- /**
- * Change the subsystem user Id value
- */
- private void updateUserId(ISubSystem subsys)
- {
- //int whereToUpdate = USERID_LOCATION_SUBSYSTEM;
- String userId = textUserId.getLocalText(); // will be "" if !textuserid.getIsLocal(), which results in wiping out local override
- ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
- // unlike with connection objects, we don't ever allow the user to change the parent's
- // userId value, even if it is empty, when working with subsystems. There is too much
- // ambiquity as the parent could be the connnection or the user preferences setting for this
- // system type. Because of this decision, we don't need to tell updateSubSystem(...) where
- // to update, as it always the local subsystem.
- ssFactory.updateSubSystem(subsys, true, userId, false, subsys.getConnectorService().getPort());
- }
- /**
- * Change the subsystem port value
- */
- private void updatePort(ISubSystem subsys)
- {
- /*
- String port = textPort.getLocalText(); // will be "" if !textPort.getIsLocal(), which results in wiping out local override
- Integer portInteger = null;
- if (textPort.isLocal() && (port.length()>0))
- portInteger = new Integer(port);
- else
- portInteger = new Integer(0);
- */
- int portInteger = portPrompt.getPort();
- ISubSystemConfiguration ssFactory = subsys.getSubSystemConfiguration();
- ssFactory.updateSubSystem(subsys, false, subsys.getLocalUserId(), true, portInteger);
- }
-
- /**
- * Return "Not applicable" translated
- */
- private String getTranslatedNotApplicable()
- {
- if (xlatedNotApplicable == null)
- xlatedNotApplicable = SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
- return xlatedNotApplicable;
- }
-
- private void setErrorMessage(SystemMessage msg)
- {
- if (msgLine != null)
- if (msg != null)
- msgLine.setErrorMessage(msg);
- else
- msgLine.clearErrorMessage();
- }
- private void clearErrorMessage()
- {
- if (msgLine != null)
- msgLine.clearErrorMessage();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java
deleted file mode 100644
index f74f69c12..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTeamViewCategoryPropertyPage.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) [225506][api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.internal.ui.view.team.SystemTeamViewCategoryNode;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-
-/**
- * The property page for category nodes in the Team view.
- * This is an output-only page.
- */
-public class SystemTeamViewCategoryPropertyPage extends SystemBasePropertyPage
-{
-
- protected Label labelType, labelName, labelDescription;
- protected String errorMessage;
- protected boolean initDone = false;
-
- /**
- * Constructor for SystemFilterPropertyPage
- */
- public SystemTeamViewCategoryPropertyPage()
- {
- super();
- }
- /**
- * Create the page's GUI contents.
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContentArea(Composite parent)
- {
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // Type prompt
- String typeLabel = SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL;
- String typeTooltip = SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP;
-
- labelType = createLabeledLabel(composite_prompts, typeLabel, typeTooltip);
- labelType.setText(SystemViewResources.RESID_PROPERTY_TEAM_CATEGORY_TYPE_VALUE);
-
- // Name prompt
- String nameLabel = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL;
- String nameTooltip = SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP;
-
- labelName = createLabeledLabel(composite_prompts, nameLabel, nameTooltip);
-
- // Description prompt
- addFillerLine(composite_prompts, nbrColumns);
- addSeparatorLine(composite_prompts, nbrColumns);
- //key = ISystemConstants.RESID_PROPERTY_DESCRIPTION_ROOT;
- //Label l = SystemWidgetHelpers.createLabel(composite_prompts, rb, key, nbrColumns, false);
- //l.setText(l.getText() + ":");
- labelDescription = SystemWidgetHelpers.createVerbiage(composite_prompts, "", nbrColumns, false, 200); //$NON-NLS-1$
-
- if (!initDone)
- doInitializeFields();
-
- return composite_prompts;
- }
- /**
- * From parent: do full page validation
- */
- protected boolean verifyPageContents()
- {
- return true;
- }
-
- /**
- * Get the input team view category node
- */
- private SystemTeamViewCategoryNode getCategoryNode()
- {
- Object element = getElement();
- return ((SystemTeamViewCategoryNode)element);
- }
-
- /**
- * Initialize values of input fields based on input
- */
- protected void doInitializeFields()
- {
- initDone = true;
- SystemTeamViewCategoryNode node = getCategoryNode();
- // populate GUI...
- labelName.setText(node.getLabel());
- labelDescription.setText(node.getDescription());
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java
deleted file mode 100644
index a4dfee58c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * - created and used RSEPreferencesManager
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- * Martin Oberhuber (Wind River) - [196963][181939] avoid subsystem plugin activation just for enablement checking
- * David Dykstal (IBM) - [231943] make "true" and "false" translatable
- ********************************************************************************/
-
-package org.eclipse.rse.ui.propertypages;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.RSEPreferencesManager;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-
-/**
- * This is a field type editor for the Remote Systems preference page,
- * used for setting system type preferences.
- */
-public class SystemTypeFieldEditor extends FieldEditor
- implements ICellModifier, ITableLabelProvider, IStructuredContentProvider
-{
- private Table table;
- private GridData tableData;
- private TableViewer tableViewer;
- private CellEditor enabledCellEditor, userIdCellEditor;
- private static final char KEYVALUE_DELIMITER='=';
- private static final char KEYVALUEPAIR_DELIMITER=';';
- public static final char EACHVALUE_DELIMITER='+';
- private Hashtable keyValues;
- private IRSESystemType[] systemTypes;
-
- private boolean enabledStateChanged = false;
-
- private static final int COLUMN_NAME = 0;
- private static final int COLUMN_ENABLED = 1;
- private static final int COLUMN_USERID = 2;
- private static final String P_NAME = "name"; //$NON-NLS-1$
- private static final String P_ENABLED = "enabled"; //$NON-NLS-1$
- private static final String P_DESC = "desc"; //$NON-NLS-1$
- private static final String P_USERID = "userid"; //$NON-NLS-1$
- private static final String columnHeaders[] =
- {
- SystemResources.RESID_PREF_SYSTYPE_COLHDG_NAME,
- SystemResources.RESID_PREF_SYSTYPE_COLHDG_ENABLED,
- SystemResources.RESID_PREF_SYSTYPE_COLHDG_USERID,
- SystemResources.RESID_PREF_SYSTYPE_COLHDG_DESC
- };
- private static ColumnLayoutData columnLayouts[] =
- {
- new ColumnWeightData(20,80,true),
- new ColumnWeightData(20,15,true),
- new ColumnWeightData(20,100,true),
- new ColumnWeightData(55,280,true)
- };
- // give each column a property value to identify it
- private static final String[] tableColumnProperties =
- {
- P_NAME, P_ENABLED, P_USERID, P_DESC
- };
-
- private static final boolean[] enabledStates = {Boolean.TRUE.booleanValue(), Boolean.FALSE.booleanValue()};
- private static final String[] enabledStateStrings = {SystemResources.SystemTypeFieldEditor_true, SystemResources.SystemTypeFieldEditor_false};
-
- /**
- * Constructor
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
- public SystemTypeFieldEditor(String name, String labelText, Composite parent)
- {
- super(name, labelText, parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
- */
- protected void adjustForNumColumns(int numColumns)
- {
- ((GridData)table.getLayoutData()).horizontalSpan = numColumns;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
- */
- protected void doFillIntoGrid(Composite parent, int numColumns)
- {
- table = createTable(parent);
- ((GridData)table.getLayoutData()).horizontalSpan = numColumns;
- tableViewer = new TableViewer(table);
- createColumns();
- tableViewer.setColumnProperties(tableColumnProperties);
- tableViewer.setCellModifier(this);
- CellEditor editors[] = new CellEditor[columnHeaders.length];
- userIdCellEditor = new TextCellEditor(table);
- enabledCellEditor = new ComboBoxCellEditor(table, enabledStateStrings, SWT.READ_ONLY); // DWD should consider a checkbox for this.
- editors[COLUMN_USERID] = userIdCellEditor;
- editors[COLUMN_ENABLED] = enabledCellEditor;
- tableViewer.setCellEditors(editors);
-
- tableViewer.setLabelProvider(this);
- tableViewer.setContentProvider(this);
- tableViewer.setInput(new Object());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoad()
- */
- protected void doLoad()
- {
- if (systemTypes == null)
- systemTypes = getSystemTypes(false);
-
- String value = RSEPreferencesManager.getSystemTypeValues();
- keyValues = null;
-
- if ((value == null) || (value.length() == 0))
- {
- keyValues = new Hashtable();
- }
- else
- {
- keyValues = parseString(value);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
- */
- protected void doLoadDefault()
- {
- // when Defaults button pressed, we re-read the system types from disk
- systemTypes = getSystemTypes(true);
- keyValues.clear();
- tableViewer.refresh();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#doStore()
- */
- protected void doStore()
- {
- if (systemTypes != null)
- {
- String s = createString(keyValues);
-
- if (s != null) {
- RSEPreferencesManager.setSystemTypeValues(s);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
- */
- public int getNumberOfControls()
- {
- return 1;
- }
-
- /*
- * @see FieldEditor.setEnabled(boolean,Composite).
- */
- public void setEnabled(boolean enabled, Composite parent)
- {
- if (table != null)
- table.setEnabled(enabled);
- }
-
- /*
- * @see FieldEditor.isValid().
- */
- public boolean isValid()
- {
- return true;
- }
-
-
- // ----------------
- // local methods...
- // ----------------
-
- private Table createTable(Composite parent)
- {
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
- table.setLinesVisible(true);
- tableData = new GridData();
- tableData.horizontalAlignment = GridData.FILL;
- tableData.grabExcessHorizontalSpace = true;
- tableData.widthHint = 410;
- tableData.heightHint= 30;
- tableData.verticalAlignment = GridData.FILL;
- tableData.grabExcessVerticalSpace = true;
- table.setLayoutData(tableData);
-
- SystemWidgetHelpers.setHelp(table, RSEUIPlugin.HELPPREFIX+"systype_preferences"); //$NON-NLS-1$
- return table;
- }
-
- private void createColumns()
- {
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
- for (int i = 0; i < columnHeaders.length; i++)
- {
- layout.addColumnData(columnLayouts[i]);
- TableColumn tc = new TableColumn(table, SWT.NONE,i);
- tc.setResizable(columnLayouts[i].resizable);
- tc.setText(columnHeaders[i]);
- }
- }
-
- /**
- * Parse out list of key-value pairs into a hashtable
- */
- private static Hashtable parseString(String allvalues)
- {
- StringTokenizer tokens = new StringTokenizer(allvalues, makeString(KEYVALUE_DELIMITER, KEYVALUEPAIR_DELIMITER));
- Hashtable keyValues = new Hashtable(10);
- int count = 0;
- String token1=null;
- String token2=null;
- while (tokens.hasMoreTokens())
- {
- count++;
- if ((count % 2) == 0) // even number
- {
- token2 = tokens.nextToken();
- keyValues.put(token1, token2);
- }
- else
- token1 = tokens.nextToken();
- }
- return keyValues;
- }
-
- private static String makeString(char charOne, char charTwo)
- {
- StringBuffer s = new StringBuffer(2);
- s.append(charOne);
- s.append(charTwo);
- return s.toString();
- }
-
- /**
- * Convert hashtable of key-value pairs into a single string
- */
- public static String createString(Hashtable keyValues)
- {
- if (keyValues == null)
- return null;
- Enumeration keys = keyValues.keys();
- StringBuffer sb = new StringBuffer();
- while (keys.hasMoreElements())
- {
- String key = (String)keys.nextElement();
- String value = (String)keyValues.get(key);
- if ((value != null) && (value.length()>0))
- {
- sb.append(key);
- sb.append(KEYVALUE_DELIMITER);
- sb.append(value);
- sb.append(KEYVALUEPAIR_DELIMITER);
- }
- }
-
- return sb.toString();
- }
-
- /**
- * Retrieve an array of currently known system types.
- * @param restoreDefaults restore the default values for the system types
- * @return The list of system types known to be in existence
- */
- private IRSESystemType[] getSystemTypes(boolean restoreDefaults) {
- IRSESystemType[] types = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
- ArrayList list = new ArrayList();
- if (systemTypes == null || restoreDefaults) {
- //Only get system types with at least one configuration registered.
- //Do not consider enabled state according to the system type
- //adapter, because this field editor is used for the preference
- //page where enablement is made.
- ISubSystemConfigurationProxy[] proxies = RSECorePlugin.getTheSystemRegistry().getSubSystemConfigurationProxies();
- for (int i = 0; i < types.length; i++) {
- for (int j=0; j<proxies.length; j++) {
- if (proxies[j].appliesToSystemType(types[i])) {
- list.add(types[i]);
- break;
- }
- }
- }
- }
- types = new IRSESystemType[list.size()];
- for (int i = 0; i < list.size(); i++) {
- types[i] = (IRSESystemType) (list.get(i));
- }
- return types;
- }
-
- // ------------------------
- // ICellModifier methods...
- // ------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
- */
- public boolean canModify(Object element, String property)
- {
- if (property.equals(P_ENABLED))
- {
- return true;
- }
- else if (property.equals(P_USERID))
- {
- return true;
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
- */
- public Object getValue(Object element, String property)
- {
- IRSESystemType row = (IRSESystemType)element;
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(row.getAdapter(RSESystemTypeAdapter.class));
- Object value = ""; //$NON-NLS-1$
-
- if (property.equals(P_NAME))
- value = row.getLabel();
- else if (property.equals(P_ENABLED))
- value = (row.isEnabled() ? new Integer(0) : new Integer(1));
- else if (property.equals(P_USERID))
- value = (adapter.getDefaultUserId(row) == null) ? "" : adapter.getDefaultUserId(row); //$NON-NLS-1$
- else
- value = (row.getDescription() == null) ? "" : row.getDescription(); //$NON-NLS-1$
-
- return value;
- }
-
- public boolean enabledStateChanged()
- {
- return enabledStateChanged;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
- */
- public void modify(Object element, String property, Object value)
- {
- IRSESystemType row = (IRSESystemType)(((TableItem)element).getData());
-
- if (property.equals(P_ENABLED))
- {
- Integer val = (Integer)value;
- RSEPreferencesManager.setIsSystemTypeEnabled(row, enabledStates[val.intValue()]);
- enabledStateChanged = true;
- }
- else if (property.equals(P_USERID))
- {
- RSEPreferencesManager.setDefaultUserId(row, (String) value);
- }
- else
- return;
-
- keyValues.put(row.getId(), ""); //$NON-NLS-1$
- tableViewer.update(row, null);
- }
-
- // ------------------------------
- // ITableLabelProvider methods...
- // ------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex)
- {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex)
- {
- IRSESystemType currType = (IRSESystemType)element;
-
- if (columnIndex == COLUMN_NAME)
- return currType.getLabel();
- else if (columnIndex == COLUMN_ENABLED) {
- int n = 0;
- if (currType.isEnabled() == enabledStates[1]) {
- n = 1;
- }
- return enabledStateStrings[n];
- } else if (columnIndex == COLUMN_USERID) {
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter) (currType.getAdapter(RSESystemTypeAdapter.class));
- return (adapter.getDefaultUserId(currType)==null ? "" : adapter.getDefaultUserId(currType)); //$NON-NLS-1$
- }
- else
- return (currType.getDescription()==null ? "" : currType.getDescription()); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener)
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
- */
- public boolean isLabelProperty(Object element, String property)
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener)
- {
- }
-
- // -------------------------------------
- // IStructuredContentProvider methods...
- // -------------------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement)
- {
- if (systemTypes == null)
- systemTypes = getSystemTypes(false);
- return systemTypes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- }
-
- // ----------------
- // Other methods...
- // ----------------
- /**
- * Set the tooltip text
- */
- public void setToolTipText(String tip)
- {
- table.setToolTipText(tip);
- }
-
-// public static Hashtable initSystemTypePreferences(IPreferenceStore store, IRSESystemType[] systemTypes)
-// {
-// /* this must stay in synch with the SystemPreferencesManager */
-// String value = store.getString(ISystemPreferencesConstants.SYSTEMTYPE_VALUES);
-// Hashtable keyValues = null;
-// if ((value == null) || (value.length()==0)) // not initialized yet?
-// {
-// return null;
-// // nothing to do, as we have read from systemTypes extension points already
-// }
-// else
-// {
-// keyValues = parseString(value);
-// // we have now a hashtable, where the keys are the system type names,
-// // and the values are the column-value attributes for that type, separated
-// // by a '+' character: enabled+userid. eg: "true+bob"
-// Enumeration keys = keyValues.keys();
-// while (keys.hasMoreElements())
-// {
-// String key = (String)keys.nextElement();
-// String attributes = (String)keyValues.get(key);
-// String attr1="true", attr2=""; //$NON-NLS-1$ //$NON-NLS-2$
-// if ((attributes != null) && (attributes.length()>0))
-// {
-// StringTokenizer tokens = new StringTokenizer(attributes, Character.toString(EACHVALUE_DELIMITER));
-// if (tokens.hasMoreTokens())
-// {
-// attr1 = tokens.nextToken();
-// if (tokens.hasMoreTokens())
-// {
-// attr2 = tokens.nextToken();
-// }
-// else
-// {
-// attr2 = "null"; //$NON-NLS-1$
-// }
-// }
-// }
-// // find this system type in the array...
-// IRSESystemType matchingType = RSECorePlugin.getTheCoreRegistry().getSystemType(key);
-// RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(matchingType.getAdapter(RSESystemTypeAdapter.class));
-//
-// // update this system type's attributes as per preferences...
-// {
-// adapter.setIsEnabled(matchingType, attr1.equals("true")); //$NON-NLS-1$
-// if (!attr2.equals("null")) //$NON-NLS-1$
-// adapter.setDefaultUserId(matchingType, attr2);
-// }
-// }
-// }
-// return keyValues;
-// }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidator.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidator.java
deleted file mode 100644
index e9d865f57..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-
-
-/**
- * Our validators need to support querying max length, for generic rename dialogs.
- * They also need to support getting the message not only as a string, which isValid returns,
- * but also as a SystemMessage, which getSystemMessage() does if isValid returns non-null.
- */
-public interface ISystemValidator extends IInputValidator, ICellEditorValidator
-{
-
-
- /**
- * Return the max length for this name, or -1 if no max
- */
- public int getMaximumNameLength();
- /**
- * If isValid returns non-null and you desire a full bodied SystemMessage versus a string,
- * call this method after isValid to get the full bodied SystemMessage.
- * <p>
- * Will be null if isValid returned null.
- */
- public SystemMessage getSystemMessage();
-
- /**
- * For convenience, this is a shortcut to calling:
- * <pre><code>
- * if (isValid(text) != null)
- * msg = getSystemMessage();
- * </code></pre>
- */
- public SystemMessage validate(String text);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java
deleted file mode 100644
index 780e5e894..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ISystemValidatorUniqueString.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-
-import java.util.Collection;
-
-/**
- * This interface is implemented by any validator that
- * does uniqueness checking. Allows common code that will set the
- * list of string to check against.
- */
-public interface ISystemValidatorUniqueString
-{
-
- /**
- * Reset whether this is a case-sensitive list or not
- */
- public void setCaseSensitive(boolean caseSensitive);
- /**
- * Reset the existing names list.
- */
- public void setExistingNamesList(String[] existingList);
- /**
- * Reset the existing names list.
- * The collection used here is to be treated as
- * read-only by any implementer of this interface.
- */
- public void setExistingNamesList(Collection existingList);
- /**
- * Return the existing names list.
- * This will be a case-normalized and sorted list.
- */
- public String[] getExistingNamesList();
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java
deleted file mode 100644
index a0bd91b47..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/IValidatorRemoteSelection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-
-
-/**
- * On remote selection dialogs, you can pass an implementation of this interface to validate that
- * it is ok to enable the OK button when the user selects a remote object. If you return
- * a SystemMessage, ok will be disabled and the message will be shown on the message line.
- * Return a SystemMessage with blank in the first level text to disable OK without showing
- * an error message.
- * <p>
- * Alternatively you can just subclass {@link org.eclipse.rse.ui.validators.ValidatorRemoteSelection}
- */
-public interface IValidatorRemoteSelection
-{
-
- /**
- * The user has selected one or more remote objects. Return null if OK is to be enabled, or a SystemMessage
- * if it is not to be enabled. The message will be displayed on the message line.
- */
- public SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObject);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java
deleted file mode 100644
index 8c2006867..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/SystemNumericVerifyListener.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-
-/**
- * A class that only allows keys representing numeric values to be entered. It can be turned off if necessary.
- */
-public class SystemNumericVerifyListener implements VerifyListener {
-
- private boolean isOff;
-
- /**
- * Constructor. The verifier is on by default.
- */
- public SystemNumericVerifyListener() {
- isOff = false;
- }
-
- /**
- * Verifies the event text if it is not turned off.
- * @see org.eclipse.swt.events.VerifyListener#verifyText(org.eclipse.swt.events.VerifyEvent)
- */
- public void verifyText(VerifyEvent e) {
-
- if (!isOff) {
- String text = e.text;
- boolean doit = true;
-
- for (int i = 0; i < text.length(); i++) {
- char c = text.charAt(i);
-
- if (!Character.isDigit(c)) {
- doit = false;
- break;
- }
- }
-
- e.doit = doit;
- }
- }
-
- /**
- * Turns the verifier on or off.
- * @param isOff <code>true</code> to turn the verifier off, <code>false</code> to turn it on.
- */
- public void setOff(boolean isOff) {
- this.isOff = isOff;
- }
-
- /**
- * Returns whether the verifier is on or off.
- * @return <code>true</code> if the verifier is off, <code>false</code> if it is on.
- */
- public boolean isOff() {
- return isOff;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java
deleted file mode 100644
index b49ed0201..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorArchiveName.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * @author mjberger
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class ValidatorArchiveName extends ValidatorFileName {
-
- protected SystemMessage msg_NotRegisteredArchive;
-
- public ValidatorArchiveName(Collection existingNameList) {
- super(existingNameList);
- }
-
- public ValidatorArchiveName(String[] existingNameList) {
- super(existingNameList);
- }
-
- public ValidatorArchiveName() {
- super();
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
- /**
- * Validate each character.
- * Override of parent method.
- * Override yourself to refine the error checking.
- * Also checks to see if its a valid archive name.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- msg_NotRegisteredArchive = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ARCHIVE_NAME);
- msg_NotRegisteredArchive.makeSubstitution(newText);
- IStatus rc = workspace.validateName(newText, IResource.FILE);
- if (rc.getCode() != IStatus.OK)
- return msg_Invalid;
- else if ((getMaximumNameLength() > 0) && // defect 42507
- (newText.length() > getMaximumNameLength()))
- return msg_Invalid; // TODO: PHIL. MRI. better message.
- else if (!ArchiveHandlerManager.getInstance().isRegisteredArchive(newText))
- return msg_NotRegisteredArchive;
- return checkForBadCharacters(newText) ? null: msg_Invalid;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java
deleted file mode 100644
index 3f47dd218..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorConnectionName.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This class is used in dialogs that prompt for a connection alias name.
- * Relies on Eclipse supplied method to test for folder name validity.
- * <p>
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorConnectionName extends ValidatorUniqueString implements ISystemValidator
-{
- public static final int MAX_CONNECTIONNAME_LENGTH = 100; // arbitrary restriction due to defects
-
- /**
- * Constructor.
- * @param existingNameList list of existing names (strings) in owning profile. Can be null if not a rename operation.
- */
- public ValidatorConnectionName(Collection existingNameList)
- {
- super(existingNameList, CASE_SENSITIVE);
- setErrorMessages(
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_CONNECTIONNAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE)
- );
- }
-
- /**
- * Validate the given connection name is not already used in any profile. This is too expensive
- * to do per keystroke, so you should call this after as a final test. Note, this is a warning
- * situation, not an error, as we assume we have already tested for the containing profile, and
- * thus is a test for a match on a connection in a non-containing profile. This results in msg
- * rseg1241 being presented to the user, and if he chooses No to not continue, we return false
- * here. You should stop processing on false. Else, we return true meaning everything is ok.
- */
- public static boolean validateNameNotInUse(String proposedName, Shell shell)
- {
- SystemMessage msg = null;
- String[] names = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNames();
- String profileName = null;
- for (int idx = 0; (msg == null) && (idx < names.length); idx++)
- {
- profileName = names[idx];
- IHost[] conns = RSECorePlugin.getTheSystemProfileManager().getSystemProfile(profileName).getHosts();
- for (int jdx=0; (msg==null) && (jdx<conns.length); jdx++)
- {
- if (conns[jdx].getAliasName().equalsIgnoreCase(proposedName))
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_CONNECTIONNAME_NOTUNIQUE_OTHERPROFILE);
- }
- }
- if (msg != null)
- {
- msg.makeSubstitution(proposedName, profileName);
- SystemMessageDialog dlg = new SystemMessageDialog(shell, msg);
- boolean yesToContinue = dlg.openQuestionNoException();
- if (yesToContinue)
- msg = null;
- }
- return (msg==null);
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Return the max length for connections: 100
- */
- public int getMaximumNameLength()
- {
- return MAX_CONNECTIONNAME_LENGTH;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFactory.java
deleted file mode 100644
index 6bf1d0316..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Dykstal (IBM) - Initial API and implementation
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfileManager;
-
-/**
- * This class constructs validators for various bits of the user interface.
- */
-public class ValidatorFactory {
-
- /**
- * Reusable method to return a name validator for renaming a profile.
- * @param profileName the current profile name on updates. Can be null for new profiles. Used
- * to remove from the existing name list the current connection.
- * @return the validator
- */
- public static ISystemValidator getProfileNameValidator(String profileName) {
- ISystemProfileManager manager = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager();
- String[] nameArray = manager.getSystemProfileNames();
- Collection names = Arrays.asList(nameArray);
- if (profileName != null) names.remove(profileName);
- ISystemValidator nameValidator = new ValidatorProfileName(names);
- return nameValidator;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFileName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFileName.java
deleted file mode 100644
index ddcd1b02c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFileName.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for a name that eventually needs to become a file on disk.
- * Relies on Eclipse supplied method to test for folder name validity.
- *
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorFileName
- extends ValidatorUniqueString implements ISystemValidator
-{
- public static final int MAX_FILENAME_LENGTH = 256;
-
- protected boolean fUnique;
- protected SystemMessage msg_Invalid;
- protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
- /**
- * Use this constructor when the name must be unique.
- * @param existingNameList a collection of existing names to compare against.
- * This will not be modified by the validator.
- */
- public ValidatorFileName(Collection existingNameList)
- {
- super(existingNameList, false); // case insensitive uniqueness
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILENAME_NOTVALID);
- }
- /**
- * Use this constructor when the name must be unique. Give the
- * ctor a string array of existing names to compare against.
- */
- public ValidatorFileName(String existingNameList[])
- {
- super(existingNameList, false); // case insensitive uniqueness
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILENAME_NOTVALID);
- }
-
- /**
- * Use this constructor when the name need not be unique, and you just want
- * the syntax checking.
- */
- public ValidatorFileName()
- {
- super(new String[0], false);
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILENAME_NOTVALID);
- }
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty
- * @param msg_NonUnique error message when value entered is not unique
- * @param msg_Invalid error message when syntax is not valid
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
- {
- super.setErrorMessages(msg_Empty, msg_NonUnique);
- this.msg_Invalid = msg_Invalid;
- }
-
- /**
- * Overridable extension point to check for invalidate characters beyond what Eclipse checks for
- * @return true if valid, false if not
- */
- protected boolean checkForBadCharacters(String newText)
- {
- return true;
- }
-
-
- public String toString()
- {
- return "FileNameValidator class"; //$NON-NLS-1$
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
- /**
- * Validate each character.
- * Override of parent method.
- * Override yourself to refine the error checking.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- IStatus rc = workspace.validateName(newText, IResource.FILE);
- if (rc.getCode() != IStatus.OK)
- return msg_Invalid;
- else if ((getMaximumNameLength() > 0) && // defect 42507
- (newText.length() > getMaximumNameLength()))
- return msg_Invalid; // TODO: PHIL. MRI. better message.
- return checkForBadCharacters(newText) ? null: msg_Invalid;
- }
-
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Return the max length for file names: 256
- */
- public int getMaximumNameLength()
- {
- return MAX_FILENAME_LENGTH;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterName.java
deleted file mode 100644
index 21d79c344..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterName.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for filter name. Filter names
- * have to be unique.
- * <p>
- * The IInputValidator interface is implemented by our parent and it
- * is used by jface's InputDialog class and property sheet window.
- */
-public class ValidatorFilterName
- extends ValidatorUniqueString implements ISystemValidator
-{
- public static final int MAX_FILTERNAME_LENGTH = 100;
-
- //public static final boolean CASE_SENSITIVE = true;
- //public static final boolean CASE_INSENSITIVE = false;
-
- /**
- * Constructor accepting a Collection.
- * @param existingList a collection of existing filter names to compare against.
- * The collection will not be modified by the validator.
- * Note that toString() is used to get the string from each item.
- */
- public ValidatorFilterName(Collection existingList)
- {
- super(existingList, CASE_SENSITIVE);
- init();
- }
- /**
- * Constructor accepting an Array.
- * @param existingList array containing list of existing strings to compare against.
- */
- public ValidatorFilterName(String[] existingList)
- {
- super(existingList, CASE_SENSITIVE);
- init();
- }
-
- private void init()
- {
- super.setErrorMessages(
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERNAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERNAME_NOTUNIQUE)
- );
- }
-
- public String toString()
- {
- return "FilterNameValidator class"; //$NON-NLS-1$
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
-
- /**
- * Overridable extension point to check for invalidate characters beyond what Eclipse checks for
- * @return true if valid, false if not
- */
- protected boolean checkForBadCharacters(String newText)
- {
- if (newText.indexOf('#') >= 0)
- return false;
- else
- return true;
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Return the max length for filters: 100
- */
- public int getMaximumNameLength()
- {
- return MAX_FILTERNAME_LENGTH;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java
deleted file mode 100644
index ebffe6f2f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterPoolName.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for filter name. Filter names
- * have to be unique, and to enable saving per folder, must be a valid folder name.
- * <p>
- * The IInputValidator interface is implemented by our parent and it
- * is used by jface's InputDialog class and property sheet window.
- */
-public class ValidatorFilterPoolName
- extends ValidatorUniqueString implements ISystemValidator
-{
- public static final int MAX_FILTERPOOLNAME_LENGTH = 50;
-
- /**
- * Constructor accepting a Collection.
- * @param existingList a collection of existing filter names to compare against.
- * This will not be modified by the validator.
- * Note that toString() is used to get the string from each item.
- */
- public ValidatorFilterPoolName(Collection existingList)
- {
- super(existingList, CASE_SENSITIVE);
- init();
- }
- /**
- * Constructor accepting an Array.
- * @param existingList An array containing a list of existing strings to compare against.
- */
- public ValidatorFilterPoolName(String[] existingList)
- {
- super(existingList, CASE_SENSITIVE);
- init();
- }
-
- private void init()
- {
- super.setErrorMessages(
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERPOOLNAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERPOOLNAME_NOTUNIQUE)
- );
- }
-
-
- public String toString()
- {
- return "FilterNameValidator class"; //$NON-NLS-1$
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
-
- /**
- * Overridable extension point to check for invalidate characters beyond what Eclipse checks for
- * @return true if valid, false if not
- */
- protected boolean checkForBadCharacters(String newText)
- {
- if (newText.indexOf('#') >= 0)
- return false;
- else
- return true;
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Return the max length for filter pools: 50
- */
- public int getMaximumNameLength()
- {
- return MAX_FILTERPOOLNAME_LENGTH;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java
deleted file mode 100644
index 89eda3d60..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFilterString.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-/**
- * This class is used in dialogs that prompt for filter strings.
- * This class typically needs to be overridden for a particular subsystem factory provider.
- * By default, it simply checks for uniqueness.
- */
-public class ValidatorFilterString
- extends ValidatorUniqueString implements ISystemValidator
-{
- public static final int MAX_FILTERSTRINGNAME_LENGTH = 1000;
-
- //public static final boolean CASE_SENSITIVE = true;
- //public static final boolean CASE_INSENSITIVE = false;
- protected SystemMessage msg_Invalid;
-
- /**
- * Constructor accepting a collection of existing strings, as simple strings.
- * @param existingList A collection of strings to compare against.
- * This will not be modified by the validator.
- * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
- */
- public ValidatorFilterString(Collection existingList, boolean caseSensitive)
- {
- super(existingList, caseSensitive); // case sensitive uniqueness
- init();
- }
- /**
- * Constructor accepting an Array for the list of existing strings, as simple strings.
- * @param existingList An array containing list of existing strings to compare against.
- * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
- */
- public ValidatorFilterString(String[] existingList, boolean caseSensitive)
- {
- super(existingList, caseSensitive); // case sensitive uniqueness
- init();
- }
- /**
- * Constructor accepting an Array for the list of existing strings, as actual filter strings.
- * @param existingList An array containing list of existing filter strings to compare against.
- * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
- */
- public ValidatorFilterString(ISystemFilterString[] existingList, boolean caseSensitive)
- {
- super(convertFilterStringsToStrings(existingList), caseSensitive); // case sensitive uniqueness
- init();
- }
-
- /**
- * Use this constructor when the name need not be unique, and you just want
- * the syntax checking.
- */
- public ValidatorFilterString(boolean caseSensitive)
- {
- super(new String[0], caseSensitive);
- init();
- }
-
- /**
- * Set the error message to issue when a duplicate filter string is found.
- */
- public void setDuplicateFilterStringErrorMessage(SystemMessage msg)
- {
- super.setErrorMessages(null, msg_NonUnique);
- }
-
- /**
- * Converts an array of filter strings into an array of strings
- */
- protected static String[] convertFilterStringsToStrings(ISystemFilterString[] filterStrings)
- {
- if (filterStrings == null)
- return new String[0];
- String[] strings = new String[filterStrings.length];
- for (int idx=0; idx<filterStrings.length; idx++)
- strings[idx] = filterStrings[idx].getString();
- return strings;
- }
-
-
- private void init()
- {
- setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_NOTUNIQUE),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FILTERSTRING_NOTVALID));
- }
-
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty
- * @param msg_NonUnique error message when value entered is not unique
- * @param msg_Invalid error message when syntax is not valid
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
- {
- super.setErrorMessages(msg_Empty, msg_NonUnique);
- this.msg_Invalid = msg_Invalid;
- }
-
- public String toString()
- {
- return "ValidatorFilterString class"; //$NON-NLS-1$
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
-
- /**
- * Validate each character.
- * Override of parent method.
- * Override yourself to refine the error checking. We don't do anything by default.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- // nothing more to check so far. But if there ever is, return msg_Invalid
- return null;
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Return the max length for filter strings: 1000
- */
- public int getMaximumNameLength()
- {
- return MAX_FILTERSTRINGNAME_LENGTH;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFolderName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFolderName.java
deleted file mode 100644
index d62df8e43..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorFolderName.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for a name that eventually needs to become a folder.
- * Relies on Eclipse supplied method to test for folder name validity.
- *
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorFolderName
- extends ValidatorUniqueString implements ISystemValidator
-{
- public static final int MAX_FOLDERNAME_LENGTH = 256;
-
- protected boolean fUnique;
- protected SystemMessage msg_Invalid;
- protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
- /**
- * Use this constructor when the name must be unique. Give the
- * @param existingNameList a collection of existing names to compare against.
- * This will not be modified by the validator.
- */
- public ValidatorFolderName(Collection existingNameList)
- {
- super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FOLDERNAME_NOTVALID);
- }
- /**
- * Use this constructor when the name must be unique. Give the
- * constructor a string array of existing names to compare against.
- */
- public ValidatorFolderName(String existingNameList[])
- {
- super(existingNameList, CASE_INSENSITIVE); // case sensitive uniqueness
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FOLDERNAME_NOTVALID);
- }
-
- /**
- * Use this constructor when the name need not be unique, and you just want
- * the syntax checking.
- */
- public ValidatorFolderName()
- {
- super(new String[0], CASE_INSENSITIVE);
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_FOLDERNAME_NOTVALID);
- }
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty
- * @param msg_NonUnique error message when value entered is not unique
- * @param msg_Invalid error message when syntax is not valid
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
- {
- super.setErrorMessages(msg_Empty, msg_NonUnique);
- this.msg_Invalid = msg_Invalid;
- }
-
- /**
- * Overridable extension point to check for invalidate characters beyond what Eclipse checks for
- * @return true if valid, false if not
- */
- protected boolean checkForBadCharacters(String newText)
- {
- return true;
- }
-
- public String toString()
- {
- return "FolderNameValidator class"; //$NON-NLS-1$
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
- /**
- * Validate each character.
- * Override of parent method.
- * Override yourself to refine the error checking.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- IStatus rc = workspace.validateName(newText, IResource.FOLDER);
- if (rc.getCode() != IStatus.OK)
- currentMessage = msg_Invalid;
- else if ((getMaximumNameLength() > 0) && // defect 42507
- (newText.length() > getMaximumNameLength()))
- currentMessage = msg_Invalid; // TODO: better message
- else
- currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
- return currentMessage;
- }
-
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Return the max length for folder names: 256
- */
- public int getMaximumNameLength()
- {
- return MAX_FOLDERNAME_LENGTH;
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerInput.java
deleted file mode 100644
index fa45544d0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerInput.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-/**
- * For editable numeric properties.
- * Ensures only digits are entered.
- */
-public class ValidatorIntegerInput implements ISystemValidator
-{
- protected boolean allowBlank = false;
- protected int number;
- protected SystemMessage emptyMsg, invalidMsg, currentMessage;
-
- /**
- * Constructor to use when the default error messages are ok
- * @see #setBlankAllowed(boolean)
- */
- public ValidatorIntegerInput()
- {
- this(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_EMPTY));
- }
- /**
- * Constructor to use when wanting to specify the "value required" error message,
- * but use the default for the "Value not valid" error message
- * @see #setBlankAllowed(boolean)
- */
- public ValidatorIntegerInput(SystemMessage emptyMsg)
- {
- this(emptyMsg, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NOT_NUMERIC));
- }
- /**
- * Constructor to use when wanting to specify both error messages
- * @see #setBlankAllowed(boolean)
- */
- public ValidatorIntegerInput(SystemMessage emptyMsg, SystemMessage invalidMsg)
- {
- setErrorMessages(emptyMsg, invalidMsg);
- }
-
- /**
- * Specify if an empty field is ok or not. The default is not, and will result in an error message.
- */
- public void setBlankAllowed(boolean allowBlank)
- {
- this.allowBlank = allowBlank;
- }
-
- /**
- * Set the error messages, overriding the defaults
- */
- public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
- {
- this.emptyMsg = emptyMsg;
- this.invalidMsg = invalidMsg;
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
- */
- public String isValid(Object input)
- {
- currentMessage = null;
- if (!(input instanceof String))
- {
- //return "Unknown input";
- number = 1;
- return null;
- }
- else
- return isValid((String)input);
- }
- /**
- * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
- * @see #getSystemMessage()
- */
- public String isValid(String input)
- {
- currentMessage = null;
- if ((input==null)||(input.length()==0))
- {
- if (!allowBlank)
- currentMessage = emptyMsg;
- }
- else
- {
- try
- {
- number = Integer.parseInt(input);
- }
- catch (NumberFormatException exc)
- {
- currentMessage = invalidMsg;
- currentMessage.makeSubstitution(input);
- }
- }
- return (currentMessage==null) ? null : currentMessage.getLevelOneText();
- }
-
- /**
- * When isValid returns non-null, call this to get the SystemMessage object for the error
- * versus the simple string message.
- */
- public SystemMessage getSystemMessage()
- {
- return currentMessage;
- }
-
- /**
- * Return the max length for this name, or -1 if no max.
- * For integers, the maximum is +- 2 to the 16th, so we set the max at 11 (to include the sign).
- */
- public int getMaximumNameLength()
- {
- return 11;
- }
-
- /**
- * For convenience, this is a shortcut to calling:
- * <pre><code>
- * if (isValid(text) != null)
- * msg = getSystemMessage();
- * </code></pre>
- */
- public SystemMessage validate(String text)
- {
- if (isValid(text) != null)
- return currentMessage;
- else
- return null;
- }
-
- /**
- * If validation is true, you can call this to get the input as a number
- */
- public int getNumber()
- {
- return number;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java
deleted file mode 100644
index af0a9cd9a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorIntegerRangeInput.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * For editable integer numbers that must be within a certain range to be valid
- */
-public class ValidatorIntegerRangeInput extends ValidatorIntegerInput
-{
- private int minRange, maxRange;
- private int orgMinRange, orgMaxRange;
- private Integer minRangeInt, maxRangeInt;
- private SystemMessage msg_InvalidRange;
-
- /**
- * Constructor when an empty field is not allowed (will result in an error message)
- * @param minRange - the lowest valid number
- * @param maxRange - the highest valid number
- */
- public ValidatorIntegerRangeInput(int minRange, int maxRange)
- {
- this(minRange, maxRange, false);
- }
- /**
- * Constructor when an empty field is allowed.
- * @param minRange - the lowest valid number
- * @param maxRange - the highest valid number
- * @param allowBlank - true if blanks allowed, false if not
- */
- public ValidatorIntegerRangeInput(int minRange, int maxRange, boolean allowBlank)
- {
- super(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_NOTVALID));
- msg_InvalidRange = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_OUTOFRANGE);
- this.orgMinRange = minRange;
- this.orgMaxRange = maxRange;
- super.setBlankAllowed(allowBlank);
- setRange(minRange, maxRange);
- }
-
- /**
- * Reset the range
- */
- public void setRange(int minRange, int maxRange)
- {
- this.minRange = minRange;
- this.maxRange = maxRange;
- minRangeInt = new Integer(minRange);
- maxRangeInt = new Integer(maxRange);
- }
- /**
- * Restore the range originally specified in the constructor
- */
- public void restoreRange()
- {
- setRange(orgMinRange, orgMaxRange);
- }
- /**
- * Set the error messages, overriding the defaults
- */
- public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg, SystemMessage outOfRangeMsg)
- {
- super.setErrorMessages(emptyMsg, invalidMsg);
- msg_InvalidRange = outOfRangeMsg;
- }
-
- /**
- * Return the max length for this name, or -1 if no max.
- * We return a max length that just allows the largest number in the range to be set, plus the sign if negative
- */
- public int getMaximumNameLength()
- {
- int maxlen = Integer.toString(Math.abs(maxRange)).length();
- if (maxRange < 0)
- ++maxlen;
- return maxlen;
- }
-
- /**
- * Intercept of parent to also add range checking
- */
- public String isValid(String input)
- {
- String msg = super.isValid(input);
- if ((msg == null) && (input != null) && (input.length()>0))
- {
- if ((number < minRange) || (number > maxRange))
- {
- currentMessage = msg_InvalidRange;
- currentMessage.makeSubstitution(input, minRangeInt, maxRangeInt);
- msg = currentMessage.getLevelOneText();
- }
- }
- return msg;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java
deleted file mode 100644
index deec46ec3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLocalPath.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.io.File;
-import java.util.Collection;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-
-
-/**
- * This class is used in dialogs that prompt for a local directory path.
- *
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorLocalPath extends ValidatorPathName
-{
-
-
- public static final boolean WINDOWS = System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0; //$NON-NLS-1$ //$NON-NLS-2$
- public static final char SEPCHAR = File.separatorChar;
-
- /**
- * Constructor for ValidatorLocalPath
- */
- public ValidatorLocalPath(Collection existingNameList)
- {
- super(existingNameList);
- }
-
- /**
- * Constructor for ValidatorLocalPath
- */
- public ValidatorLocalPath(String[] existingNameList)
- {
- super(existingNameList);
- }
-
- /**
- * Constructor for ValidatorLocalPath
- */
- public ValidatorLocalPath()
- {
- super();
- }
-
- /**
- * Validate each character.
- * Override of parent method.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- SystemMessage msg = super.isSyntaxOk(newText);
- if (msg == null)
- {
- boolean ok = true;
- if (WINDOWS)
- {
- if (newText.length()<3)
- ok = false;
- else if (newText.charAt(1) != ':')
- ok = false;
- else if (newText.charAt(2) != SEPCHAR)
- ok = false;
- else if (!Character.isLetter(newText.charAt(0)))
- ok = false;
- }
- else
- {
- if (newText.length()<1)
- ok = false;
- else if (newText.charAt(0) != SEPCHAR)
- ok = false;
- }
- if (!ok)
- msg = msg_Invalid;
- }
- return msg;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java
deleted file mode 100644
index 610a94144..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongInput.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-/**
- * For editable large numeric properties.
- * Ensures only digits are entered.
- */
-public class ValidatorLongInput implements ISystemValidator
-{
- protected boolean allowBlank = false;
- protected long number;
- protected SystemMessage emptyMsg, invalidMsg, currentMessage;
-
- /**
- * Constructor to use when the default error messages are ok
- * @see #setBlankAllowed(boolean)
- */
- public ValidatorLongInput()
- {
- this(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_EMPTY));
- }
- /**
- * Constructor to use when wanting to specify the "value required" error message,
- * but use the default for the "Value not valid" error message
- * @see #setBlankAllowed(boolean)
- */
- public ValidatorLongInput(SystemMessage emptyMsg)
- {
- this(emptyMsg, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NOT_NUMERIC));
- }
- /**
- * Constructor to use when wanting to specify both error messages
- * @see #setBlankAllowed(boolean)
- */
- public ValidatorLongInput(SystemMessage emptyMsg, SystemMessage invalidMsg)
- {
- setErrorMessages(emptyMsg, invalidMsg);
- }
-
- /**
- * Specify if an empty field is ok or not. The default is not, and will result in an error message.
- */
- public void setBlankAllowed(boolean allowBlank)
- {
- this.allowBlank = allowBlank;
- }
-
- /**
- * Set the error messages, overriding the defaults
- */
- public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg)
- {
- this.emptyMsg = emptyMsg;
- this.invalidMsg = invalidMsg;
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
- */
- public String isValid(Object input)
- {
- currentMessage = null;
- if (!(input instanceof String))
- {
- //return "Unknown input";
- number = 1;
- return null;
- }
- else
- return isValid((String)input);
- }
- /**
- * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
- * @see #getSystemMessage()
- */
- public String isValid(String input)
- {
- currentMessage = null;
- if ((input==null)||(input.length()==0))
- {
- if (!allowBlank)
- currentMessage = emptyMsg;
- }
- else
- {
- try
- {
- number = Long.parseLong(input);
- }
- catch (NumberFormatException exc)
- {
- currentMessage = invalidMsg;
- currentMessage.makeSubstitution(input);
- }
- }
- return (currentMessage==null) ? null : currentMessage.getLevelOneText();
- }
-
- /**
- * When isValid returns non-null, call this to get the SystemMessage object for the error
- * versus the simple string message.
- */
- public SystemMessage getSystemMessage()
- {
- return currentMessage;
- }
-
- /**
- * Return the max length for this name. For us, we return 20.
- */
- public int getMaximumNameLength()
- {
- return 20;
- }
-
- /**
- * For convenience, this is a shortcut to calling:
- * <pre><code>
- * if (isValid(text) != null)
- * msg = getSystemMessage();
- * </code></pre>
- */
- public SystemMessage validate(String text)
- {
- if (isValid(text) != null)
- return currentMessage;
- else
- return null;
- }
-
- /**
- * If validation is true, you can call this to get the input as a number
- */
- public long getNumber()
- {
- return number;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java
deleted file mode 100644
index 243d76430..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorLongRangeInput.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * For editable long numbers that must be within a certain range to be valid
- */
-public class ValidatorLongRangeInput extends ValidatorLongInput
-{
- private long minRange, maxRange;
- private long orgMinRange, orgMaxRange;
- private Long minRangeLong, maxRangeLong;
- private SystemMessage msg_InvalidRange;
-
- /**
- * Constructor when an empty field is not allowed (will result in an error message)
- * @param minRange - the lowest valid number
- * @param maxRange - the highest valid number
- */
- public ValidatorLongRangeInput(long minRange, long maxRange)
- {
- this(minRange, maxRange, false);
- }
- /**
- * Constructor when an empty field is allowed.
- * @param minRange - the lowest valid number
- * @param maxRange - the highest valid number
- * @param allowBlank - true if blanks allowed, false if not
- */
- public ValidatorLongRangeInput(long minRange, long maxRange, boolean allowBlank)
- {
- super(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_NOTVALID));
- msg_InvalidRange = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NUMBER_OUTOFRANGE);
- this.orgMinRange = minRange;
- this.orgMaxRange = maxRange;
- super.setBlankAllowed(allowBlank);
- setRange(minRange, maxRange);
- }
-
- /**
- * Reset the range
- */
- public void setRange(long minRange, long maxRange)
- {
- this.minRange = minRange;
- this.maxRange = maxRange;
- minRangeLong = new Long(minRange);
- maxRangeLong = new Long(maxRange);
- }
- /**
- * Restore the range originally specified in the constructor
- */
- public void restoreRange()
- {
- setRange(orgMinRange, orgMaxRange);
- }
- /**
- * Set the error messages, overriding the defaults
- */
- public void setErrorMessages(SystemMessage emptyMsg, SystemMessage invalidMsg, SystemMessage outOfRangeMsg)
- {
- super.setErrorMessages(emptyMsg, invalidMsg);
- msg_InvalidRange = outOfRangeMsg;
- }
- /**
- * Return the max length for this name, or -1 if no max.
- * We return a max length that just allows the largest number in the range to be set, plus the sign if negative
- */
- public int getMaximumNameLength()
- {
- int maxlen = Long.toString(Math.abs(maxRange)).length();
- if (maxRange < 0)
- ++maxlen;
- return maxlen;
- }
- /**
- * Intercept of parent to also add range checking
- */
- public String isValid(String input)
- {
- String msg = super.isValid(input);
- if ((msg == null) && (input != null) && (input.length()>0))
- {
- if ((number < minRange) || (number > maxRange))
- {
- currentMessage = msg_InvalidRange;
- currentMessage.makeSubstitution(input, minRangeLong, maxRangeLong);
- msg = currentMessage.getLevelOneText();
- }
- }
- return msg;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java
deleted file mode 100644
index 69eff5bcf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPathName.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for a name that eventually needs to become a folder path.
- * Simply checks for a few obviously bad characters.
- *
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorPathName
- extends ValidatorUniqueString
-{
-
- protected boolean fUnique;
- protected SystemMessage msg_Invalid;
- protected StringBuffer specialChars;
- private int nbrSpecialChars;
-
- /**
- * Use this constructor when the name must be unique.
- * @param existingNameList a collection of existing names to compare against.
- * This will not be modified by the validator.
- */
- public ValidatorPathName(Collection existingNameList)
- {
- super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness
- init();
- }
- /**
- * Use this constructor when the name must be unique. Give the
- * constructor a string array of existing names to compare against.
- */
- public ValidatorPathName(String existingNameList[])
- {
- super(existingNameList, CASE_INSENSITIVE); // case sensitive uniqueness
- init();
- }
-
- /**
- * Use this constructor when the name need not be unique, and you just want
- * the syntax checking.
- */
- public ValidatorPathName()
- {
- super(new String[0], CASE_INSENSITIVE);
- init();
- fUnique = false;
- }
-
- protected void init()
- {
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PATH_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PATH_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PATH_NOTVALID);
- specialChars = new StringBuffer("*?;'<>|"); //$NON-NLS-1$
- nbrSpecialChars = specialChars.length();
- }
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty
- * @param msg_NonUnique error message when value entered is not unique
- * @param msg_Invalid error message when syntax is not valid
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
- {
- super.setErrorMessages(msg_Empty, msg_NonUnique);
- this.msg_Invalid = msg_Invalid;
- }
-
- /**
- * Validate each character.
- * Override of parent method.
- * Override yourself to refine the error checking.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- //IStatus rc = workspace.validatePath(newText, IResource.FOLDER);
- //if (rc.getCode() != IStatus.OK)
- //return msg_Invalid;
- boolean ok = !containsSpecialCharacters(newText);
- if (!ok)
- return msg_Invalid;
- return null;
- }
-
- protected boolean containsSpecialCharacters(String newText)
- {
- boolean contains = false;
- int newLen = newText.length();
- for (int idx=0; !contains && (idx<newLen); idx++)
- {
- for (int jdx=0; !contains && (jdx<nbrSpecialChars); jdx++)
- if (newText.charAt(idx) == specialChars.charAt(jdx))
- contains = true;
- }
- return contains;
- }
-
- public String toString()
- {
- return "PathValidator class"; //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPortInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPortInput.java
deleted file mode 100644
index 646aa45c3..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorPortInput.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * For editable port number properties.
- * Ensures only digits are entered, and they appear to be a valid port.
- * TODO: what appears to be a valid port??
- */
-public class ValidatorPortInput extends ValidatorIntegerInput
-{
-
- public static final int MAXIMUM_PORT_NUMBER = 65535; // according to IP specification
-
- public ValidatorPortInput()
- {
- super(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_NOTVALID));
- }
-
- /**
- * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
- */
- public String isValid(Object input)
- {
- String msg = super.isValid(input);
- if (msg == null)
- {
- // yantzi: 2.1.2 added check for port > 65536 and changed msg to invalid port number
- if (number < 0 || number > MAXIMUM_PORT_NUMBER)
- {
- //if (number <= 0) // we don't let user enter 0 explicitly, only via button selection.
- //currentMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_EMPTY);
- currentMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_NOTVALID);
- msg = currentMessage.getLevelOneText();
- }
- }
- return msg;
- }
-
- /**
- * @see org.eclipse.rse.ui.validators.ValidatorIntegerInput#isValid(java.lang.String)
- */
- public String isValid(String input) {
- // yantzi:2.1.2 need to override this method in addition to the same
- // one that takes Object parametere otherwise we get the wrong error messages!
- String msg = super.isValid(input);
- if (msg == null)
- {
- // yantzi: 2.1.2 added check for port > 65536 and changed msg to invalid port number
- if (number < 0 || number > MAXIMUM_PORT_NUMBER)
- {
- //if (number <= 0) // we don't let user enter 0 explicitly, only via button selection.
- //currentMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_EMPTY);
- currentMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_NOTVALID);
- msg = currentMessage.getLevelOneText();
- }
- }
- return msg;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorProfileName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorProfileName.java
deleted file mode 100644
index 8de515031..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorProfileName.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for a profile name.
- * Relies on Eclipse supplied method to test for folder name validity.
- * <p>
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorProfileName
- extends ValidatorFolderName implements ISystemValidator
-{
- public static final int MAX_PROFILENAME_LENGTH = 100; // arbitrary restriction! Defect 41816
- private SystemMessage reservedNameMsg;
-
- /**
- * The collection of existing names can be null if this is not a rename operation.
- * @param existingNameList the collection of names to compare against.
- * This will not be modified by the validator.
- */
- public ValidatorProfileName(Collection existingNameList)
- {
- super(existingNameList);
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PROFILENAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PROFILENAME_NOTUNIQUE),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PROFILENAME_NOTVALID));
- }
-
- /**
- * Return the max length for profiles: 100
- */
- public int getMaximumNameLength()
- {
- return MAX_PROFILENAME_LENGTH;
- }
-
- /**
- * Return the msg for reserved names
- */
- private SystemMessage getReservedNameMessage()
- {
- if (reservedNameMsg == null)
- reservedNameMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PROFILENAME_RESERVED);
- return reservedNameMsg;
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
- /**
- * Parent intercept to ensure no reserved names are used.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- super.isSyntaxOk(newText);
- if (currentMessage == null)
- {
- if (newText.equalsIgnoreCase("private")) { //$NON-NLS-1$
- currentMessage = getReservedNameMessage();
- }
- else if (newText.indexOf('.') != -1) {
- currentMessage = msg_Invalid;
- }
-
- }
- return currentMessage;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java
deleted file mode 100644
index 322aa7399..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorRemoteSelection.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
-
-/**
- * On remote selection dialogs, you can pass an instance of this class to validate that
- * it is ok to enable the OK button when the user selects a remote object. If you return
- * a SystemMessage, ok will be disabled and the message will be shown on the message line.
- * Return a SystemMessage with blank in the first level text to disable OK without showing
- * an error message.
- * <p>
- * This class must be subclassed.Alternatively you can just implement {@link IValidatorRemoteSelection}
- */
-public abstract class ValidatorRemoteSelection implements IValidatorRemoteSelection
-{
-
- /**
- * The user has selected a remote object. Return null if OK is to be enabled, or a SystemMessage
- * if it is not to be enabled. The message will be displayed on the message line.
- */
- public abstract SystemMessage isValid(IHost selectedConnection, Object[] selectedObjects, ISystemRemoteElementAdapter[] remoteAdaptersForSelectedObjects);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java
deleted file mode 100644
index 9b9a53f0e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorServerPortInput.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-
-package org.eclipse.rse.ui.validators;
-
-import org.eclipse.rse.core.subsystems.RemoteServerLauncherConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-public class ValidatorServerPortInput extends ValidatorPortInput
-{
- /**
- * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
- */
- public String isValid(Object input)
- {
-
- String msg = super.isValid(input);
- if (msg == null)
- {
- // check that it's not a used port
- if (number == RemoteServerLauncherConstants.DEFAULT_DAEMON_PORT)
- {
- currentMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PORT_WARNING);
- currentMessage.makeSubstitution("4075", "RSE daemon"); //$NON-NLS-1$ //$NON-NLS-2$
- msg = currentMessage.getLevelOneText();
- }
- }
- return msg;
- }
-
- public String isValid(String input)
- {
- // yantzi:2.1.2 need to override this method in addition to the same
- // one that takes Object parametere otherwise we get the wrong error messages!
- String msg = super.isValid(input);
- if (msg == null)
- {
- // check that it's not a used port
- if (number == RemoteServerLauncherConstants.DEFAULT_DAEMON_PORT)
- {
- currentMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PORT_WARNING);
- currentMessage.makeSubstitution("4075", "RSE daemon"); //$NON-NLS-1$ //$NON-NLS-2$
- msg = currentMessage.getLevelOneText();
- }
- }
- return msg;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java
deleted file mode 100644
index 6fc871b66..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSourceType.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used to verify a user-entered source type. This is typically
- * subsystem-dependent, such as "*.cpp" for a universal file subsystem.
- * However, this class is defined to be easily subclassed.
- */
-public class ValidatorSourceType extends ValidatorUniqueString
- implements ISystemValidator
-{
- public static final int MAX_SRCTYPE_LENGTH = 50; // max name for a src type
-
- protected SystemMessage msg_Invalid;
-
- /**
- * Constructor. You must specify if src types are case-sensitive or not.
- * Typically, you will also call setExistingNames to set the list of existing src types
- * for uniqueness-validation.
- */
- public ValidatorSourceType(boolean caseSensitive)
- {
- super(new String[0], caseSensitive);
- init();
- }
-
- private void init()
- {
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_SRCTYPE_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_SRCTYPE_NOTUNIQUE));
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_SRCTYPE_NOTVALID);
- }
-
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty
- * @param msg_NonUnique error message when value entered is not unique
- * @param msg_Invalid error message when syntax is not valid
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
- {
- super.setErrorMessages(msg_Empty, msg_NonUnique);
- this.msg_Invalid = msg_Invalid;
- }
-
- /**
- * Overridable method for invalidate character check, beyond what this class offers
- * @return true if valid, false if not
- */
- protected boolean checkForBadCharacters(String newText)
- {
- return true;
- }
-
- public String toString()
- {
- return "ValidatorSourceType class"; //$NON-NLS-1$
- }
-
- // ---------------------------
- // Parent Overrides...
- // ---------------------------
- /**
- * Validate each character.
- * Override of parent method.
- * Override yourself to refine the error checking.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- if (newText.length() > getMaximumNameLength())
- currentMessage = msg_Invalid;
- else
- currentMessage = checkForBadCharacters(newText) ? null: msg_Invalid;
- return currentMessage;
- }
-
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Return the max length for folder names: 50
- */
- public int getMaximumNameLength()
- {
- return MAX_SRCTYPE_LENGTH;
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java
deleted file mode 100644
index 97ec10073..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSpecialChar.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for string, where the
- * string is not allowed to content special characters, as supplied to this class.
- *
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorSpecialChar
- implements ISystemValidator // IInputValidator, ICellEditorValidator
-{
-
- public static final boolean EMPTY_ALLOWED_NO = false;
- public static final boolean EMPTY_ALLOWED_YES= true;
- private boolean isEmptyAllowed = true;
- protected StringBuffer specialChars;
- protected SystemMessage msg_Invalid;
- protected SystemMessage msg_Empty;
- protected SystemMessage currentMessage;
- private int nbrSpecialChars;
-
- /**
- * Constructor
- * @param specialChars String containing special characters to test for.
- * @param isEmptyAllowed true if an empty string is valid
- */
- public ValidatorSpecialChar(String specialChars, boolean isEmptyAllowed)
- {
- this(specialChars, isEmptyAllowed, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_NOTVALID), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_EMPTY));
- }
- /**
- * Constructor
- * @param specialChars String containing special characters to test for.
- * @param isEmptyAllowed true if an empty string is valid
- * @param msg_Invalid error message when invalid characters entered
- */
- public ValidatorSpecialChar(String specialChars, boolean isEmptyAllowed, SystemMessage msg_Invalid)
- {
- this(specialChars, isEmptyAllowed, msg_Invalid, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_EMPTY));
- }
- /**
- * Constructor
- * @param specialChars String containing special characters to test for.
- * @param isEmptyAllowed true if an empty string is valid
- * @param msg_Invalid error message when invalid characters entered
- * @param msg_Empty error message when empty string
- */
- public ValidatorSpecialChar(String specialChars, boolean isEmptyAllowed, SystemMessage msg_Invalid, SystemMessage msg_Empty)
- {
- this.isEmptyAllowed = isEmptyAllowed;
- this.specialChars = new StringBuffer(specialChars);
- this.nbrSpecialChars = specialChars.length();
- setErrorMessages(msg_Empty, msg_Invalid);
- }
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty or null if to keep the default
- * @param msg_Invalid error message when value entered is not valid, or null if to keep the default
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_Invalid)
- {
- if (msg_Empty != null)
- this.msg_Empty = msg_Empty;
- if (msg_Invalid != null)
- this.msg_Invalid = msg_Invalid;
- }
-
- // --------------------------
- // Internal helper methods...
- // --------------------------
-
- /**
- * Helper method to substitute data into a message
- */
- protected String doMessageSubstitution(SystemMessage msg, String substitution)
- {
- currentMessage = msg;
- if (msg.getNumSubstitutionVariables() > 0)
- return msg.makeSubstitution(substitution).getLevelOneText();
- else
- return msg.getLevelOneText();
- }
-
- /**
- * Helper method to set the current system message and return its level one text
- */
- protected String getSystemMessageText(SystemMessage msg)
- {
- currentMessage = msg;
- if (msg != null)
- return msg.getLevelOneText();
- else
- return null;
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Validate each character.
- */
- public String isValid(String newText)
- {
- currentMessage = null;
- if ((newText==null) || (newText.length() == 0))
- {
- if (isEmptyAllowed)
- return null;
- else
- currentMessage = msg_Empty;
- }
- else if (containsSpecialCharacters(newText))
- currentMessage = msg_Invalid;
- else
- currentMessage = isSyntaxOk(newText);
- return (currentMessage == null) ? null : doMessageSubstitution(currentMessage, newText);
- }
-
- /**
- * As required by ICellEditor
- */
- public String isValid(Object newValue)
- {
- if (newValue instanceof String)
- return isValid((String)newValue);
- else
- return null;
- }
-
-
- protected boolean containsSpecialCharacters(String newText)
- {
- boolean contains = false;
- int newLen = newText.length();
- for (int idx=0; !contains && (idx<newLen); idx++)
- {
- for (int jdx=0; !contains && (jdx<nbrSpecialChars); jdx++)
- if (newText.charAt(idx) == specialChars.charAt(jdx))
- contains = true;
- }
- return contains;
- }
-
- /**
- * Override in child to do your own syntax checking.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- return null;
- }
-
- /**
- * Return the max length for this name, or -1 if no max
- */
- public int getMaximumNameLength()
- {
- return -1;
- }
-
- /**
- * When isValid returns non-null, call this to get the SystemMessage object for the error
- * versus the simple string message.
- */
- public SystemMessage getSystemMessage()
- {
- return currentMessage;
- }
-
- /**
- * For convenience, this is a shortcut to calling:
- * <pre><code>
- * if (isValid(text) != null)
- * msg = getSystemMessage();
- * </code></pre>
- */
- public SystemMessage validate(String text)
- {
- if (isValid(text) != null)
- return currentMessage;
- else
- return null;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java
deleted file mode 100644
index 3af44fd05..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorSystemName.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Collection;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for an alias name.
- * The rules used are the same as for Java names, for simplicity.
- * Depending on the constructor used, this will also check for duplicates.
- *
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorSystemName
- extends ValidatorUniqueString
-{
-
- //protected String[] existingNames;
- protected boolean fUnique;
- //protected String msg_Empty;
- //protected String msg_NonUnique;
- protected SystemMessage msg_Invalid;
-
- /**
- * Use this constructor when the name must be unique.
- * @param existingNameList a collection of existing names to compare against.
- * This collection will not be modified by the validator.
- */
- public ValidatorSystemName(Collection existingNameList)
- {
- super(existingNameList, true); // case sensitive uniqueness
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTVALID);
- }
- /**
- * Use this constructor when the name must be unique. Give the
- * ctor a string array of existing names to compare against.
- */
- public ValidatorSystemName(String existingNameList[])
- {
- super(existingNameList, true); // case sensitive uniqueness
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = true;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTVALID);
- }
-
- /**
- * Use this constructor when the name need not be unique, and you just want
- * the syntax checking.
- */
- public ValidatorSystemName()
- {
- super(new String[0], true);
- super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTUNIQUE));
- fUnique = false;
- msg_Invalid = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_NOTVALID);
- }
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty
- * @param msg_NonUnique error message when value entered is not unique
- * @param msg_Invalid error message when syntax is not valid
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique, SystemMessage msg_Invalid)
- {
- super.setErrorMessages(msg_Empty, msg_NonUnique);
- this.msg_Invalid = msg_Invalid;
- }
-
- public String toString()
- {
- return "SystemNameValidator class"; //$NON-NLS-1$
- }
-
- // -------------------
- // Parent overrides...
- // -------------------
-
- /**
- * Validate each character.
- * Override of parent method.
- * Override yourself to refine the error checking.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- char currChar = newText.charAt(0);
- if (!Character.isJavaIdentifierStart(currChar))
- return msg_Invalid;
- for (int idx=1; idx<newText.length(); idx++)
- {
- currChar = newText.charAt(idx);
- if (!Character.isJavaIdentifierPart(currChar))
- return msg_Invalid;
- }
- return null;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUniqueString.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUniqueString.java
deleted file mode 100644
index b52162686..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUniqueString.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - generalized Vector argumnents to Collections
- * Kevin Doyle (IBM) - 174776: perform required sorting of Collection arguments
- * David Dykstal (IBM) - 174776: disallowed sorting of input arguments, used copies
- *******************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for a string
- * that has to be unique. Unless you use the constructor that takes another
- * IInputValidator as input, no syntax checking is done other than checking
- * the input is non-empty and unique.
- *
- * The IInputValidator interface is implemented by our parent and it
- * is used by jface's InputDialog class and property sheet window.
- */
-public class ValidatorUniqueString
- implements ISystemValidator, ISystemValidatorUniqueString
- //,IInputValidator, ICellEditorValidator ... ISystemValidator extends these
-{
-
- public static final boolean CASE_SENSITIVE = true;
- public static final boolean CASE_INSENSITIVE = false;
- public static final char QUOTE = '\"';
- private static final String[] EMPTY_LIST = new String[0];
-
- protected ISystemValidator syntaxValidator;
- protected boolean caseSensitive;
- protected boolean useUpperCase;
- protected String existingList[];
- protected SystemMessage msg_Empty;
- protected SystemMessage msg_NonUnique;
- protected SystemMessage currentMessage;
-
- /**
- * @param existingList a collection of existing strings to compare against.
- * Note that toString() is used to get the string from each item.
- * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
- */
- public ValidatorUniqueString(Collection existingList, boolean caseSensitive)
- {
- this.caseSensitive = caseSensitive;
- setExistingNamesList(existingList);
- // initialize error messages
- setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_NOTUNIQUE));
- }
- /**
- * Constructor accepting an Array.
- * @param existingList An array containing list of existing strings to compare against.
- * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
- */
- public ValidatorUniqueString(String existingList[], boolean caseSensitive)
- {
- this.caseSensitive = caseSensitive;
- init(existingList, caseSensitive);
- // initialize error messages
- setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_EMPTY),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_NOTUNIQUE));
- }
- /**
- * Constructor accepting a collection and another validator to use for the syntax checking.
- * @param existingList A collection of existing strings to compare against.
- * Note that toString() is used to get the string from each item.
- * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
- * @param syntaxValidator Another IInputValidator who does the job of checking the syntax. After
- * checking for non-nullness and uniqueness, this validator is used to
- * check for syntax.
- */
- public ValidatorUniqueString(Collection existingList, boolean caseSensitive,
- ISystemValidator syntaxValidator)
- {
- this(existingList, caseSensitive);
- this.syntaxValidator = syntaxValidator;
- }
- /**
- * Constructor accepting an Array and another validator to use for the syntax checking.
- * @param existingList An array containing list of existing strings to compare against.
- * @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
- * @param syntaxValidator Another IInputValidator who does the job of checking the syntax. After
- * checking for non-nullness and uniqueness, this validator is used to
- * check for syntax.
- */
- public ValidatorUniqueString(String existingList[], boolean caseSensitive,
- ISystemValidator syntaxValidator)
- {
- this(existingList, caseSensitive);
- this.syntaxValidator = syntaxValidator;
- }
- /**
- * Reset whether this is a case-sensitive list or not
- */
- public void setCaseSensitive(boolean caseSensitive)
- {
- this.caseSensitive = caseSensitive;
- }
- /**
- * For case-insensitive, we typically fold to lowercase, affecting what
- * this user sees in the substitution value of error messages.
- * Call this so the value substituted is uppercase vs lowercase.
- */
- public void setUseUpperCase()
- {
- this.useUpperCase = true;
- }
-
- /**
- * Reset the collection of existing names.
- * The collection will not be modified by the validator.
- */
- public void setExistingNamesList(Collection newList)
- {
- if (newList == null)
- existingList = null;
- else
- {
- existingList = new String[newList.size()];
- newList.toArray(existingList);
- init(existingList, caseSensitive);
- }
- }
- /**
- * Reset the existing names list.
- */
- public void setExistingNamesList(String[] existingList)
- {
- if (existingList == null)
- this.existingList = null;
- else
- init(existingList, caseSensitive);
- }
-
- /**
- * Return the existing names list. This will be a case-normalized and sorted list.
- */
- public String[] getExistingNamesList()
- {
- return existingList;
- }
-
- /**
- * Initialize sorted array.
- */
- private void init(String names[], boolean caseSensitive) {
- if (names == null) {
- existingList = EMPTY_LIST;
- } else {
- existingList = new String[names.length];
- System.arraycopy(names, 0, existingList, 0, names.length);
- // TODO (dwd 20070530) this should be using ICU4J to fold case.
- if (!caseSensitive) { // speed up comparison by converting to all lowercase
- for (int idx = 0; idx < existingList.length; idx++) {
- String string = existingList[idx];
- boolean quoted = (string.indexOf(QUOTE) != -1);
- if (!quoted) {
- existingList[idx] = string.toLowerCase();
- } else {
- existingList[idx] = quotedToLowerCase(string);
- }
- }
- }
- Arrays.sort(existingList); // Arrays is a utility class in java.util. New in JDK 1.2
- }
- }
-
- /**
- * Special-case way to fold non-quoted parts of a string to lowercase
- */
- public static String quotedToLowerCase(String input)
- {
- StringBuffer buffer = new StringBuffer(input.length());
- //System.out.println("INPUT : " + input);
- boolean inQuotes = false;
- for (int idx=0; idx<input.length(); idx++)
- {
- char c = input.charAt(idx);
- if (c == QUOTE)
- inQuotes = !inQuotes;
- else if (!inQuotes)
- c = Character.toLowerCase(c);
- buffer.append(c);
- }
- //System.out.println("OUTPUT: " + buffer.toString());
- return buffer.toString();
- }
-
- /**
- * Supply your own error message text. By default, messages from RSEUIPlugin resource bundle are used.
- * @param msg_Empty error message when entry field is empty or null if to keep the default
- * @param msg_NonUnique error message when value entered is not unique or null if to keep the default
- */
- public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique)
- {
- if (msg_Empty != null)
- this.msg_Empty = msg_Empty;
- if (msg_NonUnique != null)
- this.msg_NonUnique = msg_NonUnique;
- }
-
- /**
- * Override in child to do your own syntax checking.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- return null;
- }
-
- public String toString()
- {
- return "UniqueNameValidator class"; //$NON-NLS-1$
- }
-
- // --------------------------
- // Internal helper methods...
- // --------------------------
-
- /**
- * Helper method to substitute data into a message
- */
- protected String doMessageSubstitution(SystemMessage msg, String substitution)
- {
- currentMessage = msg;
- if (msg.getNumSubstitutionVariables() > 0)
- {
- if (!useUpperCase)
- return msg.makeSubstitution(substitution).getLevelOneText();
- else
- return msg.makeSubstitution(substitution.toUpperCase()).getLevelOneText();
- }
- else
- return msg.getLevelOneText();
- }
-
- /**
- * Helper method to set the current system message and return its level one text
- */
- protected String getSystemMessageText(SystemMessage msg)
- {
- currentMessage = msg;
- if (msg != null)
- return msg.getLevelOneText();
- else
- return null;
- }
-
- // ---------------------------
- // ISystemValidator methods...
- // ---------------------------
-
- /**
- * Validates the given string. Returns the error message
- * used if the given string isn't valid. A return value
- * <code>null</code> or a string of length zero indicates
- * that the value is valid.
- * Note this is called per keystroke, by the platform.
- * @deprecated You should be using {@link #validate(String)} and SystemMessage objects
- */
- public String isValid(String newText)
- {
- currentMessage = null;
- newText = newText.trim();
- if (newText.length() == 0)
- currentMessage = msg_Empty;
- else
- {
- if (!caseSensitive && (existingList!=null))
- {
- if (newText.indexOf(QUOTE)!=-1)
- newText = quotedToLowerCase(newText);
- else
- newText = newText.toLowerCase();
- }
- /*
- if (!caseSensitive && (existingList!=null) && (Arrays.binarySearch(existingList,newText) >= 0))
- return msg_NonUnique.getLevelOneText();
- else if (caseSensitive && (existingList!=null) && (Arrays.binarySearch(existingList,newText) >= 0))
- return msg_NonUnique.getLevelOneText();
- */
- if ((existingList!=null) && (Arrays.binarySearch(existingList,newText) >= 0))
- currentMessage = msg_NonUnique;
- else if (syntaxValidator!=null)
- {
- String msg = syntaxValidator.isValid(newText);
- if (msg != null)
- {
- currentMessage = syntaxValidator.getSystemMessage();
- if (currentMessage == null) // tsk, tsk
- return msg;
- }
- }
- else
- currentMessage = isSyntaxOk(newText);
- }
- return (currentMessage == null) ? null : doMessageSubstitution(currentMessage, newText);
- }
-
- /**
- * As required by ICellEditor
- */
- public String isValid(Object newValue)
- {
- if (newValue instanceof String)
- return isValid((String)newValue);
- else
- {
- currentMessage = null;
- return null;
- }
- }
-
- /**
- * Return the max length for this name, or -1 if no max
- */
- public int getMaximumNameLength()
- {
- return -1;
- }
-
- /**
- * When isValid returns non-null, call this to get the SystemMessage object for the error
- * versus the simple string message.
- */
- public SystemMessage getSystemMessage()
- {
- return currentMessage;
- }
-
- /**
- * For convenience, this is a shortcut to calling:
- * <pre><code>
- * if (isValid(text) != null)
- * msg = getSystemMessage();
- * </code></pre>
- */
- public SystemMessage validate(String text)
- {
- if (isValid(text) != null)
- return currentMessage;
- else
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java
deleted file mode 100644
index a67e79011..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/validators/ValidatorUserId.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.validators;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-/**
- * This class is used in dialogs that prompt for a userId.
- * This does very basic userId validation, just to ensure there are no problems when the
- * user Id is saved in the preferences. This means restricting use of a couple special characters
- * that would mess up the key/value processing of the preference data.
- *
- * The IInputValidator interface is used by jface's
- * InputDialog class and numerous other platform and system classes.
- */
-public class ValidatorUserId
- extends ValidatorSpecialChar
-{
- /**
- * Constructor
- */
- public ValidatorUserId(boolean isEmptyAllowed)
- {
- super("=;", isEmptyAllowed, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_NOTVALID), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY)); //$NON-NLS-1$
- }
-
- /**
- * We could do additional syntax checking here if we decide to.
- * This method is called by parent class if all other error checking passes.
- */
- public SystemMessage isSyntaxOk(String newText)
- {
- return null;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java
deleted file mode 100644
index ed28f957d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemRemoteAdapterFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * Abstraction of the work needed to create an adapter factory for an adapter
- * that extends {@link AbstractSystemViewAdapter}.
- */
-public abstract class AbstractSystemRemoteAdapterFactory implements IAdapterFactory
-{
-
- /**
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(Object, Class)
- */
- public abstract Object getAdapter(Object adaptableObject, Class adapterType);
-
- /**
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList()
- {
- return new Class[] {ISystemViewElementAdapter.class, ISystemDragDropAdapter.class, ISystemRemoteElementAdapter.class,
- IPropertySource.class, IWorkbenchAdapter.class, IActionFilter.class, IDeferredWorkbenchAdapter.class};
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java
deleted file mode 100644
index 16a5541b8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java
+++ /dev/null
@@ -1,2354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Allow to extend action filter by dynamic system type providers.
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [189163] Update IActionFilter constants from subsystemFactory to subsystemConfiguration
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [208803] add exists() method
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * Martin Oberhuber (Wind River) - [234215] improve API documentation for doDelete and doDeleteBatch
- * David McKnight (IBM) - [239368] Expand to action ignores the filter string
- * David McKnight (IBM) - [243263] NPE on expanding a filter - null pointer checks
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterStringReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemResourceSet;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.core.model.SystemRemoteResourceSet;
-import org.eclipse.rse.core.model.SystemWorkspaceResourceSet;
-import org.eclipse.rse.core.subsystems.AbstractResource;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.ISystemMementoConstants;
-import org.eclipse.rse.internal.ui.view.SystemViewPart;
-import org.eclipse.rse.internal.ui.view.SystemViewResources;
-import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.model.ISystemPromptableObject;
-import org.eclipse.rse.ui.operations.Policy;
-import org.eclipse.rse.ui.operations.SystemFetchOperation;
-import org.eclipse.rse.ui.operations.SystemSchedulingRule;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-
-
-/**
- * Base class for adapters needed for the SystemView viewer.
- * It implements the ISystemViewElementAdapter interface.
- * @see AbstractSystemRemoteAdapterFactory
- */
-public abstract class AbstractSystemViewAdapter implements ISystemViewElementAdapter, IWorkbenchAdapter,
- IDeferredWorkbenchAdapter
-{
- // Static action filter per system type cache. Filled from testAttribute.
- private final static Map ACTION_FILTER_CACHE = new HashMap();
-
- // Internal helper class to cache system type -> no action filter relation ships.
- // Used from testAttribute.
- private final static class NULL_ACTION_FILTER implements IActionFilter {
- public boolean testAttribute(Object target, String name, String value) {
- return false;
- }
- }
-
- //protected boolean isEditable = false;
-
- private String filterString = null;
-
- /**
- * Current viewer. Set by content provider.
- *
- * @deprecated use {@link #getViewer()} and {@link #setViewer(Viewer)}
- */
- protected Viewer viewer = null;
-
- /**
- * Current input provider. Set by content provider.
- */
- protected Object propertySourceInput = null;
-
- /**
- * Current shell, set by the content provider.
- *
- * @deprecated Use {@link #getShell()} and {@link #setShell(Shell)}
- */
- protected Shell shell;
- private ISystemViewInputProvider input;
- private String xlatedYes = null;
- private String xlatedNo = null;
- private String xlatedTrue = null;
- private String xlatedFalse = null;
- private String xlatedNotApplicable = null;
- private String xlatedNotAvailable = null;
-
- /**
- * An empty object list instance, for returning an empty list from
- * getChildren: new Object[0].
- *
- * @deprecated Do not use directly. Use {@link #checkForEmptyList(Object[],
- * Object, boolean)} when needed.
- */
- protected Object[] emptyList = new Object[0];
-
- /**
- * For returning a message object from getChildren. Will be an array with
- * one item, one of nullObject, cancelledObject or errorObject.
- *
- * @deprecated Do not use directly. Use {@link #getCancelledMessageObject()}
- * or {@link #getFailedMessageObject()} or {@link
- * #checkForEmptyList(Object[], Object, boolean)} when needed.
- */
- protected Object[] msgList = new Object[1];
-
- /**
- * Frequently returned message object from getChildren: "empty list"
- *
- * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)}
- * instead.
- */
- protected SystemMessageObject nullObject = null;
-
- /**
- * Frequently returned message object from getChildren: "operation
- * cancelled".
- *
- * This field was renamed from "canceledObject" in RSE 3.0.
- *
- * @since org.eclipse.rse.ui 3.0
- * @deprecated Use {@link #getCancelledMessageObject()} instead.
- */
- protected SystemMessageObject cancelledObject = null;
-
- /**
- * Frequently returned message object from getChildren: "operation ended in
- * error"
- *
- * @deprecated Use {@link #getFailedMessageObject()} instead.
- */
- protected SystemMessageObject errorObject = null;
-
- /**
- * Message substitution prefix: "&"
- *
- * @deprecated use Eclipse NLS or Java Messageformat for String
- * substitution.
- */
- protected static final String MSG_SUB_PREFIX = "&"; //$NON-NLS-1$
-
- /**
- * Message substitution variable 1: "&1"
- *
- * @deprecated use Eclipse NLS or Java Messageformat for String
- * substitution.
- */
- protected static final String MSG_SUB1 = MSG_SUB_PREFIX+"1"; //$NON-NLS-1$
-
- /**
- * Message substitution variable 2: "&2"
- *
- * @deprecated use Eclipse NLS or Java Messageformat for String
- * substitution.
- */
- protected static final String MSG_SUB2 = MSG_SUB_PREFIX+"2"; //$NON-NLS-1$
-
- /**
- * Delimiter for each object's key in a memento, used to persist tree view expansion state: "///"
- */
- public static final String MEMENTO_DELIM = SystemViewPart.MEMENTO_DELIM;
-
- /**
- * A handy constant of "new String[0]"
- */
- protected static final String[] EMPTY_STRING_LIST = new String[0];
-
- // -------------------
- // default descriptors
- // -------------------
- private static PropertyDescriptor[] propertyDescriptorArray = null;
-
- // DKM: temporary memory caching stuff - we should replace this with something
- // more comprehensive later
-
- /**
- * A variable that can be used in getChildren to cache last returned results, if desired
- */
- protected Object[] _lastResults = null;
-
- /**
- * A variable that can be used to cache last selection, if desired
- */
- protected Object _lastSelected = null;
-
- private Preferences fPrefStore = null;
-
- /**
- * Static constructor.
- */
- static {
- ACTION_FILTER_CACHE.clear();
- }
-
- // ------------------------------------------------------------------
- // Configuration methods, called by the label and content provider...
- // ------------------------------------------------------------------
-
- /**
- * Set the viewer that is driving this adapter Called by label and content
- * provider.
- * <p>
- * <i>Configuration method. Typically called by content provider, viewer or
- * action. Do not override.</i>
- */
- public final void setViewer(Viewer viewer)
- {
- this.viewer = viewer;
- }
-
- /**
- * Set the shell to be used by any method that requires it.
- * <p>
- * <i>Configuration method. Typically called by content provider, viewer or
- * action. Do not override.</i>
- */
- public final void setShell(Shell shell)
- {
- this.shell = shell;
- }
-
- /**
- * Set the input object used to populate the viewer with the roots. May be
- * used by an adapter to retrieve context-sensitive information. This is set
- * by the Label and Content providers that retrieve this adapter.
- * <p>
- * <i>Configuration method. Typically called by content provider, viewer or
- * action. Do not override.</i>
- */
- public final void setInput(ISystemViewInputProvider input)
- {
- this.input = input;
- }
-
- // ------------------------------------------------------------------
- // Getter methods, for use by subclasses and actions...
- // ------------------------------------------------------------------
-
- /**
- * Get the shell currently hosting the objects in this adapter.
- * <p>
- * <i>Getter method. Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public Shell getShell()
- {
- if (shell == null || shell.isDisposed() || !shell.isVisible() || !shell.isEnabled())
- {
- // get a new shell
- // FIXME it looks like actions could be contributed into a wrong shell with this.
- Shell[] shells = Display.getCurrent().getShells();
- Shell lshell = null;
- for (int i = 0; i < shells.length && lshell == null; i++)
- {
- if (!shells[i].isDisposed() && shells[i].isEnabled() && shells[i].isVisible())
- {
- lshell = shells[i];
- }
- }
- if (lshell == null)
- lshell = SystemBasePlugin.getActiveWorkbenchShell();
- shell = lshell;
- }
- return shell;
- }
-
- /**
- * Return the current viewer, as set via setViewer or its deduced from the
- * setInput input object if set. May be null so test it.
- * <p>
- * <i>Getter method. Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public Viewer getViewer()
- {
- if (viewer == null)
- {
- ISystemViewInputProvider ip = getInput();
- if (ip != null)
- {
- return (Viewer)ip.getViewer();
- }
- else
- {
- IWorkbenchPart currentPart = SystemBasePlugin.getActiveWorkbenchWindow().getActivePage().getActivePart();
- if (currentPart instanceof IRSEViewPart)
- {
- return ((IRSEViewPart)currentPart).getRSEViewer();
- }
- }
-
- }
- return viewer;
- }
-
- /**
- * Return the current viewer as an ISystemTree if it is one, or null
- * otherwise.
- * <p>
- * <i>Getter method. Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected ISystemTree getCurrentTreeView()
- {
- Viewer v = getViewer();
- if (v instanceof ISystemTree)
- return (ISystemTree)v;
- else
- return null;
- }
-
- /**
- * Get the input object used to populate the viewer with the roots. May be
- * used by an adapter to retrieve context-sensitive information.
- * <p>
- * <i>Getter method. Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public ISystemViewInputProvider getInput()
- {
- return input;
- }
-
- /**
- * Returns the subsystem that contains this object. By default, if the given
- * element is an instance of {@link
- * org.eclipse.rse.core.subsystems.AbstractResource AbstractResource}, it
- * calls getSubSystem on it, else returns null.
- * <p>
- * <i><b>Overridable</b> by subclasses. You should override if not using
- * AbstractResource.</i> <br>
- */
- public ISubSystem getSubSystem(Object element)
- {
- if (element instanceof AbstractResource)
- return ((AbstractResource)element).getSubSystem();
- else if (element instanceof IContextObject)
- return ((IContextObject)element).getSubSystem();
- else
- return null;
- }
-
- /**
- * Returns any framework-supplied remote object actions that should be contributed to the popup menu
- * for the given selection list. This does nothing if this adapter does not implement ISystemViewRemoteElementAdapter,
- * else it potentially adds menu items for "User Actions" and Compile", for example. It queries the subsystem
- * factory of the selected objects to determine if these actions are appropriate to add.
- * <p>
- * <i>Called by SystemView viewer. No need to override or call.</i><br>
- *
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell of viewer calling this. Most dialogs require a shell.
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addCommonRemoteActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- if (this instanceof ISystemRemoteElementAdapter)
- {
- ISystemRemoteElementAdapter rmtAdapter = (ISystemRemoteElementAdapter)this;
- Object firstSelection = getFirstSelection(selection);
- ISubSystem ss = rmtAdapter.getSubSystem(firstSelection);
- if (ss != null)
- {
- ISubSystemConfiguration ssf = ss.getSubSystemConfiguration();
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)ssf.getAdapter(ISubSystemConfigurationAdapter.class);
- adapter.addCommonRemoteActions(ssf, menu, selection, shell, menuGroup, ss);
- }
- }
-
- }
-
- /**
- * Add or remove custom actions dynamically to a context menu.
- *
- * This method is called by the system viewers. Extenders may
- * override this method in order to modify the context menu
- * shown for elements of the type they adapt to.
- * Unlike addCommonRemoteActions(), these contributions are for
- * any artifact in the RSE views and are contributed independently
- * of subsystem factories.
- *
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell of viewer calling this. Most dialogs require a shell.
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- */
- public void addDynamicPopupMenuActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup)
- {
- // empty by default, extenders may override.
- // these extensions are independent of subsystem factories and are contributed via extension point
- }
-
- /**
- * This is your opportunity to add actions to the popup menu for the given
- * selection.
- * <p>
- * To put your action into the given menu, use the menu's {@link
- * org.eclipse.
- * rse.ui.SystemMenuManager#add(String,org.eclipse.jface.action.IAction)
- * add} method. If you don't care where it goes within the popup, just pass
- * the given <samp>menuGroup</samp> location id, otherwise pass one of the
- * GROUP_XXX values from {@link
- * org.eclipse.rse.ui.ISystemContextMenuConstants}. If you pass one that
- * identifies a predefined cascading menu, such as GROUP_OPENWITH, your
- * action will magically appear in that cascading menu, even if it was
- * otherwise empty.
- * <p>
- * For the actions themselves, you will probably use one of the base action
- * classes:
- * <ul>
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseAction SystemBaseAction}
- * . For a simple action doesn't present any UI.
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseDialogAction
- * SystemBaseDialogAction}. For an action that presents a {@link
- * org.eclipse.rse.ui.dialogs.SystemPromptDialog dialog}.
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseDialogAction
- * SystemBaseWizardAction}. For an action that presents a {@link
- * org.eclipse.rse.ui.wizards.AbstractSystemWizard wizard}.
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseSubMenuAction
- * SystemBaseSubMenuAction} . For an action that cascades into a submenu
- * with other actions.
- * </ul>
- *
- * @param menu the popup menu you can contribute to
- * @param selection the current selection in the calling tree or table view
- * @param parent the shell of the calling tree or table view
- * @param menuGroup the default menu group to place actions into if you
- * don't care where they. Pass this to the SystemMenuManager {@link
- * org.eclipse.rse.ui.SystemMenuManager#add(String,org.eclipse.jface.
- * action.IAction) add} method.
- *
- * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#addActions(
- * SystemMenuManager, IStructuredSelection, Shell, String)
- */
- public abstract void addActions(SystemMenuManager menu,IStructuredSelection selection,Shell parent,String menuGroup);
-
- /**
- * {@inheritDoc} <i><b>Abstract</b>. Must be overridden by subclasses.</i>
- * <br>
- */
- public abstract ImageDescriptor getImageDescriptor(Object element);
-
- /**
- * Return the alternate label for this object. By default this
- * just returns the regular label. If a custom label is required,
- * this provides the means to it.
- * @see #getName(Object)
- * @see #getAbsoluteName(Object)
- */
- public String getAlternateText(Object element)
- {
- return getText(element);
- }
-
- /**
- * {@inheritDoc} By default, returns <samp>getText(element);</samp>, but
- * child classes can override if display name doesn't equal real name.
- * <p>
- * Called by common rename and delete actions, and used to populate property
- * sheet.
- * <p>
- * <i><b>Overridable</b> by subclasses, but rarely needs to be.</i> <br>
- *
- * @see #getText(Object)
- * @see #getAbsoluteName(Object)
- */
- public String getName(Object element)
- {
- return getText(element);
- }
-
- /**
- * {inheritDoc} We map to <samp>getText(element)</samp>.
- * <p>
- * <i>Internal use. Can be safely ignored.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public String getLabel(Object element)
- {
- if (element instanceof IContextObject)
- {
- element = ((IContextObject)element).getModelObject();
- }
- return getText(element);
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * <i><b>Abstract</b>. Must be overridden by subclasses.</i> <br>
- */
- public abstract String getType(Object element);
-
- /**
- * {@inheritDoc} The default is:
- * <pre>
- * getType(): getName()
- * </pre>
- * <p>
- * <i><b>Overridable</b> by subclasses, but rarely needs to be.</i> <br>
- */
- public String getStatusLineText(Object element)
- {
- return getType(element) + ": " + getName(element); //$NON-NLS-1$
- }
-
- /**
- * {inheritDoc} By default, this method returns true - override this method
- * to customize the behavior.
- *
- * @param element the element to check
- * @return true if the element exists
- * @since 3.0
- */
- public boolean exists(Object element)
- {
- return true;
- }
-
- /**
- * {@inheritDoc} <i><b>Abstract</b>. Must be overridden by subclasses.</i>
- * <br>
- */
- public abstract Object getParent(Object element);
-
- /**
- * {@inheritDoc} <i><b>Abstract</b>. Must be overridden by subclasses.</i>
- * <br>
- *
- * @param element the element to check
- * @return <code>true</code> if this element can have children.
- */
- public abstract boolean hasChildren(IAdaptable element);
-
- /**
- * {@inheritDoc} Override this to provide context-specific support.
- *
- * @param element the context object
- * @return whether the context has children
- */
- public boolean hasChildren(IContextObject element)
- {
- return hasChildren(element.getModelObject());
- }
-
- /**
- * {@inheritDoc} Rather than overriding this, adapter implementors should
- * override the getChildren() methods that take a progress monitor.
- */
- public final Object[] getChildren(Object object)
- {
- return getChildren((IAdaptable)object, new NullProgressMonitor());
- }
-
- /**
- * {@inheritDoc} This should be overridden by subclasses in order to provide
- * deferred query support via the Eclipse Jobs mechanism. Return the
- * children of this object. Return null if children not supported.
- *
- * @param element the model object to get children from
- * @param monitor the progress monitor
- * @return the children of element
- */
- public abstract Object[] getChildren(IAdaptable element, IProgressMonitor monitor);
-
- /**
- * {@inheritDoc} This should be overridden by subclasses in order to provide
- * deferred query support via the Eclipse Jobs mechanism, if your adapter
- * supports context objects. If not, this will fall back to the model object
- * version of the method.
- *
- * The context object is passed in in place of the model object. By default,
- * we just fall back to the original mechanism Return the children of this
- * object. Return null if children not supported.
- *
- * @param element the context object that wrappers a model object, it's
- * subsystem and filter reference
- * @param monitor the progress monitor
- * @return the children of the model object within the context object that
- * matches the containing filter reference criteria.
- */
- public Object[] getChildren(IContextObject element, IProgressMonitor monitor)
- {
- return getChildren(element.getModelObject(), monitor);
- }
-
- /**
- * Return the children of this object, using the given Expand-To filter. By
- * default, this calls getChildren(element). Override only if you support
- * Expand-To menu actions.
- * <p>
- * <i><b>Overridable</b> by subclasses, but rarely needs to be.</i> <br>
- */
- public Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter)
- {
- return getChildren(element);
- }
-
- /**
- * Return the default descriptors for all system elements. <i>Callable by
- * subclasses.</i><br>
- */
- protected static IPropertyDescriptor[] getDefaultDescriptors()
- {
- if (propertyDescriptorArray == null)
- {
- propertyDescriptorArray = new PropertyDescriptor[3];
- // The following determine what properties will be displayed in the PropertySheet
- // resource type
- int idx = 0;
- propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_TYPE, SystemPropertyResources.RESID_PROPERTY_TYPE_LABEL, SystemPropertyResources.RESID_PROPERTY_TYPE_TOOLTIP);
- // resource name
- propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(IBasicPropertyConstants.P_TEXT, SystemPropertyResources.RESID_PROPERTY_NAME_LABEL, SystemPropertyResources.RESID_PROPERTY_NAME_TOOLTIP);
- // number of children in tree currently
- propertyDescriptorArray[idx++] = createSimplePropertyDescriptor(ISystemPropertyConstants.P_NBRCHILDREN, SystemViewResources.RESID_PROPERTY_NBRCHILDREN_LABEL, SystemViewResources.RESID_PROPERTY_NBRCHILDREN_TOOLTIP);
-
- }
- //System.out.println("In getDefaultDescriptors() in AbstractSystemViewAdapter");
- return propertyDescriptorArray;
- }
-
- /**
- * Create and return a simple string read-only property descriptor.
- * <i>Callable by subclasses.</i><br>
- *
- * @param propertyKey Key for this property, sent back in getPropertyValue.
- * @param label A user-readable translated label for the Property.
- * @param description A description for the Property (to be displayed as a
- * tooltip).
- */
- protected static PropertyDescriptor createSimplePropertyDescriptor(String propertyKey, String label, String description)
- {
- PropertyDescriptor pd = new PropertyDescriptor(propertyKey, label);
- pd.setDescription(description);
- return pd;
- }
-
- /**
- * Returns a value for this object that can be edited in a property sheet.
- * <i>Needed by framework for property sheet. No need to call or
- * override.</i><br>
- *
- * @return a value that can be edited.
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public Object getEditableValue()
- {
- return this;
- }
-
- /**
- * Returns the property descriptors defining what properties are seen in the
- * property sheet. By default returns descriptors for name, type and
- * number-of-children only plus whatever is returned from
- * internalGetPropertyDescriptors().
- * <p>
- * <i>Implemented. Do not override typically. See {@link
- * #internalGetPropertyDescriptors()}.</i> <br>
- *
- * @return an array containing all descriptors.
- * @see #internalGetPropertyDescriptors()
- */
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- IPropertyDescriptor[] addl = internalGetPropertyDescriptors();
- if ((addl == null) || (addl.length==0))
- return getDefaultDescriptors();
- else
- {
- IPropertyDescriptor[] defaults = getDefaultDescriptors();
- IPropertyDescriptor[] all = new IPropertyDescriptor[defaults.length+addl.length];
- int allIdx=0;
- for (int idx=0; idx<defaults.length; idx++)
- all[allIdx++] = defaults[idx];
- for (int idx=0; idx<addl.length; idx++)
- all[allIdx++] = addl[idx];
- return all;
- }
- }
-
- /**
- * Implement this to return the property descriptors for the properties in
- * the property sheet. This is beyond the Name, Type and NbrOfChildren
- * properties which already implemented and done for you.
- * <p>
- * Override if want to include more properties in the property sheet,
- * </p>
- * <p>
- * If you override this for read-only properties, you must also override:
- * </p>
- * <ul>
- * <li>{@link #getPropertyValue(Object)}
- * </ul>
- * <p>
- * If you override this for editable properties, you must also override:
- * </p>
- * <ul>
- * <li>{@link #isPropertySet(Object)}
- * <li>{@link #resetPropertyValue(Object)}
- * <li>{@link #setPropertyValue(Object,Object)}
- * </ul>
- *
- * @return an array containing all descriptors to be added to the default
- * set of descriptors, or null if no additional properties desired.
- * @see #createSimplePropertyDescriptor(String, String, String)
- */
- protected abstract IPropertyDescriptor[] internalGetPropertyDescriptors();
-
- /**
- * Returns the list of property descriptors that are unique for this
- * particular adapter - that is the difference between the default property
- * descriptors and the total list of property descriptors.
- * <p>
- * If internalGetPropertyDescriptors() returns non-null, then returns that,
- * else computes the difference. This is called by the table views like
- * {@link org.eclipse.rse.ui.view.SystemTableView}.
- * </p>
- * <i>Callable by subclasses. Do not override.</i><br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public IPropertyDescriptor[] getUniquePropertyDescriptors()
- {
- //optimization by phil in 5.1.2:
- IPropertyDescriptor[] internalDescriptors = internalGetPropertyDescriptors();
- if (internalDescriptors != null)
- return internalDescriptors;
-
- IPropertyDescriptor[] allDescriptors = getPropertyDescriptors();
- IPropertyDescriptor[] commonDescriptors = getDefaultDescriptors();
-
- int totalSize = allDescriptors.length;
- int commonSize = commonDescriptors.length;
- int uniqueSize = totalSize - commonSize;
-
- int uniqueIndex = 0;
-
- IPropertyDescriptor[] uniqueDescriptors = new IPropertyDescriptor[uniqueSize];
- for (int i = 0; i < totalSize; i++)
- {
- IPropertyDescriptor descriptor = allDescriptors[i];
-
- boolean isUnique = true;
- for (int j = 0; j < commonSize; j++)
- {
- IPropertyDescriptor commonDescriptor = commonDescriptors[j];
- if (descriptor == commonDescriptor)
- {
- isUnique = false;
- }
- }
-
- if (isUnique && uniqueSize > uniqueIndex)
- {
- uniqueDescriptors[uniqueIndex] = descriptor;
- uniqueIndex++;
- }
- }
-
- return uniqueDescriptors;
- }
-
- /**
- * Similar to getPropertyValue(Object key) but takes an argument for
- * determining whether to return a raw value or formatted value. <b> By
- * default, simply calls getPropertyValue(key).
- * <p>
- * This is called by the table views in order to get values that can be
- * sorted when the user clicks on the column heading. To support this for a
- * numeric property say, return a Long/Integer object if false, versus
- * returning string.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i> <br>
- *
- * @param key the name or key of the property as named by its property
- * descriptor
- * @param formatted indication of whether to return the value in formatted
- * or raw form
- * @return the current value of the given property
- */
- public Object getPropertyValue(Object key, boolean formatted)
- {
- return getPropertyValue(key);
- }
-
- /**
- * Returns the current value for the named property.<br>
- * By default handles ISystemPropertyConstants.P_TEXT, P_TYPE and
- * P_NBRCHILDREN only, then defers to {@link
- * #internalGetPropertyValue(Object)} for subclasses. <br>
- * <b>Note</b>: you will need to reference <code>propertySourceInput</code>,
- * which is the currently selected object. Just case it to what you expect
- * the selected object's type to be.
- * <p>
- * <i>Implemented. Do not override typically. See {@link
- * #internalGetPropertyValue(Object)}.</i> <br>
- *
- * @param key the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- public Object getPropertyValue(Object key)
- {
- String name = (String)key;
- if (name.equals(IBasicPropertyConstants.P_TEXT))
- //return getText(propertySourceInput);
- return getName(propertySourceInput);
- else if (name.equals(ISystemPropertyConstants.P_TYPE))
- return getType(propertySourceInput);
- else if (name.equals(ISystemPropertyConstants.P_NBRCHILDREN))
- {
- ISystemTree tree = getSystemTree();
- if (tree != null)
- return Integer.toString(tree.getChildCount(propertySourceInput));
- else
- {
- if ((viewer != null) && (viewer instanceof TreeViewer))
- return Integer.toString(getChildCount((TreeViewer)viewer, propertySourceInput));
- else
- return "0"; //$NON-NLS-1$
- }
- }
- else
- return internalGetPropertyValue(key);
- }
-
- /**
- * Implement this to return the property descriptors for the properties in
- * the property sheet. This is beyond the Name, Type and NbrOfChildren
- * properties which already implemented and done for you.
- *
- * @param key the name of the property as named by its property descriptor
- * @return the current value of the property or null if not a known
- * property.
- */
- protected abstract Object internalGetPropertyValue(Object key);
-
-
- /**
- * Return the number of immediate children in the tree, for the given tree node
- * @deprecated this should be done in the SystemView only
- */
- private int getChildCount(TreeViewer viewer, Object element)
- {
- if (viewer.getControl().isDisposed())
- return 0;
- if (viewer.getExpandedState(element) == false)
- return 0;
-
- Widget w = findItemInTree(viewer, element);
- if (w != null)
- {
- if (w instanceof TreeItem)
- return ((TreeItem)w).getItemCount();
- else if (w instanceof Tree)
- return ((Tree)w).getItemCount();
- }
- return 0;
- }
-
- /** @deprecated this should be done in the SystemView only */
- private Widget findItemInTree(TreeViewer tree, Object element)
- {
- Item[] items = getChildren(tree.getControl());
- if (items != null)
- {
- for (int i= 0; i < items.length; i++)
- {
- Widget o = internalFindItem(tree.getTree(), items[i], element);
- if (o != null)
- return o;
- }
- }
- return null;
- }
-
- /** @deprecated this should be done in the SystemView only */
- private Widget internalFindItem(Tree tree, Item parent, Object element)
- {
- // compare with node
- Object data= parent.getData();
- if (data != null)
- {
- if (data.equals(element))
- return parent;
- }
- // recurse over children
- Item[] items= getChildren(parent);
- for (int i= 0; i < items.length; i++)
- {
- Item item= items[i];
- Widget o = internalFindItem(tree, item, element);
- if (o != null)
- return o;
- }
- return null;
- }
-
- /** @deprecated this should be done in the SystemView only */
- private Item[] getChildren(Widget o)
- {
- if (o instanceof TreeItem)
- return ((TreeItem) o).getItems();
- if (o instanceof Tree)
- return ((Tree) o).getItems();
- return null;
- }
-
- /**
- * Returns whether the property value has changed from the default. Only
- * applicable for editable properties.
- * <p>
- * <i><b>Overridable</b> by subclasses. Must be overridden only if editable
- * properties are supported.</i><br>
- * <br>
- * RETURNS FALSE BY DEFAULT.
- *
- * @return <code>true</code> if the value of the specified property has
- * changed from its original default value; <code>false</code> otherwise.
- */
- public boolean isPropertySet(Object key)
- {
- return false;
- }
-
- /**
- * Resets the specified property's value to its default value. Called on
- * editable property when user presses reset button in property sheet
- * viewer.
- * <p>
- * <i><b>Overridable</b> by subclasses. Must be overridden only if editable
- * properties are supported.</i><br>
- * DOES NOTHING BY DEFAULT.
- *
- * @param key the key identifying property to reset
- */
- public void resetPropertyValue(Object key)
- {
- }
-
- /**
- * Sets the named property to the given value. Called after an editable
- * property is changed by the user.
- * <p>
- * <i><b>Overridable</b> by subclasses. Must be overridden only if editable
- * properties are supported.</i><br>
- * DOES NOTHING BY DEFAULT.
- *
- * @param key the key identifying property to reset
- * @param value the new value for the property
- */
- public void setPropertyValue(Object key, Object value)
- {
- }
-
- /**
- * Set input object for property source queries. This <b>must</b> be called
- * by your XXXAdaptorFactory before returning this adapter object.
- * <p>
- * <i>Called from adapter factories. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public void setPropertySourceInput(Object propertySourceInput)
- {
- this.propertySourceInput = propertySourceInput;
- }
-
- /**
- * User has double clicked on an object. If you want to do something
- * special, do it and return true. Otherwise return false to have the viewer
- * do the default behaviour.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i> <br>
- */
- public boolean handleDoubleClick(Object element)
- {
- return false;
- }
-
- // ------------------------------------------
- // METHODS TO SUPPORT GLOBAL DELETE ACTION...
- // ------------------------------------------
-
- /**
- * Return true if we should show the delete action in the popup for the
- * given element. If true, then canDelete will be called to decide whether
- * to enable delete or not.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * By default, returns true.
- *
- * @see #canDelete(Object)
- */
- public boolean showDelete(Object element)
- {
- return true;
- }
-
- /**
- * Return true if this object is deletable by the user. If so, when
- * selected, the Edit->Delete menu item will be enabled.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is.</i><br>
- * By default, returns false. Override if your object is deletable.
- *
- * @see #showDelete(Object)
- */
- public boolean canDelete(Object element)
- {
- return false;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * By default does nothing. Override if your object is deletable. Return
- * true if this was successful. Return false if it failed and you issued a
- * message. Throw an exception if it failed and you want to use the generic
- * message. In case of cancellation, either return <code>false</code> or
- * throw a {@link SystemOperationCancelledException}.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is.</i> <br>
- *
- * @see #showDelete(Object)
- * @see #canDelete(Object)
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception
- {
- return false;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * By default just calls the doDelete method for each item in the
- * resourceSet. Override if you wish to perform some sort of optimization
- * for the batch delete. Return true if this was successful. Return false if
- * ANY delete operation failed and a message was issued. Throw an exception
- * if ANY failed and you want to use the generic message.
- * <p>
- * In case of cancellation, either return <code>false</code> or throw a
- * {@link SystemOperationCancelledException}.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is.</i> <br>
- */
- public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception
- {
- boolean ok = true;
- for (int i = 0; i < resourceSet.size(); i++)
- {
- ok = ok && doDelete(shell, resourceSet.get(i), monitor);
- }
- return ok;
- }
-
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON RENAME ACTION...
- // ------------------------------------------
-
- /**
- * Return true if we should show the rename action in the popup for the
- * given element. If true, then canRename will be called to decide whether
- * to enable rename or not.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * By default, returns true.
- *
- * @return true if we should show the rename action in the popup for the
- * given element.
- * @see #canRename(Object)
- * @see #doRename(Shell,Object,String, IProgressMonitor)
- */
- public boolean showRename(Object element)
- {
- return true;
- }
-
- /**
- * Return true if this object is renameable by the user. If so, when
- * selected, the Rename popup menu item will be enabled.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is.</i><br>
- * By default, returns false. Override if your object can be renamed.
- *
- * @return true if this object is renameable by the user
- * @see #showRename(Object)
- * @see #doRename(Shell,Object,String,IProgressMonitor)
- * @see #getNameValidator(Object)
- * @see #getCanonicalNewName(Object,String)
- * @see #namesAreEqual(Object,String)
- */
- public boolean canRename(Object element)
- {
- return false;
- }
-
- /**
- * Perform the rename action. By default does nothing.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is.</i><br>
- * Override if your object can be renamed. Return true if this was
- * successful. Return false if it failed and you issued a message. Throw an
- * exception if it failed and you want to use the generic message.
- *
- * @return true if the rename was successful
- * @see #showRename(Object)
- * @see #canRename(Object)
- * @since 3.0
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor) throws Exception
- {
- //org.eclipse.rse.core.ui.SystemMessage.displayErrorMessage("INSIDE DORENAME");
- return false;
- }
-
- /**
- * Return a validator for verifying the new name is correct. If you return
- * null, no error checking is done on the new name in the common rename
- * dialog!!
- * <p>
- * Used in the common rename dialogs, and only if you return true to {@link
- * #canRename(Object)}.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is if canRename is.</i>
- * <br>
- * Suggest you use at least UniqueStringValidator or a subclass to ensure
- * new name is at least unique.
- *
- * @see #canRename(Object)
- */
- public ISystemValidator getNameValidator(Object element)
- {
- return null;
- }
-
- /**
- * Form and return a new canonical (unique) name for this object, given a
- * candidate for the new name. This is called by the generic multi-rename
- * dialog to test that all new names are unique. To do this right, sometimes
- * more than the raw name itself is required to do uniqueness checking.
- * <p>
- * For example, two connections or filter pools can have the same name if
- * they are in different profiles. Two iSeries QSYS objects can have the
- * same name if their object types are different.
- * <p>
- * Used in the common rename dialogs, and only if you return true to {@link
- * #canRename(Object)}.
- * <p>
- * This method returns a name that can be used for uniqueness checking
- * because it is qualified sufficiently to make it unique.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is if canRename is.</i>
- * <br>
- * By default, this simply returns the given name. It is overridden by child
- * classes when appropriate.
- *
- * @see #canRename(Object)
- */
- public String getCanonicalNewName(Object element, String newName)
- {
- // this is all for defect 42145. Phil
- return newName;
- }
-
- /**
- * Compare the name of the given element to the given new name to decide if
- * they are equal. Allows adapters to consider case and quotes as
- * appropriate.
- * <p>
- * Used in the common rename dialogs, and only if you return true to {@link
- * #canRename(Object)}.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * By default does an equalsIgnoreCase comparison
- *
- * @see #canRename(Object)
- */
- public boolean namesAreEqual(Object element, String newName)
- {
- return getName(element).equalsIgnoreCase(newName);
- }
-
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON REFRESH ACTION...
- // ------------------------------------------
- /**
- * Return true if we should show the refresh action in the popup for the
- * given element. Note the actual work to do the refresh is handled for you.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is.</i><br>
- * Default is true.
- */
- public boolean showRefresh(Object element)
- {
- return true;
- }
-
- // ----------------------------------------------
- // METHODS TO SUPPORT COMMON PROPERTIES ACTION...
- // ----------------------------------------------
- /**
- * Return true if we should show the properties action in the popup for the
- * given element. Note the actual work to show the properties dialog is
- * handled for you.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is.</i><br>
- * Default is true.
- */
- public boolean showProperties(Object element)
- {
- return true;
- }
-
- // ------------------------------------------------------------
- // METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
- // ------------------------------------------------------------
- /**
- * Return true if we should show the <b>Go Into;</b> and <b>Open In New
- * Window</b> and <b>Go To</b> actions in the popup for the given element.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is NOT.</i><br>
- * Only applicable for non-remote resources. Remote always show <b>Go To</b>
- * only.
- */
- public boolean showOpenViewActions(Object element)
- {
- if (element instanceof IAdaptable)
- return hasChildren((IAdaptable)element);
- return false;
- }
-
- /**
- * Return true if we should show the generic show in table action in the
- * popup for the given element.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is NOT.</i> <br>
- */
- public boolean showGenericShowInTableAction(Object element)
- {
- return true;
- }
-
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON DRAG AND DROP FUNCTION...
- // ------------------------------------------
- /**
- * Return true if this object can be copied to another location.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i><br>
- * By default, we return false. Extenders may decide whether or not certain
- * objects can be dragged with this method.
- *
- * @see #doDrag(Object,boolean,IProgressMonitor)
- * @see #canDrop(Object)
- * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
- * @see #validateDrop(Object,Object,boolean)
- */
- public boolean canDrag(Object element)
- {
- return false;
- }
-
- /**
- * Return true if this object can be copied to another location.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i><br>
- * By default, we return false. Extenders may decide whether or not certain
- * objects can be dragged with this method. Return true if these objects can
- * be copied to another location via drag and drop, or clipboard copy.
- */
- public boolean canDrag(SystemRemoteResourceSet elements)
- {
- return false;
- }
-
- /**
- * Perform the drag on the given object.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i><br>
- * By default this does nothing and returns nothing. Extenders supporting
- * DnD are expected to implement this method to perform a copy to a
- * temporary object, the return value.
- *
- * @see #canDrag(Object)
- * @see #canDrop(Object)
- * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
- * @see #validateDrop(Object,Object,boolean)
- */
- public Object doDrag(Object element, boolean sameSystemType, IProgressMonitor monitor)
- {
- return null;
- }
-
- /**
- * Return true if another object can be copied into this object.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i><br>
- * By default we return false. Extenders may decide whether or not certain
- * objects can accept other objects with this method.
- *
- * @see #canDrag(Object)
- * @see #doDrag(Object,boolean,IProgressMonitor)
- * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
- * @see #validateDrop(Object,Object,boolean)
- */
- public boolean canDrop(Object element)
- {
- return false;
- }
-
- /**
- * Perform the drag on the given objects.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i><br>
- * This default implementation simply iterates through the set. For optimal
- * performance, this should be overridden.
- *
- * @param set the set of objects to copy
- * @param monitor the progress monitor
- * @return the set of objects as a result of the drag
- *
- */
- public ISystemResourceSet doDrag(SystemRemoteResourceSet set, IProgressMonitor monitor)
- {
- SystemWorkspaceResourceSet results = new SystemWorkspaceResourceSet();
- List resources = set.getResourceSet();
- for (int i = 0; i < resources.size(); i++)
- {
- results.addResource(doDrag(resources.get(i), true, monitor));
- }
- return results;
- }
-
- /**
- * Perform drop from the "fromSet" of objects to the "to" object.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i> <br>
- *
- * @param fromSet the source objects for the drop
- * @param to the target object for the drop
- * @param sameSystemType indication of whether the source and target reside
- * of the same type of system
- * @param sameSystem indication of whether the source and target are on the
- * same system
- * @param srcType the type of objects to be dropped
- * @param monitor the progress monitor
- *
- * @return the set of new objects created from the drop
- */
- public ISystemResourceSet doDrop(ISystemResourceSet fromSet, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
- {
- SystemRemoteResourceSet results = new SystemRemoteResourceSet(getSubSystem(to), this);
-
- List resources = fromSet.getResourceSet();
- for (int i = 0; i < resources.size(); i++)
- {
- results.addResource(doDrop(resources.get(i), to, sameSystemType, sameSystem, srcType, monitor));
- }
-
- return results;
- }
-
- /**
- * Sets filter context for querying. Override to provide specialized
- * behaviour.
- */
- public void setFilterString(String filterString)
- {
- this.filterString = filterString;
- }
-
- /**
- * Gets filter context for querying. Override to provide specialized
- * behaviour.
- */
- public String getFilterString()
- {
- return filterString;
- }
-
- /**
- * Perform drop from the "from" object to the "to" object.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i><br>
- * By default this does nothing and we return false. Extenders supporting
- * DnD are expected to implement this method to perform a "paste" into an
- * object.
- *
- * @return the new object that was copied
- *
- * @see #canDrag(Object)
- * @see #doDrag(Object,boolean,IProgressMonitor)
- * @see #canDrop(Object)
- * @see #validateDrop(Object,Object,boolean)
- */
- public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, int srcType, IProgressMonitor monitor)
- {
- // for backward compatibility
- return doDrop(from, to, sameSystemType, sameSystem, monitor);
- }
-
- /**
- * Perform drop from the "from" object to the "to" object.
- * <p>
- * <i><b>Overridable</b> by subclasses, and is only if drag and drop
- * supported.</i><br>
- * By default this does nothing and we return false. Extenders supporting
- * DnD are expected to implement this method to perform a "paste" into an
- * object.
- *
- * @return the new object that was copied
- *
- * @see #canDrag(Object)
- * @see #doDrag(Object,boolean,IProgressMonitor)
- * @see #canDrop(Object)
- * @see #validateDrop(Object,Object,boolean)
- *
- * @deprecated use doDrop(Object from, Object to, boolean sameSystemType,
- * boolean sameSystem, int srcType, IProgressMonitor monitor) instead
- */
- public Object doDrop(Object from, Object to, boolean sameSystemType, boolean sameSystem, IProgressMonitor monitor)
- {
- return null;
- }
-
- /**
- * Return true if it is valid for the src object to be dropped in the
- * target.
- * <p>
- * <i><b>Overridable</b> by subclasses, and usually is only if drag and drop
- * supported.</i><br>
- * We return false by default.
- *
- * @param src the object to drop
- * @param target the object which src is dropped in
- * @param sameSystem whether this is the same system or not
- * @return whether this is a valid operation
- *
- * @see #canDrag(Object)
- * @see #doDrag(Object,boolean,IProgressMonitor)
- * @see #canDrop(Object)
- * @see #doDrop(Object,Object,boolean,boolean,IProgressMonitor)
- */
- public boolean validateDrop(Object src, Object target, boolean sameSystem)
- {
- return false;
- }
-
- public boolean validateDrop(ISystemResourceSet set, Object target, boolean sameSystem)
- {
- boolean valid = true;
- List resources = set.getResourceSet();
- for (int i = 0; i < resources.size() && valid; i++)
- {
- valid = validateDrop(resources.get(i), target, sameSystem);
- }
- return valid;
- }
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return what to save to disk to identify this element in the persisted
- * list of expanded elements.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * This just defaults to getName, but if that is not sufficient override it
- * here.
- */
- public String getMementoHandle(Object element)
- {
- if (this instanceof ISystemRemoteElementAdapter)
- return ((ISystemRemoteElementAdapter)this).getAbsoluteName(element);
- else
- return getName(element);
- }
-
- /**
- * Return what to save to disk to identify this element when it is the input
- * object to a secondary Remote System Explorer perspective.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * Defaults to getMementoHandle(element).
- */
- public String getInputMementoHandle(Object element)
- {
- return getMementoHandle(element);
- }
-
- /**
- * Return a short string to uniquely identify the type of resource. Eg
- * "conn" for connection.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * This just defaults to getType, but if that is not sufficient override it
- * here, since that is a translated string.
- */
- public String getMementoHandleKey(Object element)
- {
- if (this instanceof ISystemRemoteElementAdapter)
- return ISystemMementoConstants.MEMENTO_KEY_REMOTE;
- else
- return getType(element);
- }
-
- /**
- * Sometimes we don't want to remember an element's expansion state, such as
- * for temporarily inserted messages. In these cases return false from this
- * method. The default is true.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i> <br>
- */
- public boolean saveExpansionState(Object element)
- {
- return true;
- }
-
- /**
- * Return true if this object is a "prompting" object that prompts the user
- * when expanded. For such objects, we do not try to save and restore their
- * expansion state on F5 or between sessions.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * Default is false unless element implements ISystemPromptable object.
- * Override as appropriate.
- */
- public boolean isPromptable(Object element)
- {
- return (element instanceof ISystemPromptableObject);
- }
-
- /**
- * Return true if this object is remote. In this case, the default is true.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i> <br>
- */
- public boolean isRemote(Object element)
- {
- return true;
- }
-
- /**
- * Selection has changed in the Remote Systems view. Empty by default, but
- * override if you need to track selection changed. For example, this is
- * used to drive table views that respond to selection.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i> <br>
- *
- * @param element - first selected object
- */
- public void selectionChanged(Object element) // d40615
- {
- }
-
- /**
- * From <samp>IActionFilter</samp> so the popupMenus extension point can use &lt;filter&gt;, &lt;enablement&gt;
- * or &lt;visibility&gt;. The support is for the following:
- * <ol>
- * <li>name="value". The given value must match getName(target) exactly, or if ends with asterisk must match the beginning.
- * <li>name="type". The given value must match getType(target) exactly. Be careful, as this is usually translated.
- * <li>name="hasChildren". If the given value is "true", returns true if hasChildren(target) returns true. If given "false",
- * returns true if the hasChildren returns false.
- * <li>name="connection". If the given value is "true", returns true if the subsystem is connected. If given "false",
- * returns true if the subsystem is not connected.
- * <li>name="offline". If the given value is "true", returns true if the subsystem is offline. If given "false",
- * returns true if the subsystem is offline.
- * <li>name="systemType". The given value is a system type, and this returns true if this object's connection is of that
- * type. You can specify multiple values by comma-separating them, and this returns if there is a match on any them.
- * <li>name="subsystemConfigurationId". The given value is a subsystem factory Id, and this returns true if this object's
- * subsystem is from that subsystem factory. For connections, returns false.
- * You can specify multiple values by comma-separating them, and this returns if there is a match on any them.
- * <li>name="subsystemConfigurationCategory". The given value is a subsystem category, and this returns true if this object's
- * subsystem is from a subsystem factory of that category. For connections, returns false.
- * You can specify multiple values by comma-separating them, and this returns if there is a match on any them.
- * </ol>
- * <p>
- * <i><b>Overridable</b> by subclasses, typically if additional properties are supported.</i><br>
- * If desired, override, and call super(), to support additional filter criteria for &lt;filter&gt;, &lt;enablement&gt; and &lt;visibility&gt;.
- *
- * @see org.eclipse.ui.IActionFilter#testAttribute(Object, String, String)
- */
- public boolean testAttribute(Object target, String name, String value)
- {
- //System.out.println("Inside testAttribute: name = " + name + ", value = " + value);
- if (name.equalsIgnoreCase("name")) //$NON-NLS-1$
- {
- if (value.endsWith("*")) //$NON-NLS-1$
- {
- // we have a wild card test, and * is the last character in the value
- if (getName(target).startsWith(value.substring(0, value.length() - 1)))
- return true;
- }
- else
- return value.equals(getName(target));
- }
- else if (name.equalsIgnoreCase("type")) //$NON-NLS-1$
- return value.equals(getType(target));
- else if (name.equalsIgnoreCase("hasChildren")) //$NON-NLS-1$
- {
- return hasChildren((IAdaptable)target) ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else if (name.equalsIgnoreCase("connected")) //$NON-NLS-1$
- {
- ISubSystem ss = getSubSystem(target);
- if (ss != null)
- return ss.isConnected() ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
- else
- return false;
- }
- else if (name.equalsIgnoreCase("offline")) //$NON-NLS-1$
- {
- ISubSystem ss = getSubSystem(target);
- if (ss != null)
- return ss.isOffline() ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
- else
- return false;
- }
- else if (name.equalsIgnoreCase("systemType")) //$NON-NLS-1$
- {
- ISubSystem ss = getSubSystem(target);
- String[] values = tokenize(value);
- if (ss == null)
- {
- if (!(target instanceof IHost))
- return false;
- String connSysType = ((IHost)target).getSystemType().getName();
- for (int idx=0; idx<values.length; idx++)
- {
- if (connSysType.equals(values[idx]))
- return true;
- }
- return false;
- }
- for (int idx=0; idx<values.length; idx++)
- {
- if (ss.getHost().getSystemType().getName().equals(values[idx]))
- return true;
- }
- return false;
- }
- else if (name.equalsIgnoreCase("systemTypeId")) //$NON-NLS-1$
- {
- ISubSystem ss = getSubSystem(target);
- String[] values = tokenize(value);
- if (ss == null)
- {
- if (!(target instanceof IHost))
- return false;
- String connSysTypeId = ((IHost)target).getSystemType().getId();
- for (int idx=0; idx<values.length; idx++)
- {
- if (connSysTypeId.equals(values[idx]))
- return true;
- }
- return false;
- }
- for (int idx=0; idx<values.length; idx++)
- {
- if (ss.getHost().getSystemType().getId().equals(values[idx]))
- return true;
- }
- return false;
- }
- else if (name.equalsIgnoreCase("subsystemConfigurationId")) //$NON-NLS-1$
- {
- ISubSystem ss = getSubSystem(target);
- //System.out.println("ss null? " + (ss == null));
- if (ss == null)
- return false;
- String[] values = tokenize(value);
- //System.out.println("Nbr of values: " + (values.length));
- //System.out.println("Comparing against: " + (ss.getParentSubSystemConfiguration().getId()));
- boolean ok = false;
- for (int idx=0; !ok && (idx<values.length); idx++)
- {
- if (ss.getSubSystemConfiguration().getId().equals(values[idx]))
- ok = true;
- }
- //System.out.println("Returning: " + ok);
- return ok;
- }
- else if (name.equalsIgnoreCase("subsystemConfigurationCategory")) //$NON-NLS-1$
- {
- ISubSystem ss = getSubSystem(target);
- if (ss == null)
- return false;
- String[] values = tokenize(value);
- for (int idx=0; idx<values.length; idx++)
- {
- if (ss.getSubSystemConfiguration().getCategory().equals(values[idx]))
- return true;
- }
- return false;
- }
- else if (name.equalsIgnoreCase("isRemote")) //$NON-NLS-1$
- {
- return isRemote(target) ? value.equals("true") : value.equals("false"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // Give the ISV's as the element owners/contributors the chance to extend the standard RSE action
- // filters for their specific needs. We do this by trying to determine the system type from the
- // target object and try to adapt the system type to an IActionFilter.
- //
- // Note: Everything we do here is performance critical to the menu to show up. Therefore
- // we cache as much as possible here. The cache is static to all AbstractSystemViewAdapter
- // instances throughout the whole hierarchy.
- IHost conn = null;
- if (target instanceof IHost) {
- conn = (IHost)target;
- } else if (target instanceof ISubSystem) {
- conn = ((ISubSystem)target).getHost();
- } else if (target instanceof ISystemFilterPoolReference) {
- ISystemFilterPoolReference modelObject = (ISystemFilterPoolReference)target;
- if (modelObject.getProvider() != null) conn = ((ISubSystem)modelObject.getProvider()).getHost();
- } else if (target instanceof ISystemFilterReference) {
- ISystemFilterReference modelObject = (ISystemFilterReference)target;
- if (modelObject.getProvider() != null) conn = ((ISubSystem)modelObject.getProvider()).getHost();
- } else if (target instanceof ISystemFilterStringReference) {
- ISystemFilterStringReference modelObject = (ISystemFilterStringReference)target;
- if (modelObject.getProvider() != null) conn = ((ISubSystem)modelObject.getProvider()).getHost();
- }
-
- if (conn != null) {
- IRSESystemType systemType = conn.getSystemType();
- if (systemType != null) {
- IActionFilter actionFilter = (IActionFilter)ACTION_FILTER_CACHE.get(systemType);
- if (actionFilter == null) {
- Object adapter = systemType.getAdapter(IActionFilter.class);
- if (adapter instanceof IActionFilter && !adapter.equals(this)) {
- // put the association in the cache
- ACTION_FILTER_CACHE.put(systemType, adapter);
- actionFilter = (IActionFilter)adapter;
- } else if (!(adapter instanceof IActionFilter)) {
- // put the association in the cache
- ACTION_FILTER_CACHE.put(systemType, new NULL_ACTION_FILTER());
- }
- }
- if (actionFilter instanceof NULL_ACTION_FILTER) actionFilter = null;
- if (actionFilter != null) return actionFilter.testAttribute(target, name, value);
- }
- }
-
- return false;
- }
-
- /**
- * Break given comma-delimited string into tokens
- */
- private String[] tokenize(String input)
- {
- StringTokenizer tokens = new StringTokenizer(input,";"); //$NON-NLS-1$
- Vector v = new Vector();
- while (tokens.hasMoreTokens())
- v.addElement(tokens.nextToken());
- String[] stringArray = new String[v.size()];
- for (int idx=0; idx<v.size(); idx++)
- stringArray[idx] = (String)v.elementAt(idx);
- return stringArray;
- }
-
- // --------------------------------------
- // ISystemRemoteElementAdapter methods...
- // We include these here so that if a BP
- // creates a class that extends this one
- // and implements the remote resource
- // adapter interface, these methods will
- // be already created, reducing work.
- // These are low-usage methods.
- // --------------------------------------
- /**
- * From {@link
- * org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubSubType
- * (Object)}. Pre-supplied for convenience for subclasses that want to
- * implement this interface for remote object adapters.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * Returns null. Override if you want to supply a sub-sub-type for filtering
- * in the popupMenus extension point.
- */
- public String getRemoteSubSubType(Object element)
- {
- return null; // Extremely fine grained. We don't use it.
- }
-
- /**
- * From {@link
- * org.eclipse.rse.ui.view.ISystemRemoteElementAdapter#getRemoteSubSubType
- * (Object)}. Pre-supplied for convenience for subclasses that want to
- * implement this interface for remote object adapters.
- * <p>
- * <i><b>Overridable</b> by subclasses, but usually is not.</i><br>
- * Returns null. Override if the remote resource is compilable.
- */
- public String getRemoteSourceType(Object element)
- {
- return null;
- }
-
- /**
- * Return the remote edit wrapper for this object.
- * <p>
- * <i><b>Overridable</b> by subclasses, and must be for editable
- * objects.</i> <br>
- *
- * @param object the object to edit
- * @return the editor wrapper for this object
- */
- public ISystemEditableRemoteObject getEditableRemoteObject(Object object)
- {
- return null;
- }
-
- /**
- * Indicates whether the specified object can be edited or not.
- * <i><b>Overridable</b> by subclasses, and must be for editable
- * objects.</i><br>
- *
- * @param object the object to edit
- * @return true if the object can be edited. Returns false by default.
- */
- public boolean canEdit(Object object)
- {
- return false;
- }
-
- // ------------------
- // HELPER METHODS...
- // ------------------
- /**
- * Returns the implementation of ISystemViewElement for the given object.
- * Returns null if the adapter is not defined or the object is not
- * adaptable.
- * <p>
- * <i>Callable by subclasses.</i><br>
- * Just a convenient shortcut to {@link
- * org.eclipse.rse.ui.view.SystemAdapterHelpers#getViewAdapter(Object,
- * Viewer)} <p/> Should we allow clients to override this in order to
- * provide an optimized implementation for their models? But it's being
- * called by subclasses only anyways...
- *
- * @deprecated use SystemAdapterHelpers.getViewAdapter(o, getViewer())
- * instead
- */
- protected ISystemViewElementAdapter getSystemViewElementAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o, getViewer());
- /*
- ISystemViewElementAdapter adapter = null;
- if (!(o instanceof IAdaptable))
- adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemViewElementAdapter.class);
- else
- adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
- if (adapter == null)
- RSEUIPlugin.logDebugMessage(this.getClass().getName(), "ADAPTER IS NULL FOR ELEMENT : " + o);
- else
- {
- adapter.setViewer(getViewer()); // added this in V5.0, just in case. Phil
- }
- return adapter;
- */
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given object.
- * Returns null if this object does not adaptable to this.
- * <p>
- * <i>Callable by subclasses.</i><br>
- * Just a convenient shortcut to {@link
- * org.eclipse.rse.ui.view.SystemAdapterHelpers#getRemoteAdapter(Object,
- * Viewer)} <p/> Should we allow clients to override this in order to
- * provide an optimized implementation for their models? But it's being
- * called by subclasses only anyways...
- *
- * @deprecated use SystemAdapterHelpers.getRemoteAdapter(o, getViewer())
- * instead
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- // hmmm, any reason why we shouldn't do the following 2 lines of code for performance reasons?
- //if (this instanceof ISystemRemoteElementAdapter)
- // return (ISystemRemoteElementAdapter)this;
- return SystemAdapterHelpers.getRemoteAdapter(o, getViewer());
- /*
- if (!(o instanceof IAdaptable))
- adapter = (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o,ISystemRemoteElementAdapter.class);
- adapter = (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
- if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
- {
- ((ISystemViewElementAdapter)adapter).setViewer(getViewer()); // added this in V5.0, just in case. Phil
- }
- return adapter;
- */
- }
-
- /**
- * Substitute all occurrences of a given String with another String.
- *
- * <i>Callable by subclasses.</i> This method does message variable
- * substitution. Using you are replacing &1 (say) with a string.
- *
- * @param msg message containing substitution variable. Eg "Connect failed
- * with return code &1"
- * @param subOld substitution variable. Eg "%1"
- * @param subNew substitution data. Eg "001"
- * @return message with all occurrences of variable substituted with data.
- *
- * @deprecated Clients should use Eclipse {@link org.eclipse.osgi.util.NLS}
- * or Java {@link java.text.MessageFormat} or
- * {@link java.lang.String#replaceAll(String, String)} to do
- * substring replacement and variable substitution.
- */
- public static String sub(String msg, String subOld, String subNew)
- {
- StringBuffer temp = new StringBuffer();
- int lastHit = 0;
- int newHit = 0;
- for (newHit = msg.indexOf(subOld,lastHit); newHit != -1;
- lastHit = newHit, newHit = msg.indexOf(subOld,lastHit))
- {
- if (newHit >= 0)
- temp.append(msg.substring(lastHit,newHit));
- temp.append(subNew);
- newHit += subOld.length();
- }
- if (lastHit >= 0)
- temp.append(msg.substring(lastHit));
- return temp.toString();
- }
-
- /**
- * Return the current viewer as an ISystemTree if the viewer is set and it
- * implements this interface (SystemView does). May be null so test it.
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected ISystemTree getSystemTree()
- {
- Viewer v = getViewer();
- if ((v != null) && (v instanceof ISystemTree))
- return (ISystemTree)v;
- else
- return null;
- }
-
- /**
- * Return "Yes" translated. <i>Callable by subclasses. Do not override</i>
- * <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- public String getTranslatedYes()
- {
- if (xlatedYes == null)
- xlatedYes = SystemResources.TERM_YES;
- return xlatedYes;
- }
-
- /**
- * Return "No" translated. <i>Callable by subclasses. Do not override.</i>
- * <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected String getTranslatedNo()
- {
- if (xlatedNo == null)
- xlatedNo = SystemResources.TERM_NO;
- return xlatedNo;
- }
-
- /**
- * Return "True" translated. <i>Callable by subclasses. Do not override.</i>
- * <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected String getTranslatedTrue()
- {
- if (xlatedTrue == null)
- xlatedTrue = SystemResources.TERM_TRUE;
- return xlatedTrue;
- }
-
- /**
- * Return "False" translated. <i>Callable by subclasses. Do not
- * override.</i><br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected String getTranslatedFalse()
- {
- if (xlatedFalse == null)
- xlatedFalse = SystemResources.TERM_FALSE;
- return xlatedFalse;
- }
-
- /**
- * Return "Not applicable" translated. <i>Callable by subclasses. Do not
- * override.</i><br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected String getTranslatedNotApplicable()
- {
- if (xlatedNotApplicable == null)
- xlatedNotApplicable = SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
- return xlatedNotApplicable;
- }
-
- /**
- * Return "Not available" translated. <i>Callable by subclasses. Do not
- * override.</i><br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected String getTranslatedNotAvailable()
- {
- if (xlatedNotAvailable == null)
- xlatedNotAvailable = SystemPropertyResources.RESID_TERM_NOTAVAILABLE;
- return xlatedNotAvailable;
- }
-
- /**
- * Initialize Message Objects. <i>Internal use. Do not call or override.</i>
- *
- * @deprecated Internal use. Do not call this method.
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected final void initMsgObjects()
- {
- nullObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
- cancelledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
- errorObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
- }
-
- /**
- * In getChildren, return <samp>checkForEmptyList(children, parent,
- * true/false)<.samp> versus your array directly. This method checks for a
- * null array which is not allowed and replaces it with an empty array. If
- * true is passed then it returns the "Empty list" message object if the
- * array is null or empty.
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @param children The list of children.
- * @param parent The parent for the children.
- * @param returnNullMsg <code>true</code> if an "Empty List" message should
- * be returned.
- * @return The list of children, a list with the "Empty List" message object
- * or an empty list.
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected Object[] checkForEmptyList(Object[] children, Object parent, boolean returnNullMsg) {
- if ((children == null) || (children.length == 0)) {
- if (fPrefStore == null) {
- fPrefStore = RSEUIPlugin.getDefault().getPluginPreferences();
- }
- if (!returnNullMsg
- || (fPrefStore != null && !fPrefStore
- .getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS))) {
- return emptyList;
- } else {
- return new Object[] {
- new SystemMessageObject(
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
- ISystemMessageObject.MSGTYPE_EMPTY,
- parent)};
- }
- }
- return children;
- }
-
- /**
- * In getChildren, return <samp>checkForNull(children, true/false)</samp>
- * versus your array directly. This method checks for a null array which is
- * not allowed and replaces it with an empty array. If true is passed then
- * it returns the "Empty list" message object if the array is null or empty.
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)}
- * instead.
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
- {
- if ((children == null) || (children.length==0))
- {
- if (!returnNullMsg)
- return emptyList;
- else
- {
- if (nullObject == null)
- initMsgObjects();
- msgList[0] = nullObject;
- return msgList;
- }
- }
- else
- return children;
- }
-
- /**
- * Return the "Operation cancelled by user" message as an object array so
- * can be used to answer getChildren().
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected final Object[] getCancelledMessageObject()
- {
- if (cancelledObject == null)
- initMsgObjects();
- msgList[0] = cancelledObject;
- return msgList;
- }
-
- /**
- * Return the "Operation failed" message as an object array so can be used
- * to answer getChildren().
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected final Object[] getFailedMessageObject()
- {
- if (errorObject == null)
- initMsgObjects();
- msgList[0] = errorObject;
- return msgList;
- }
-
- /**
- * Return the "Empty list" message as an object array so can be used to
- * answer getChildren().
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)}
- * instead.
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected final Object[] getEmptyMessageObject()
- {
- if (nullObject == null)
- initMsgObjects();
- msgList[0] = nullObject;
- return msgList;
- }
-
- /**
- * Get the first selected object of the given selection.
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected Object getFirstSelection(IStructuredSelection selection)
- {
- return selection.getFirstElement();
- }
-
- /**
- * Return a filter string that corresponds to this object.
- * @param object the object to obtain a filter string for
- * @return the corresponding filter string if applicable
- */
- public String getFilterStringFor(Object object)
- {
- return null;
- }
-
- /* ---------------------------------------------------
- * these methods are for deferred fetch operations
- * ---------------------------------------------------
- */
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewElementAdapter#supportsDeferredQueries(org.eclipse.rse.core.subsystems.ISubSystem)
- */
- public boolean supportsDeferredQueries(ISubSystem subSys)
- {
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#fetchDeferredChildren(java.lang.Object, org.eclipse.ui.progress.IElementCollector, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor)
- {
- SystemFetchOperation operation = null;
- monitor = Policy.monitorFor(monitor);
- String taskName = SystemViewResources.RESID_FETCHING;
- monitor.beginTask(taskName, 100);
- operation = getSystemFetchOperation(o, collector);
- try
- {
- operation.run(Policy.subMonitorFor(monitor, 100));
- }
- catch (InvocationTargetException e)
- {
- operation.setException(e);
- }
- catch (InterruptedException e)
- {
- // Cancelled by the user;
- }
- finally
- {
- monitor.done();
- }
- }
-
- /**
- * Returns the SystemFetchOperation to be used in performing a query. Adapters should override
- * this to provide customizations where appropriate.
- * @param o
- * @param collector
- * @return the fetch operation. By default it returns the base implementation
- */
- protected SystemFetchOperation getSystemFetchOperation(Object o, IElementCollector collector)
- {
- IWorkbenchWindow win = SystemBasePlugin.getActiveWorkbenchWindow();
- IWorkbenchPart currentPart = null;
- if (win != null){
- IWorkbenchPage page = win.getActivePage();
- if (page != null){
- currentPart = page.getActivePart();
- }
- }
- return new SystemFetchOperation(currentPart, o, this, collector);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#isContainer()
- */
- public boolean isContainer()
- {
- return true;
- }
-
- public ISchedulingRule getRule(Object element)
- {
- if (element instanceof IContextObject)
- {
- element = ((IContextObject)element).getModelObject();
- }
- IAdaptable location = (IAdaptable)element;
- return new SystemSchedulingRule(location);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ContextObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ContextObject.java
deleted file mode 100644
index ede02ccf5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ContextObject.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-
-
-/**
- * This class is used by tree views to pass context information from the views to
- * the view providers and model adapters for queries. The context information consists of
- * a model object and it may optionally contain the associated filter reference a subsystem.
- *
- * Context objects are created transiently and are only used to aid in providing filter information
- * during a query.
- *
- */
-public class ContextObject implements IContextObject
-{
- private ISubSystem _subSystem = null;
- private ISystemFilterReference _filterReference = null;
- private Object _modelObject = null;
-
- public ContextObject(Object modelObject, ISubSystem subSystem, ISystemFilterReference filterReference)
- {
- _subSystem = subSystem;
- _filterReference = filterReference;
- _modelObject = modelObject;
- }
-
- public ContextObject(Object modelObject, ISubSystem subSystem)
- {
- _modelObject = modelObject;
- _subSystem = subSystem;
- }
-
- public ContextObject(Object modelObject)
- {
- _modelObject = modelObject;
- }
-
- public ISystemFilterReference getFilterReference()
- {
- return _filterReference;
- }
-
- public ISubSystem getSubSystem()
- {
- return _subSystem;
- }
-
- public IAdaptable getModelObject()
- {
- return (IAdaptable)_modelObject;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IContextObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IContextObject.java
deleted file mode 100644
index b6ca091be..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IContextObject.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [187739] [refresh] Sub Directories are collapsed when Parent Directory is Refreshed on Remote Systems
- *******************************************************************************/
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-
-/**
- * This class is used by tree views to pass context information from the views
- * to the view providers and model adapters for queries. The context information
- * consists of a model object and it may optionally contain the associated
- * filter reference a subsystem.
- *
- * Context objects are created transiently and are only used to aid in providing
- * filter information during a query.
- *
- * @noimplement This interface is not intended to be implemented by clients
- * (this message added in RSE 3.0.1).
- */
-public interface IContextObject
-{
- /**
- * Gets the associated filter reference for the corresponding model object
- * @return the associated filter reference
- */
- public ISystemFilterReference getFilterReference();
-
- /**
- * Gets the model object for which this context applies
- * @return the model object
- */
- public IAdaptable getModelObject();
-
- /**
- * Gets the associated subsystem for the corresponding model object
- * @return the associated subsystem
- */
- public ISubSystem getSubSystem();
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java
deleted file mode 100644
index e854d327b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IRSEViewPart.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.jface.viewers.Viewer;
-
-public interface IRSEViewPart
-{
- Viewer getRSEViewer();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java
deleted file mode 100644
index e05843158..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemEditableRemoteObject.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-
-/**
- * This interface defines some common functionality required from all remote
- * resources for edit, irrespective of whether the remote system is an
- * OS/400, Windows, Linux or Unix operating system.
- */
-public interface ISystemEditableRemoteObject
-{
-
- public static final int NOT_OPEN = -1;
- public static final int OPEN_IN_SAME_PERSPECTIVE = 0;
- public static final int OPEN_IN_DIFFERENT_PERSPECTIVE = 1;
-
- /**
- * Check if user has write authority to the file.
- * @return true if user has write authority to the file, false otherwise
- */
- public boolean isReadOnly();
-
- /**
- * Indicate whether the file can be edited
- */
- public void setReadOnly(boolean isReadOnly);
-
- /**
- * Set the editor variable given an exiting editor part
- * @param editorPart the editor
- */
- public void setEditor(IEditorPart editorPart);
-
- /**
- * Download the file.
- * @param shell if the shell is null, no progress monitor will be shown
- * @return true if successful, false if cancelled
- */
- public boolean download(Shell shell) throws Exception;
-
- /**
- * Download the file.
- * @param monitor the progress monitor
- * @return true if the operation was successful. false if the user cancels.
- */
- public boolean download(IProgressMonitor monitor) throws Exception;
-
- /**
- * Saves the local file and uploads it to the host immediately, rather than, in response to a resource change
- * event.
- * @return true if the operation was successful. false if the upload fails.
- */
- public boolean doImmediateSaveAndUpload();
-
- /**
- * Get the local resource
- */
- public IFile getLocalResource();
-
- /**
- * Is the local file open in an editor
- */
- public int checkOpenInEditor() throws CoreException;
-
- /**
- * Returns the open IEditorPart for this remote object if there is one.
- */
- public IEditorPart getEditorPart();
-
- /**
- * Returns the remote object that is editable
- */
- public IAdaptable getRemoteObject();
-
-
-
- /**
- * Open in editor
- */
- public void open(Shell shell);
-
- /**
- * Open in editor
- */
- public void open(Shell shell, boolean readOnly);
-
- /**
- * Open in editor
- */
- public void open(IProgressMonitor monitor);
-
- /**
- * Open in editor
- */
- public void open(boolean readOnly, IProgressMonitor monitor);
-
- /**
- * Set local resource properties
- */
- public void setLocalResourceProperties() throws Exception;
-
- /**
- * Register as listener for various events
- */
- public void addAsListener();
-
- /**
- * Open the editor
- */
- public void openEditor() throws PartInitException;
-
- /**
- * Update the editor dirty indicator
- */
- public void updateDirtyIndicator();
-
- /**
- * Check if the file is dirty
- */
- public boolean isDirty();
-
-
- /**
- * Return the absolute path on the remote system.
- */
- public String getAbsolutePath();
-
- /**
- * Return the subsystem for the edited object.
- */
- public ISubSystem getSubSystem();
-
- /**
- * Returns whether the edited object exists.
- */
- public boolean exists();
-
- /**
- * Returns whether the underlying resource needs to be updated from the host
- */
- public boolean isStale();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java
deleted file mode 100644
index 895b7d855..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemLongRunningRequestListener.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-
-/**
- * This interface allows listeners to be kept informed when a long
- * running request starts and stops.
- */
-public interface ISystemLongRunningRequestListener
-{
-
- /**
- * A long running request is starting
- */
- public void startingLongRunningRequest(SystemLongRunningRequestEvent event);
- /**
- * A long running request is finishing
- */
- public void endingLongRunningRequest(SystemLongRunningRequestEvent event);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java
deleted file mode 100644
index 160ae4188..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemPropertyConstants.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [209593] [api] add support for "file permissions" and "owner" properties for unix files
- * Martin Oberhuber (Wind River) - [230298][api][breaking] ISystemPropertyConstants should not extend IBasicPropertyConstants
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-/**
- * Constants that are the key values used to identify properties that populate the
- * Property Sheet viewer.
- */
-public interface ISystemPropertyConstants
-{
- public static final String P_PREFIX = "org.eclipse.rse.ui."; //$NON-NLS-1$
- // GENERIC / COMMON
- public static final String P_TYPE = P_PREFIX+"type"; //$NON-NLS-1$
- public static final String P_NEWNAME = P_PREFIX+"newName"; //$NON-NLS-1$
- public static final String P_ERROR = P_PREFIX+"error"; //$NON-NLS-1$
- public static final String P_OK = P_PREFIX+"ok"; //$NON-NLS-1$
- public static final String P_FILTERSTRING = P_PREFIX+"filterString"; //$NON-NLS-1$
- public static final String P_NBRCHILDREN = P_PREFIX+"nbrChildren"; //$NON-NLS-1$
-
- // CONNECTION PROPERTIES
- public static final String P_PROFILE = P_PREFIX+"profile"; //$NON-NLS-1$
- public static final String P_SYSTEMTYPE = P_PREFIX+"systemType"; //$NON-NLS-1$
- public static final String P_HOSTNAME = P_PREFIX+"hostname"; //$NON-NLS-1$
- public static final String P_DEFAULTUSERID = P_PREFIX+"defaultuserid"; //$NON-NLS-1$
- public static final String P_DESCRIPTION = P_PREFIX+"description"; //$NON-NLS-1$
-
- // FILTER POOL PROPERTIES
- //public static final String P_IS_SHARABLE = P_PREFIX+"sharable"; // transient
-
- // FILTER PROPERTIES
- public static final String P_FILTERSTRINGS = P_PREFIX+"filterstrings"; //$NON-NLS-1$
- public static final String P_FILTERSTRINGS_COUNT = P_PREFIX+"filterstringsCount"; //$NON-NLS-1$
- public static final String P_PARENT_FILTER = P_PREFIX+"filterParent"; //$NON-NLS-1$
- public static final String P_PARENT_FILTERPOOL = P_PREFIX+"filterParentPool"; //$NON-NLS-1$
- public static final String P_RELATED_CONNECTION = P_PREFIX+"filterRelatedConnection"; //$NON-NLS-1$
- public static final String P_IS_CONNECTION_PRIVATE = P_PREFIX+"filterConnectionPrivate"; //$NON-NLS-1$
-
- // FILE PROPERTIES
- public static final String P_FILE_LASTMODIFIED = P_PREFIX+"file.lastmodified"; //$NON-NLS-1$
- public static final String P_FILE_SIZE = P_PREFIX+"file.size"; //$NON-NLS-1$
- public static final String P_FILE_PATH = P_PREFIX+"file.path"; //$NON-NLS-1$
- public static final String P_FILE_CANONICAL_PATH = P_PREFIX+"file.canonicalpath"; //$NON-NLS-1$
- public static final String P_FILE_CLASSIFICATION= P_PREFIX+"file.classification"; //$NON-NLS-1$
- /**
- * @since 3.0
- */
- public static final String P_FILE_EXTENSION = P_PREFIX+"file.extension"; //$NON-NLS-1$
- public static final String P_FILE_READONLY = P_PREFIX+"file.readonly"; //$NON-NLS-1$
- public static final String P_FILE_READABLE = P_PREFIX+"file.readable"; //$NON-NLS-1$
- public static final String P_FILE_WRITABLE = P_PREFIX+"file.writable"; //$NON-NLS-1$
- public static final String P_FILE_HIDDEN = P_PREFIX+"file.hidden"; //$NON-NLS-1$
-
- /**
- * @since 3.0
- */
- public static final String P_FILE_PERMISSIONS = P_PREFIX+"file.permissions"; //$NON-NLS-1$
- /**
- * @since 3.0
- */
- public static final String P_FILE_OWNER = P_PREFIX+"file.owner"; //$NON-NLS-1$
- /**
- * @since 3.0
- */
- public static final String P_FILE_GROUP = P_PREFIX+"file.group"; //$NON-NLS-1$
-
-
-
-
- // SEARCH LOCATION PROPERTIES
- public static final String P_SEARCH_LINE = P_PREFIX+"search.line"; //$NON-NLS-1$
- //public static final String P_SEARCH_CHAR_END = P_PREFIX+"search.char.end";
-
- // ARCHIVE FILE PROPERTIES
- public static final String P_ARCHIVE_EXPANDEDSIZE = P_PREFIX+"archive.expandedsize"; //$NON-NLS-1$
- public static final String P_ARCHIVE_COMMENT = P_PREFIX+"archive.comment"; //$NON-NLS-1$
-
- // VIRTUAL FILE PROPERTIES
- public static final String P_VIRTUAL_COMPRESSEDSIZE = P_PREFIX+"virtual.compressedsize"; //$NON-NLS-1$
- public static final String P_VIRTUAL_COMMENT = P_PREFIX+"virtual.comment"; //$NON-NLS-1$
- public static final String P_VIRTUAL_COMPRESSIONRATIO = P_PREFIX+"virtual.compressionratio"; //$NON-NLS-1$
- public static final String P_VIRTUAL_COMPRESSIONMETHOD = P_PREFIX+"virtual.compressionmethod"; //$NON-NLS-1$
-
- // SHELL PROPERTIES
- public static final String P_SHELL_STATUS = P_PREFIX+"shell.status"; //$NON-NLS-1$
- public static final String P_SHELL_CONTEXT = P_PREFIX+"shell.context"; //$NON-NLS-1$
-
- // ERROR PROPERTIES
- public static final String P_ERROR_FILENAME = P_PREFIX+"error.filename"; //$NON-NLS-1$
- public static final String P_ERROR_LINENO = P_PREFIX+"error.lineno"; //$NON-NLS-1$
-
- // USER ACTION PROPERTIES
- public static final String P_USERACTION_DOMAIN = P_PREFIX+"action.domain"; //$NON-NLS-1$
-
- // COMPILE TYPE PROPERTIES
- public static final String P_COMPILETYPE_TYPES = P_PREFIX+"compiletypes.types"; //$NON-NLS-1$
-
- // MISCELLANEOUS PROPERTIES
- public static final String P_USERID = P_PREFIX+"userid"; //$NON-NLS-1$
- public static final String P_PASSWORD = P_PREFIX+"password"; //$NON-NLS-1$
- public static final String P_CCSID = P_PREFIX+"ccsid"; //$NON-NLS-1$
- public static final String P_VRM = P_PREFIX+"vrm"; //$NON-NLS-1$
- public static final String P_ENVLIST = P_PREFIX+"envlist"; // indexed //$NON-NLS-1$
- public static final String P_FILTERS = P_PREFIX+"filters"; // indexed //$NON-NLS-1$
- public static final String P_FILTER = P_PREFIX+"filter"; // scalar //$NON-NLS-1$
- public static final String P_IS_CONNECTED = P_PREFIX+"connected"; // transient //$NON-NLS-1$
- public static final String P_IS_ACTIVE = P_PREFIX+"active"; // for profiles //$NON-NLS-1$
- public static final String P_HAS_CHILDREN = P_PREFIX+"hasChildren"; // see SystemElementViewerAdapter //$NON-NLS-1$
- public static final String P_PORT = P_PREFIX+"port"; //$NON-NLS-1$
- public static final String P_ORIGIN = P_PREFIX+"origin"; //$NON-NLS-1$
- public static final String P_VENDOR = P_PREFIX+"vendor"; //$NON-NLS-1$
- public static final String P_COMMAND = P_PREFIX+"command"; //$NON-NLS-1$
- public static final String P_COMMENT = P_PREFIX+"comment"; //$NON-NLS-1$
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java
deleted file mode 100644
index 9bf8af3d2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoteElementAdapter.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * Xuan Chen (IBM) - [223126] [api][breaking] Remove API related to User Actions in RSE Core/UI
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.core.subsystems.ISystemRemoteObjectMatchProvider;
-
-/**
- * This is an interface that only remote system objects supply adapters for.
- * <p>
- * This interface is designed to support integration of remote objects
- * into RSE's subsystems, filters and queries.
- */
-public interface ISystemRemoteElementAdapter extends ISystemRemoteObjectMatchProvider
-{
- /**
- * Return fully qualified name that uniquely identifies this remote object's
- * remote parent within its subsystem.
- * <p>
- * This is used when deleting a remote resource for example, all occurrences of
- * its parent are found and refreshed in the RSE views.
- * </p><p>
- * Note that when using filters, there is no unique parent since the same object
- * may be found in multiple contexts, below multiple filters. Still, returning
- * the parent absolute name here may help finding potentially affected parents
- * more easily.
- * </p>
- * @see #getAbsoluteName(Object)
- *
- * @return a String uniquely identifying the parent of this remote object,
- * if it is known and exists. May also return <code>null</code> if the
- * parent can not be determined or is not unique.
- */
- public String getAbsoluteParentName(Object element);
-
- /**
- * Update a visible remote object with fresh data from a new object.
- * <p>
- * Short answer: treat this like clone(), and just copy any important
- * instance variables. This allows keeping TreeItem references intact
- * but refreshing the data shown, such that selections and expand state
- * in the tree remain intact.
- * </p><p>
- * Imagine the same remote resource is shown multiple times in the same tree view.... say
- * because multiple filters resolve to it, or there are two connections to the same host.
- * Typically it is a different object in memory within the tree, but it refers to the same
- * remote resource. <br>
- * Now imagine one of the references is selected by the user and renamed via the rename action. This
- * might only update the selected reference. What about the other objects which refer to the same
- * remote resource... they need to update their in-memory "name" variable too. <br>
- * That is what this method. Every reference to the same remote resource is found (they have the
- * same absolute name and come from a system with the same hostname) and this method is called
- * on those other references. This is your opportunity to copy the attributes from the new element
- * to the old element.
- * </p><p>
- * Some view has updated the name or properties of this remote object. As a result, the
- * remote object's contents need to be refreshed. You are given the old remote object that has
- * old data, and you are given the new remote object that has the new data. For example, on a
- * rename the old object still has the old name attribute while the new object has the new
- * new attribute. You can copy the new name into the old object. Similar for any properties
- * you allow the user to edit via the property sheet.
- * </p><p>
- * This is called by viewers like SystemView in response to rename and property change events.
- * </p><p>
- * @param oldElement the element that was found in the tree
- * @param newElement the updated element that was passed in the REFRESH_REMOTE event
- * @return true if you want the viewer that called this to refresh the children of this object,
- * such as is needed on a rename of a folder, say, if the child object cache the parent folder name
- * or an absolute file name.
- */
- public boolean refreshRemoteObject(Object oldElement, Object newElement);
-
- /**
- * Return the remote edit wrapper for this object.
- *
- * @param object the object to edit
- * @return the editor wrapper for this object
- */
- public ISystemEditableRemoteObject getEditableRemoteObject(Object object);
-
- /**
- * Indicates whether the specified object can be edited or not.
- * @param object the object to edit
- * @return true if the object can be edited.
- */
- public boolean canEdit(Object object);
-
- /**
- * Return a filter string that corresponds to this object.
- * @param object the object to obtain a filter string for
- * @return the corresponding filter string if applicable
- */
- public String getFilterStringFor(Object object);
-
- /**
- * Given a remote object, returns it remote parent object.
- * <p>
- * For instance, given a file, return the folder it is contained in.
- * Not all subsystems support a unique parent-child relationship.
- * Therefore, it is acceptable to return <code>null</code>.
- * </p>
- * @param element The element for which to get the parent
- * @param monitor Optional progress monitor for long-running operation.
- * May be <code>null</code>.
- * @see #getAbsoluteParentName(Object)
- *
- * @return the parent element, or <code>null</code> if not applicable.
- */
- public Object getRemoteParent(Object element, IProgressMonitor monitor) throws Exception;
-
- /**
- * Given a remote object, return the unqualified names of the objects
- * <i>contained</i> in that parent.
- * <p>
- * This is used for testing for uniqueness on a rename operation, for example.
- * Sometimes, it is not enough to just enumerate all the objects in the parent
- * for this purpose, because duplicate names are allowed if the types are
- * different, such as on iSeries. In this case return only the names which
- * should be used to do name-uniqueness validation on a rename operation.
- * </p>
- * @param element The element for which to get names in use
- * @param monitor Optional progress monitor for long-running operation.
- * May be <code>null</code>.
- * @return a list of unqualified names contained in this folder to check
- * for uniqueness, or <code>null</code> if not applicable or
- * no such names were found.
- */
- public String[] getRemoteParentNamesInUse(Object element, IProgressMonitor monitor) throws Exception;
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java
deleted file mode 100644
index 3d0b7d217..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemRemoveElementAdapter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-/**
- * This interface must be implemented by adapters who must remove elements from
- * their list of children (not necessarily immediate children).
- */
-public interface ISystemRemoveElementAdapter {
-
- /**
- * Remove all children from the element.
- * @param element the element.
- * @return <code>true</code> if the children have been removed, <code>false</code>
- * otherwise.
- */
- public boolean removeAllChildren(Object element);
-
- /**
- * Remove a child from the element.
- * @param element the element.
- * @param child the child to remove. Does not have to be an immediate child
- * of the element.
- * @return <code>true</code> if the child has been removed, <code>false</code>
- * otherwise.
- */
- public boolean remove(Object element, Object child);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemResourceSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemResourceSelectionInputProvider.java
deleted file mode 100644
index cc8f106d6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemResourceSelectionInputProvider.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-
-/**
- * Public interface for the system resource selection input provider that is
- * used in the SystemRemoteResourceDialog and the SystemResourceSelectionForm
- *
- * @since 3.0
- */
-public interface ISystemResourceSelectionInputProvider
- extends ISystemViewInputProvider
-{
- /**
- * Gets the associated system connection
- * @return the system connection
- */
- public IHost getSystemConnection();
-
- /**
- * Indicates whether the input provider should allow new connections
- * to be created.
- * @param flag whether new connections should be allowed
- */
- public void setAllowNewConnection(boolean flag);
-
- /**
- * Returns whether multiple connections can be displayed via the
- * input provider
- * @return true if multiple connections are allowed
- */
- public boolean allowMultipleConnections();
-
- /**
- * Returns whether new connections can be created from the view
- * using this input provider.
- * @return true if new connections are allowed.
- */
- public boolean allowNewConnection();
-
- /**
- * Returns the category for the view using the input provider (i.e. "files")
- * @return the category
- */
- public String getCategory();
-
- /**
- * Sets the system types allowed for this input provider
- * @param types the types of systems
- */
- public void setSystemTypes(IRSESystemType[] types);
-
- /**
- * Gets the system types allowed for the associated control
- * @return the system types
- */
- public IRSESystemType[] getSystemTypes();
-
- /**
- * Sets the associated system connection for the input provider
- * @param connection the connection
- * @param onlyConnection whether other connections are allowed
- */
- public void setSystemConnection(IHost connection, boolean onlyConnection);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java
deleted file mode 100644
index 5071c1da1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectAllTarget.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-/**
- * This interface is implemented by all viewers that wish to support
- * the global select all action. To do so, they implement this interface,
- * then instantiate SystemCommonSelectAllAction, and call setGlobalActionHandler.
- * See SystemViewPart for an example.
- */
-public interface ISystemSelectAllTarget
-{
-
-
- /**
- * Return true if select all should be enabled for the given object.
- * For a tree view, you should return true if and only if the selected object has children.
- * You can use the passed in selection or ignore it and query your own selection.
- */
- public boolean enableSelectAll(IStructuredSelection selection);
- /**
- * When this action is run via Edit->Select All or via Ctrl+A, perform the
- * select all action. For a tree view, this should select all the children
- * of the given selected object. You can use the passed in selected object
- * or ignore it and query the selected object yourself.
- */
- public void doSelectAll(IStructuredSelection selection);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProvider.java
deleted file mode 100644
index 744b160f4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-
-/**
- * @since 3.0
- */
-public interface ISystemSelectRemoteObjectAPIProvider
- extends ISystemViewInputProvider
-{
- /**
- * This method is called by the connection adapter when the user expands
- * a connection. This method must return the child objects to show for that
- * connection.
- */
- public Object[] getConnectionChildren(IHost selectedConnection);
-
- /**
- * Get the name of the item to select when the first filter is expanded.
- * Called by the filter adapter.
- */
- public String getPreSelectFilterChild();
-
- /**
- * Get the actual object of the item to select when the first filter is expanded.
- * Called by the GUI form after expansion, so it can select this object
- */
- public Object getPreSelectFilterChildObject();
-
- /**
- * Set the filter string to use to resolve the inputs.
- * If this is an absolute filter string, it gets turned into a quick filter string,
- * so that the user sees it and can expand it. If it is a relative filter string
- * to apply to all expansions, it is used to decorate all filtering as the user drills down.
- */
- public void setFilterString(String string);
-
- /**
- * Set actual child object of the first filter to preselect. Called
- * by the filter adapter once the children are resolved and a match on
- * the name is found.
- */
- public void setPreSelectFilterChildObject(Object obj);
-
- /**
- * Set child of the first filter to preselect
- */
- public void setPreSelectFilterChild(String name);
-
- /**
- * Set the quick filters to be exposed to the user. These will be shown to the
- * user when they expand a connection.
- * @see org.eclipse.rse.core.filters.SystemFilterSimple
- */
- public void setQuickFilters(ISystemFilter[] filters);
-
-
- /**
- * Specify whether the user should see the "New Connection..." special connection prompt
- */
- public void setShowNewConnectionPrompt(boolean show);
-
-
- /**
- * Default or Restrict to a specific connection.
- * If default mode, it is preselected.
- * If only mode, it is the only connection listed.
- * @param connection The connection to default or restrict to
- * @param onlyMode true if this is to be the only connection shown in the list
- */
- public void setSystemConnection(IHost connection, boolean onlyMode);
-
-
- /**
- * Specify system types to restrict what types of connections
- * the user can create, and see.
- * This will override subsystemConfigurationId,if that has been set!
- *
- * @param systemTypes An array of system types, or
- * <code>null</code> to allow all registered valid system types.
- * A system type is valid if at least one subsystem configuration
- * is registered against it.
- */
- public void setSystemTypes(IRSESystemType[] systemTypes);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java
deleted file mode 100644
index 95f972132..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemSelectRemoteObjectAPIProviderCaller.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This is the interface that callers of the SystemSelectRemoteObjectAPIProviderCaller
- * can optionally implement to be called back for events such as the expansion of a
- * promptable, transient filter.
- */
-public interface ISystemSelectRemoteObjectAPIProviderCaller
-{
-
- /**
- * Prompt the user to create a new filter as a result of the user expanding a promptable
- * transient filter.
- *
- * @return the filter created by the user or null if they cancelled the prompting
- */
- public ISystemFilter createFilterByPrompting(ISystemFilter filterPrompt, Shell shell)
- throws Exception;
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTableViewColumnManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTableViewColumnManager.java
deleted file mode 100644
index acf9b0db9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTableViewColumnManager.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-/**
- * @since 3.0
- */
-public interface ISystemTableViewColumnManager {
-
- public IPropertyDescriptor[] getVisibleDescriptors(ISystemViewElementAdapter adapter);
-
- public void setCustomDescriptors(ISystemViewElementAdapter adapter, IPropertyDescriptor[] descriptors);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java
deleted file mode 100644
index 560a29dea..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemTree.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [187711] Select SystemView APIs exposed by the ISystemTree interface
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * To drive our GUI we find ourselves adding additional useful methods on top of the
- * JFace tree viewer in our subclasses. We capture those here in an interface so they
- * can be implemented by other viewers that wish to fully drive our UI. Typically this
- * is for interesting properties in the property sheet.
- */
-public interface ISystemTree {
-
- /**
- * This is called to ensure all elements in a multiple-selection have the same parent in the
- * tree viewer. Typically used to disable actions that must take place on a coordinated
- * selection.
- * @return true if the elements of the selection in the viewer all have the same parent
- */
- public boolean sameParent();
-
- /**
- * Called to select an object within the tree, and optionally expand it.
- * @param element the element in the tree to select
- * @param expand true if the element is to be expanded
- */
- public void select(Object element, boolean expand);
-
- /**
- * @param element the element in the tree to query
- * @return the number of immediate children in the tree, for the given tree node
- */
- public int getChildCount(Object element);
-
- /**
- * This is called to accurately get the parent object for the current selection
- * for this viewer.
- * The getParent() method in the adapter is unreliable since adapted objects are
- * unaware of the context which can change via filtering and view options.
- * @return the parent of the selection
- */
- public Object getSelectedParent();
-
- /**
- * This returns the element immediately before the first selected element in this tree level.
- * Often needed for enablement decisions for move up actions.
- * @return the object prior to the selection, null if there is none
- */
- public Object getPreviousElement();
-
- /**
- * This returns the element immediately after the last selected element in this tree level
- * Often needed for enablement decisions for move down actions.
- * @return the object after the selection, null if there is none
- */
- public Object getNextElement();
-
- /**
- * This is called to walk the tree back up to the roots and return the visible root
- * node for the first selected object.
- * @return the root object
- */
- public Object getRootParent();
-
- /**
- * This returns an array containing each element in the tree, up to but not including the root.
- * The array is in reverse order, starting at the leaf and going up.
- * @param element the element from which to begin
- * @return the array of objects in the path from leaf to root. Excluding the leaf and root.
- */
- public Object[] getElementNodes(Object element);
-
- /**
- * Helper method to determine if a given object is currently selected.
- * Considers an element to be "selected" if a child node of the given object is currently selected.
- * @param parentElement the element to query
- * @return true if the element covers any portion of the selection
- */
- public boolean isSelectedOrChildSelected(Object parentElement);
-
- /**
- * Called when a property is updated and we need to inform the Property Sheet viewer.
- * There is no formal mechanism for this so we simulate a selection changed event as
- * this is the only event the property sheet listens for.
- */
- public void updatePropertySheet();
-
- /**
- * Returns the tree item of the first selected object. Used for setViewerItem in a resource
- * change event.
- * @return the item
- */
- public Item getViewerItem();
-
- /**
- * @return true if any of the selected items are currently expanded
- */
- public boolean areAnySelectedItemsExpanded();
-
- /**
- * @return true if any of the selected items are expandable but not yet expanded
- */
- public boolean areAnySelectedItemsExpandable();
-
- /**
- * Find the first binary-match or name-match of a remote object, given its binary object.
- * @param remoteObject - The remote object to find.
- * @param parentItem - Optionally, the parent item to start the search at
- * @return TreeItem hit if found
- * @since 3.0
- */
- public Item findFirstRemoteItemReference(Object remoteObject, Item parentItem);
-
- /**
- * Expand a given filter, given a subsystem that contains a reference to the filter's pool.
- * This will expand down to the filter if needed
- * @param parentSubSystem - the subsystem containing a reference to the filter's parent pool
- * @param filter - the filter to find, reveal, and expand within the subsystem context
- * @return the filter reference to the filter if found and expanded. This is a unique binary address
- * within the object's in this tree, so can be used in the viewer methods to affect this particular
- * node.
- * @since 3.0
- */
- public ISystemFilterReference revealAndExpand(ISubSystem parentSubSystem, ISystemFilter filter);
-
- /**
- * Return the Tree widget
- * @return tree widget
- * @since 3.0
- */
- public Tree getTree();
-
- /**
- * Create tree items for the specified children
- *
- * @param widget the parent item for the items to create
- * @param children the children to create items for
- * @since 3.0
- */
- public void createTreeItems(TreeItem widget, Object[] children);
-
- /**
- * Recursively tries to find a given remote object. Since the object memory object
- * for a remote object is not dependable we call getAbsoluteName() on the adapter to
- * do the comparisons. Note this does not take into account the parent connection or
- * subsystem or filter, hence you must know where to start the search, else you risk
- * finding the wrong one.
- *
- * @param element the remote object to which we want to find a tree item which references it. Can be a string or an object
- * @param elementObject the actual remote element to find, for binary matching, optionally for cases when element is a string
- * @param matches the List to populate with hits, or <code>null</code> to
- * get a new List created and returned with the hits.
- * @return the List populated with hits, or <code>null</code> if <code>null</code>
- * was passed in as the List to populate and no hits were found.
- * @since 3.0
- */
- public List findAllRemoteItemReferences(Object element, Object elementObject, List matches);
-
- /**
- * Sets the auto expand level for the corresponding tree
- * @param level the level to expand
- * @since 3.0
- */
- public void setAutoExpandLevel(int level);
-
- /**
- * Adds a double-click listener
- * @param listener the listener to add
- * @since 3.0
- */
- public void addDoubleClickListener(IDoubleClickListener listener);
-
- /**
- * Checks whether the element is expandable or not
- * @param elementOrTreePath the object to expand
- * @return whether the item is expandable
- * @since 3.0
- */
- public boolean isExpandable(Object elementOrTreePath);
-
- /**
- * Expands the parent object down to the remote object
- * @param parentObject the parent object
- * @param remoteObject the child object
- * @since 3.0
- */
- public void expandTo(Object parentObject, Object remoteObject);
-
- /**
- * Expand to the object specified by the filter string
- * @param filterString the string represending the object to expand to
- * @since 3.0
- */
- public void expandTo(String filterString);
-
- /**
- * Adds a view filter
- * @param filter the view filter
- * @since 3.0
- */
- public void addFilter(ViewerFilter filter);
-
-
- /**
- * Adds a selection changed listener
- * @param listener the listener
- * @since 3.0
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener);
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java
deleted file mode 100644
index 8296273d4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewDropDestination.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-/**
- * An adapter can elect to suppot this interface and answer
- * whether it support copy/move/drop from the source (given adapter
- * type) to the specified destination.
- * @author A.Kent Hawley
- */
-public interface ISystemViewDropDestination
-{
-
- /**
- * Asks source adapter whether it supports dropping it on the given target.
- * @param target the target to drop to.
- * @return <code>true</code> if the drop destination is supported, <code>false</code> otherwise.
- */
- public boolean supportDropDestination(Object target);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java
deleted file mode 100644
index a11ee2862..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [208803] add exists() method
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David Dykstal (IBM) - [234215] improve API documentation for doDelete and doDeleteBatch
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-
-
-/**
- * This is the interface for an adapter on objects in the system viewer.
- * Any input into the system viewer must register an adapter that implements this interface.
- * <p>
- * This interface supports a union of all the methods needed to support a TreeViewer
- * content provider and label provider. The {@link org.eclipse.rse.internal.ui.view.SystemViewLabelAndContentProvider}
- * delegates to objects of this interface almost completely. It gets such an
- * object by calling:</p>
- * <pre><code>
- * isve = object.getAdapter(ISystemViewElementAdapter.class);
- * interestingInfo = isve.getXXXX(object);
- * </code></pre>
- * <p>
- * This interface also supports IPropertySource via inheritance, so we can feed the
- * PropertySheet.
- * </p>
- * <p>For remote resource objects, their adapter should also implement
- * {@link org.eclipse.rse.ui.view.ISystemRemoteElementAdapter}
- * </p>
- * @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter
- */
-public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragDropAdapter, IActionFilter
-{
- public static final IAction[] noActions = new IAction[0];
-
- /**
- * Set the shell to be used by any method that requires it.
- * This is set by the Label and Content providers that retrieve this adapter.
- */
- public void setShell(Shell shell);
-
- /**
- * Set the viewer that is driving this adapter. Used adapters that implements to access current viewer.
- * This is set by the Label and Content providers that retrieve this adapter.
- */
- public void setViewer(Viewer viewer);
-
- /**
- * Set the input object used to populate the viewer with the roots.
- * May be used by an adapter to retrieve context-sensitive information.
- * This is set by the Label and Content providers that retrieve this adapter.
- */
- public void setInput(ISystemViewInputProvider input);
-
- /**
- * Get the shell currently hosting the objects in this adapter, as last set
- * by the label or content provider that retrieved this adapter.
- */
- public Shell getShell();
- /**
- * Return the current viewer, as set via setViewer or its deduced from the
- * setInput input object if set. May be null so test it.
- */
- public Viewer getViewer();
- /**
- * Get the input object used to populate the viewer with the roots.
- * May be used by an adapter to retrieve context-sensitive information.
- */
- public ISystemViewInputProvider getInput();
-
-
- /**
- * Get the subsystem that corresponds to this object if one exists.
- *
- * @param element The element to be identified. May be of type
- * {@link IContextObject} (including the context of the element),
- * {@link String} (giving the absolute path of a remote object),
- * or the actual remote data element itself.
- */
- public ISubSystem getSubSystem(Object element);
-
- /**
- * Wrapper to getPropertyValue(Object key) that takes an argument
- * for determining whether to return a raw value or formatted value.
- *
- */
- public Object getPropertyValue(Object key, boolean formatted);
-
-
- /**
- * Returns the list of property descriptors that are unique for this
- * particular adapter - that is the difference between the default
- * property descriptors and the total list of property descriptors.
- */
- public IPropertyDescriptor[] getUniquePropertyDescriptors();
-
-
- /**
- * This is your opportunity to add actions to the popup menu for the given selection.
- * <p>
- * To put your action into the given menu, use the menu's {@link org.eclipse.rse.ui.SystemMenuManager#add(String,IAction) add} method.
- * If you don't care where it goes within the popup, just pass the given <samp>menuGroup</samp> location id,
- * otherwise pass one of the GROUP_XXX values from {@link ISystemContextMenuConstants}. If you pass one that
- * identifies a pre-defined cascading menu, such as GROUP_OPENWITH, your action will magically appear in that
- * cascading menu, even if it was otherwise empty.
- * <p>
- * For the actions themselves, you will probably use one of the base action classes:
- * <ul>
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseAction SystemBaseAction}. For a simple action doesn't present any UI.
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseDialogAction}. For an action that presents a {@link org.eclipse.rse.ui.dialogs.SystemPromptDialog dialog}.
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseDialogAction SystemBaseWizardAction}. For an action that presents a {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard wizard}.
- * <li>{@link org.eclipse.rse.ui.actions.SystemBaseSubMenuAction SystemBaseSubMenuAction}. For an action that cascades into a submenu with other actions.
- * </ul>
- *
- * @param menu the popup menu you can contribute to
- * @param selection the current selection in the calling tree or table view
- * @param parent the shell of the calling tree or table view
- * @param menuGroup the default menu group to place actions into if you don't care where they. Pass this to the SystemMenuManager {@link org.eclipse.rse.ui.SystemMenuManager#add(String,IAction) add} method.
- */
- public void addActions(SystemMenuManager menu, IStructuredSelection selection, Shell parent, String menuGroup);
- /**
- * Returns an image descriptor for the image. More efficient than getting
- * the image. Implements {@link IWorkbenchAdapter#getImageDescriptor(Object)
- * }.
- *
- * @param element The element for which an image is desired
- */
- public ImageDescriptor getImageDescriptor(Object element);
- /**
- * Return the label for this object.
- */
- public String getText(Object element);
- /**
- * Return the alternate label for this object.
- */
- public String getAlternateText(Object element);
- /**
- * Return the name of this object, which may be different than the display text ({#link #getText(Object)}.
- */
- public String getName(Object element);
- /**
- * Return a value for the type property for this object.
- */
- public String getType(Object element);
- /**
- * Return the string to display in the status line when the given object is
- * selected.
- */
- public String getStatusLineText(Object element);
-
-
- /**
- * Returns whether the specified element is represented as existing. Note that
- * it's possible that the represented element will been seen to exist when on
- * a remote host it may not - that is because this call does not query the host.
- *
- * @param element the element to check
- * @return true if the element exists
- * @since 3.0
- */
- public boolean exists(Object element);
-
- /**
- * Return the parent of this object. This is required by eclipse UI
- * adapters, but we try desperately not to use in the RSE. So, you are
- * probably safe returning null, but if you can return a parent, why not, go
- * for it.
- */
- public Object getParent(Object element);
-
-
-
- /**
- * Return the children of this model object.
- *
- * When {@link #supportsDeferredQueries(ISubSystem)} returns false,
- * this query will be called in the dispatch thread, so the implementation
- * needs to make sure that SWT thread exceptions are avoided.
- *
- * @param element the model object to query
- * @param monitor the progress monitor
- * @return the children of element
- */
- public Object[] getChildren(IAdaptable element, IProgressMonitor monitor);
-
- /**
- * Return the children of this object.
- *
- * When a contextObject is passed in instead of an adaptable model
- * object, the adapter needs handle both the model object as well
- * as the associated filter.
- *
- * When {@link #supportsDeferredQueries(ISubSystem)} returns false,
- * this query will be called in the dispatch thread, so the implementation
- * needs to make sure that SWT thread exceptions are avoided.
- *
- * @param contextObject a wrapper object that contains the model object plus context information
- * @param monitor the progress monitor
- * @return the children of the model object in contextObject that matches the filter in contextObject
- */
- public Object[] getChildren(IContextObject contextObject, IProgressMonitor monitor);
-
- /**
- * Return the children of this object, using the given Expand-To filter
- */
- public Object[] getChildrenUsingExpandToFilter(Object element, String expandToFilter);
-
- /**
- * Return true if this object has children.
- * <p>
- * In case this adapter returns true for {@link #supportsDeferredQueries(ISubSystem)},
- * it is expected that the underlying subsystem caches the hasChildren() attribute
- * such that it does not necessarily perform a server round trip. In this case, it
- * has more the semantics of "can have children". In that case,
- * a deferred {@link #getChildren(IAdaptable, IProgressMonitor)}
- * call is still allowed to return an empty array indicating no children.
- * </p>
- * @param element the element to check
- * @return <code>true</code> if this element can have children.
- */
- public boolean hasChildren(IAdaptable element);
-
- /**
- * Return true if this object has children.
- * @see #hasChildren(IAdaptable)
- * @param element the element to check
- * @return <code>true</code> if this element can have children.
- */
- public boolean hasChildren(IContextObject element);
-
- /**
- * Return true if this object is a "prompting" object that prompts the user when expanded.
- * For such objects, we do not try to save and restore their expansion state on F5 or between
- * sessions
- */
- public boolean isPromptable(Object element);
-
-
- /**
- * Return true if this object is a "remote" object. A remote object is defined as an object
- * that is not part of the base RSE artifacts (hosts, subsystems, filters). This method is used
- * to decide whether certain actions will be available from views, and how views should handle refreshing
- * such objects. Remote objects can appear more than once in the same view, while non-remote objects
- * are more confined and can be handled very clearly by the RSE UI framework.
- * @param element the object to check
- * @return true if the object is remote
- */
- public boolean isRemote(Object element);
-
- /**
- * Set input object for property source queries. This is called by the
- * SystemViewAdaptorFactory before returning this adapter object.
- * Handled automatically if you start with AbstractSystemViewAdaptor.
- */
- public void setPropertySourceInput(Object propertySourceInput);
-
- /**
- * User has double clicked on an object. If you want to do something special,
- * do it and return true. Otherwise return false to have the viewer do the default behaviour.
- */
- public boolean handleDoubleClick(Object element);
-
- // ------------------------------------------
- // METHODS TO SUPPORT GLOBAL DELETE ACTION...
- // ------------------------------------------
- /**
- * Return true if we should show the delete action in the popup for the given element.
- * If true, then canDelete will be called to decide whether to enable delete or not.
- */
- public boolean showDelete(Object element);
- /**
- * Return true if this object is deletable by the user. If so, when selected,
- * the Edit->Delete menu item will be enabled.
- */
- public boolean canDelete(Object element);
-
-
- /**
- * Perform the delete action on single item. Implement if the object is
- * deletable.
- * <p>
- * Implementers have two choices of dealing with error conditions:
- * handle the error themselves (for example, by showing an error dialog) and returning
- * <code>false</code>; or by throwing an Exception and having the framework
- * handle the error.
- * <p>
- * If the operation is cancelled, the implementation is free to either
- * return <code>false</code> or throw a
- * {@link SystemOperationCancelledException}, since in both cases the
- * framework will refresh the element to see whether it has
- * actually been deleted or not, but not show any other message.
- *
- * @param shell The shell that can act as a parent for an adapter-issued
- * message dialog.
- * @param element The element that should be deleted.
- * @param monitor The progress monitor for progress and cancellation. May be
- * <code>null</code>.
- * @return <code>true</code> indicates that the deletion succeeded,
- * <code>false</code> indicates that the deletion failed but no user
- * feedback is required by the framework because the implementation
- * has already handled the error or cancellation.
- * @throws Exception if the deletion failed and the adapter did not show a
- * message dialog.
- * @see #showDelete(Object)
- * @see #canDelete(Object)
- */
- public boolean doDelete(Shell shell, Object element, IProgressMonitor monitor) throws Exception;
-
- /**
- * Perform the delete on the given set of items.
- * <p>
- * See {@link #doDelete(Shell, Object, IProgressMonitor)} for semantics of
- * error handling and cancellation.
- *
- * @param shell the shell that can act as a parent for an adapter-issued
- * message dialog.
- * @param resourceSet a list of resources that should be deleted.
- * @param monitor The progress monitor for progress and cancellation. May be
- * <code>null</code>.
- * @return <code>true</code> if all deletions were successful,
- * <code>false</code> if any deletion was not successful but proper
- * error reporting has been done by the adapter already. The
- * framework will only refresh the items to see which ones have
- * actually been deleted.
- * @throws Exception if any deletion was not successful and the adapter did
- * not perform any error reporting. If this is a
- * {@link SystemMessageException} then the caller should examine
- * the results and fire any necessary events.
- */
- public boolean doDeleteBatch(Shell shell, List resourceSet, IProgressMonitor monitor) throws Exception;
-
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON RENAME ACTION...
- // ------------------------------------------
- /**
- * Return true if we should show the rename action in the popup for the given element.
- * If true, then canRename will be called to decide whether to enable rename or not.
- */
- public boolean showRename(Object element);
- /**
- * Return true if this object is renamable by the user. If so, when selected,
- * the Rename popup menu item will be enabled.
- */
- public boolean canRename(Object element);
- /**
- * Perform the rename on the given item.
- * @since 3.0
- */
- public boolean doRename(Shell shell, Object element, String name, IProgressMonitor monitor)
- throws Exception;
-
-
-
- /**
- * Return a validator for verifying the new name is correct.
- * If you return null, no error checking is done on the new name!!
- * Suggest you use at least UniqueStringValidator or a subclass to ensure
- * new name is at least unique.
- */
- public ISystemValidator getNameValidator(Object element);
- /**
- * Form and return a new canonical (unique) name for this object, given a candidate for the new
- * name. This is called by the generic multi-rename dialog to test that all new names are unique.
- * To do this right, sometimes more than the raw name itself is required to do uniqueness checking.
- * <p>
- * For example, two connections or filter pools can have the same name if they are
- * in different profiles. Two iSeries QSYS objects can have the same name if their object types
- * are different.
- * <p>
- * This method returns a name that can be used for uniqueness checking because it is qualified
- * sufficiently to make it unique.
- */
- public String getCanonicalNewName(Object element, String newName);
- /**
- * Compare the name of the given element to the given new name to decide if they are equal.
- * Allows adapters to consider case and quotes as appropriate.
- */
- public boolean namesAreEqual(Object element, String newName);
- // ------------------------------------------
- // METHODS TO SUPPORT COMMON REFRESH ACTION...
- // ------------------------------------------
- /**
- * Return true if we should show the refresh action in the popup for the given element.
- */
- public boolean showRefresh(Object element);
-
- // ----------------------------------------------
- // METHODS TO SUPPORT COMMON PROPERTIES ACTION...
- // ----------------------------------------------
- /**
- * Return true if we should show the properties action in the popup for the given element.
- */
- public boolean showProperties(Object element);
-
- // ------------------------------------------------------------
- // METHODS TO SUPPORT COMMON OPEN-IN-NEW-PERSPECTIVE ACTIONS...
- // ------------------------------------------------------------
- /**
- * Return true if we should show the refresh action in the popup for the given element.
- */
- public boolean showOpenViewActions(Object element);
-
- /**
- * Return true if we should show the generic show in table action in the popup for the given element.
- */
- public boolean showGenericShowInTableAction(Object element);
-
- // ------------------------------------------------------------
- // METHODS FOR SAVING AND RESTORING EXPANSION STATE OF VIEWER...
- // ------------------------------------------------------------
- /**
- * Return what to save to disk to identify this element in the persisted list of expanded elements.
- * This just defaults to getName, but if that is not sufficient override it here.
- */
- public String getMementoHandle(Object element);
- /**
- * Return what to save to disk to identify this element when it is the input object to a secondary
- * Remote System Explorer perspective.
- */
- public String getInputMementoHandle(Object element);
- /**
- * Return a short string to uniquely identify the type of resource. Eg "conn" for connection.
- * This just defaults to getType, but if that is not sufficient override it here, since that is
- * a translated string.
- */
- public String getMementoHandleKey(Object element);
- /**
- * Somtimes we don't want to remember an element's expansion state, such as for temporarily inserted
- * messages. In these cases return false from this method. The default is true
- */
- public boolean saveExpansionState(Object element);
- public void selectionChanged(Object element); // d40615
-
- public void setFilterString(String filterString);
- public String getFilterString();
-
- /**
- * Return whether deferred queries are supported. By default
- * they are not supported. Subclasses must override this to
- * return true if they are to support this.
- * @param subSys subsystem to use for deferred queries.
- * @return <code>true</code> if it supports deferred queries, <code>false</code> otherwise.
- */
- public boolean supportsDeferredQueries(ISubSystem subSys);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java
deleted file mode 100644
index fdae9ddf0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewRunnableObject.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-import org.eclipse.swt.widgets.Shell;
-/**
- * This interface is for any object in the system views that want to
- * support the SystemRunAction action in their popup. It will
- * call that object's run(Shell) method when invoked
- */
-public interface ISystemViewRunnableObject
-{
-
-
- public Object[] run(Shell shell);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IViewLinker.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IViewLinker.java
deleted file mode 100644
index c9746f8c2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/IViewLinker.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * David McKnight (IBM) - [187711] IViewLinker to be API that system view part calls when link with editor
- *******************************************************************************/
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @since 3.0
- */
-public interface IViewLinker {
-
- /**
- * System View part calls link when using Link With Editor. Provider of action supplies this implementation.
- * @param editor the active editor
- * @param systemTree the view to link
- */
- public void linkEditorToView(IEditorPart editor, ISystemTree systemTree);
-
-
- /**
- * System View part calls link when using Link With Editor. Provider of action supplies this implementation.
- * @param editor the active editor
- * @param page the active workbench page
- */
- public void linkViewToEditor(Object remoteObject, IWorkbenchPage page);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java
deleted file mode 100644
index 4df0f80d4..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SubSystemConfigurationAdapter.java
+++ /dev/null
@@ -1,1234 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [189123] Move renameSubSystemProfile() from UI to Core
- * Martin Oberhuber (Wind River) - [190231] Remove UI-only code from SubSystemConfiguration
- * Martin Oberhuber (Wind River) - [174789] [performance] Don't contribute Property Pages to Wizard automatically
- * David McKnight (IBM) - [197129] Removing obsolete ISystemConnectionWizardPropertyPage and SystemSubSystemsPropertiesWizardPage
- * David Dykstal (IBM) - [217556] remove service subsystem types
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
- * David McKnight (IBM) - [238158] Can create duplicate filters
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.filters.ISystemFilter;
-import org.eclipse.rse.core.filters.ISystemFilterPool;
-import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
-import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
-import org.eclipse.rse.core.filters.ISystemFilterPoolWrapperInformation;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.filters.ISystemFilterString;
-import org.eclipse.rse.core.model.ISubSystemConfigurator;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.core.subsystems.SubSystem;
-import org.eclipse.rse.core.subsystems.SubSystemConfiguration;
-import org.eclipse.rse.internal.core.filters.SystemFilterPoolWrapperInformation;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemClearPasswordAction;
-import org.eclipse.rse.internal.ui.actions.SystemConnectAction;
-import org.eclipse.rse.internal.ui.actions.SystemDisconnectAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterCascadingNewFilterPoolReferenceAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterCopyFilterAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterCopyFilterPoolAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterMoveDownFilterAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterMoveDownFilterPoolReferenceAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterMoveFilterAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterMoveFilterPoolAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterMoveUpFilterAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterMoveUpFilterPoolReferenceAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterNewFilterPoolAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterRemoveFilterPoolReferenceAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterSelectFilterPoolsAction;
-import org.eclipse.rse.internal.ui.actions.SystemFilterWorkWithFilterPoolsAction;
-import org.eclipse.rse.internal.ui.subsystems.SubSystemConfigurationProxyAdapter;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemPasteFromClipboardAction;
-import org.eclipse.rse.ui.filters.actions.ISystemNewFilterActionConfigurator;
-import org.eclipse.rse.ui.filters.actions.SystemChangeFilterAction;
-import org.eclipse.rse.ui.filters.actions.SystemFilterAbstractFilterPoolAction;
-import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
-import org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.propertypages.ISystemSubSystemPropertyPageCoreForm;
-import org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage;
-import org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage;
-import org.eclipse.rse.ui.propertypages.SystemSubSystemPropertyPageCoreForm;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorPortInput;
-import org.eclipse.rse.ui.validators.ValidatorSpecialChar;
-import org.eclipse.rse.ui.widgets.IServerLauncherForm;
-import org.eclipse.rse.ui.widgets.RemoteServerLauncherForm;
-import org.eclipse.rse.ui.wizards.SubSystemServiceWizardPage;
-import org.eclipse.rse.ui.wizards.newconnection.ISystemNewConnectionWizardPage;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-
-public class SubSystemConfigurationAdapter implements ISubSystemConfigurationAdapter, ISystemNewFilterActionConfigurator
-{
- protected Hashtable imageTable = null;
-
- // actions stuff...
- private IAction[] subSystemActions = null;
- private IAction[] filterPoolActions = null;
- private IAction[] filterPoolReferenceActions = null;
- private IAction[] filterActions = null;
- public SubSystemConfigurationAdapter()
- {
- }
-
-
- /**
- * Returns any framework-supplied actions remote objects that should be contributed to the popup menu
- * for the given selection list. This does nothing if this adapter does not implement ISystemRemoteElementAdapter,
- * else it potentially adds menu items for "User Actions" and Compile", for example. It queries the subsystem
- * configuration of the selected objects to determine if these actions are appropriate to add.
- *
- * <p>
- * No need to override.
- *
- * @param menu The menu to contribute actions to
- * @param selection The window's current selection.
- * @param shell of viewer calling this. Most dialogs require a shell.
- * @param menuGroup recommended menu group to add actions to. If added to another group, you must be sure to create that group first.
- * @param subsystem the subsystem of the selection
- */
- public void addCommonRemoteActions(ISubSystemConfiguration config, SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystem subsystem)
- {
- /** FIXME - UDAs should not be coupled to subsystem configuration adapter
- SystemCompileManager mgr = config.getCompileManager();
-
- if (config.supportsCompileActions() && (mgr != null))
- {
- int size = selection.size();
-
- // for single selections, we try to avoid iterator, to hopefully make it a bit faster
- if (size == 1)
- {
- if (mgr.isCompilable(selection.getFirstElement()))
- { // check that selection is compilable
- mgr.addCompileActions(shell, selection, menu, menuGroup);
- }
- }
- else if (size > 1)
- {
- Iterator iter = selection.iterator();
-
- boolean allCompilable = true;
-
- // check that all selections are compilable
- while (iter.hasNext())
- {
- Object element = iter.next();
- allCompilable = mgr.isCompilable(element);
-
- if (!allCompilable)
- {
- break;
- }
- }
-
- if (allCompilable)
- {
- mgr.addCompileActions(shell, selection, menu, menuGroup);
- }
- }
- }
-
- if (config.supportsUserDefinedActions() && config.supportsUserDefinedActions(selection))
- {
- addUserDefinedActions(config, shell, selection, menu, menuGroup, getActionSubSystem(config, subsystem));
- }
- **/
- }
-
- // -----------------------------------
- // WIZARD PAGE CONTRIBUTION METHODS... (UCD defect 43194)
- // -----------------------------------
- /**
- * Optionally return one or more wizard pages to append to the New Wizard connection if
- * the user selects a system type that this subsystem configuration supports.
- * <p>
- * Some details:
- * <ul>
- * <li>The wizard pages must implement ISystemNewConnectionWizardPage, so as to fit into the wizard's framework
- * <li>When the user successfully presses Finish, the createConnection method in the SystemRegistry will call
- * your {@link SubSystemConfiguration#createSubSystem(org.eclipse.rse.core.model.IHost,boolean, ISubSystemConfigurator[])} method to create the
- * your subsystem for the connection. The same pages you return here are passed back to you so you can
- * interrogate them for the user-entered data and use it when creating the default subsystem instance.
- * </ul>
- * Tip: consider extending {@link org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage} for your wizard page class.
- *
- * @since 3.0 ISystemNewConnectionWizardPage moved from Core to UI
- */
- public ISystemNewConnectionWizardPage[] getNewConnectionWizardPages(ISubSystemConfiguration config, IWizard wizard)
- {
- if (config.getServiceType() != null)
- {
- SubSystemServiceWizardPage page = new SubSystemServiceWizardPage(wizard, config);
- return new ISystemNewConnectionWizardPage[] {page};
- }
- //MOB Removed due to performance issue -- see Eclipse Bugzilla bug 174789
-// else
-// {
-// List pages = getSubSystemPropertyPages(config);
-// if (pages != null && pages.size() > 0)
-// {
-// SystemSubSystemsPropertiesWizardPage page = new SystemSubSystemsPropertiesWizardPage(wizard, config, pages);
-// return new ISystemNewConnectionWizardPage[] {page};
-// }
-// }
- return new ISystemNewConnectionWizardPage[0];
- }
-
- /*
- * Return the form used in the subsystem property page. This default implementation returns Syste
- */
- public ISystemSubSystemPropertyPageCoreForm getSubSystemPropertyPageCoreFrom(ISubSystemConfiguration config, ISystemMessageLine msgLine, Object caller)
- {
- return new SystemSubSystemPropertyPageCoreForm(msgLine, caller);
- }
-
-
-
- // FIXME - UDAs no longer coupled with config in core
-// // ---------------------------------
-// // USER-DEFINED ACTIONS METHODS...
-// // ---------------------------------
-//
-// /**
-// * Get the action subsystem object for this subsystemconfiguration,
-// * and set its current subsystem to the given subsystem instance.
-// * Will ensure the user action subsystem is only ever instantiated once.
-// * <p>
-// * Called in the Work With User Actions and the User Actions cascading action.
-// * <p>
-// * Do not override this, as the implementation is complete. However,
-// * you must override createActionSubSystem.
-// *
-// * @see #supportsUserDefinedActions()
-// * @see #createActionSubSystem()
-// */
-// public SystemUDActionSubsystem getActionSubSystem(ISubSystemConfiguration config, ISubSystem subsystem)
-// {
-// if (udas == null)
-// udas = createActionSubSystem(config);
-// if (udas != null)
-// {
-// udas.setSubsystem(subsystem);
-// udas.setSubSystemConfiguration(config);
-// }
-// return udas;
-// }
-//
-// /**
-// * Overridable method to instantiate the SystemUDActionSubsystem.
-// * You must override this if you return true to supportsUserActions.
-// *
-// * @see #supportsUserDefinedActions()
-// * @see #getActionSubSystem(ISubSystem)
-// */
-// protected SystemUDActionSubsystem createActionSubSystem(ISubSystemConfiguration config)
-// {
-// return null;
-// }
-//
-// /**
-// * Populate main context menu with a "User Actions->" submenu cascade,
-// * which will only be populated when the submenu is selected.
-// * <p>
-// * This is called by the addCommonRemoteObjectsActions method, if this subsystem
-// * supports user defined actions.
-// */
-// public static void addUserDefinedActions(ISubSystemConfiguration config, Shell shell, IStructuredSelection selection, SystemMenuManager menu, String menuGroup, SystemUDActionSubsystem userActionSubSystem)
-// {
-// SystemUDACascadeAction act = new SystemUDACascadeAction(userActionSubSystem, selection);
-// menu.add(menuGroup, act);
-// }
-
-
- // ---------------------------------
- // COMPILE ACTIONS METHODS...
- // ---------------------------------
-
- // ---------------------------------
- // USER-PREFERENCE METHODS...
- // ---------------------------------
-
-
- // ---------------------------------
- // PROXY METHODS. USED INTERNALLY...
- // ---------------------------------
-
-
- // ---------------------------------
- // FACTORY ATTRIBUTE METHODS...
- // ---------------------------------
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
- */
- public ImageDescriptor getImage(ISubSystemConfiguration config)
- {
- ISubSystemConfigurationProxy proxy = config.getSubSystemConfigurationProxy();
- Object adapterCandidate = Platform.getAdapterManager().getAdapter(proxy, SubSystemConfigurationProxyAdapter.class);
- SubSystemConfigurationProxyAdapter adapter = (SubSystemConfigurationProxyAdapter) adapterCandidate;
- ImageDescriptor result = adapter.getImageDescriptor();
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getGraphicsImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
- */
- public Image getGraphicsImage(ISubSystemConfiguration config)
- {
- ImageDescriptor id = getImage(config);
- if (id != null)
- {
- Image image = null;
- if (imageTable == null)
- imageTable = new Hashtable();
- else
- image = (Image) imageTable.get(id);
- if (image == null)
- {
- image = id.createImage();
- imageTable.put(id, image);
- }
- return image;
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getLiveImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
- */
- public ImageDescriptor getLiveImage(ISubSystemConfiguration config)
- {
- ISubSystemConfigurationProxy proxy = config.getSubSystemConfigurationProxy();
- Object adapterCandidate = Platform.getAdapterManager().getAdapter(proxy, SubSystemConfigurationProxyAdapter.class);
- SubSystemConfigurationProxyAdapter adapter = (SubSystemConfigurationProxyAdapter) adapterCandidate;
- ImageDescriptor result = adapter.getLiveImageDescriptor();
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getGraphicsLiveImage(org.eclipse.rse.core.subsystems.ISubSystemConfiguration)
- */
- public Image getGraphicsLiveImage(ISubSystemConfiguration config)
- {
- ImageDescriptor id = getLiveImage(config);
- if (id != null)
- {
- Image image = null;
- if (imageTable == null)
- imageTable = new Hashtable();
- else
- image = (Image) imageTable.get(id);
- if (image == null)
- {
- image = id.createImage();
- imageTable.put(id, image);
- }
- return image;
- }
- return null;
- }
-
-
- // ---------------------------------
- // PROFILE METHODS...
- // ---------------------------------
-
- // private methods...
-
-
- // ---------------------------------
- // SUBSYSTEM METHODS...
- // ---------------------------------
-
-
- /**
- * Returns a list of actions for the popup menu when user right clicks on a subsystem object from this subsystem configuration.
- * <p>
- * Override if additional actions needs to be contributed.
- * <p>
- * @see #getSubSystemNewFilterPoolActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystemConfiguration, ISubSystem)
- *
- * @param selectedSubSystem the currently selected subsystem
- * @param shell The Shell of the view where this action was launched from
- * @return array of IAction objects to contribute to the popup menu
- */
- public IAction[] getSubSystemActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISubSystem selectedSubSystem)
- {
- Vector childActions = new Vector();
- if (config.supportsFilters())
- {
- boolean showFilterPools = config.showFilterPools();
- // if showing filter pools, we have to add a "new filter pool" action here...
- if (showFilterPools)
- {
- IAction[] newFPActions = getSubSystemNewFilterPoolActions(menu, selection, shell, menuGroup, config, selectedSubSystem);
- if (newFPActions != null)
- {
- for (int idx = 0; idx < newFPActions.length; idx++)
- {
- // special case handling...
- // set input subsystem for new filter pool actions...
- if (newFPActions[idx] instanceof SystemFilterAbstractFilterPoolAction)
- {
- SystemFilterAbstractFilterPoolAction fpAction = (SystemFilterAbstractFilterPoolAction) newFPActions[idx];
- fpAction.setFilterPoolManagerNamePreSelection(selectedSubSystem.getSystemProfile().getName());
- fpAction.setFilterPoolManagerProvider(config);
- }
- childActions.addElement(newFPActions[idx]);
- } // end for loop
- } // end if newFPActions != null
- } // and if showFilterPools
- // if showing filter pools, we have to add a "select filter pool and work-with filter pools" actions here...
- if (showFilterPools)
- {
- childActions.addElement(new SystemFilterSelectFilterPoolsAction(shell));
- childActions.addElement(new SystemFilterWorkWithFilterPoolsAction(shell));
- } // end if showFilterPools
- // if not showing filter pools, we have to add a "new filter" action here...
- if (!showFilterPools)
- {
- ISystemFilterPool defaultPool = null;
- if (selectedSubSystem != null){
- defaultPool = ((SubSystem)selectedSubSystem).getConnectionPrivateFilterPool(true);
- }
-
- IAction[] newFilterActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, config, defaultPool);
- if ((newFilterActions != null) && (newFilterActions.length > 0))
- {
- // pre-scan for legacy
- for (int idx = 0; idx < newFilterActions.length; idx++)
- {
- if (newFilterActions[idx] instanceof SystemNewFilterAction)
- ((SystemNewFilterAction) newFilterActions[idx]).setCallBackConfigurator(this, selectedSubSystem);
- else
- {
- }
- }
- // now add the actions
- for (int idx = 0; idx < newFilterActions.length; idx++)
- childActions.addElement(newFilterActions[idx]);
- } // end if newFilterActions != null
- } // end if !showFilterPools
- } // end if supportsFilters()
-
-// FIXME - UDAs moved out of here
-// // if user defined actions are supported, add an action to work with them...
-// if (config.supportsUserDefinedActions())
-// childActions.addElement(new SystemWorkWithUDAsAction(shell, (ISubSystem)null));
-// // if named file types are supported, add an action to work with them...
-// if (config.supportsFileTypes())
-// childActions.addElement(new SystemWorkWithFileTypesAction(shell, null));
-// // if compile actions are supported, add an action to work with them...
-// if (config.supportsCompileActions())
-// childActions.addElement(new SystemWorkWithCompileCommandsAction(shell, false));
-
-
-
- if (config.supportsSubSystemConnect())
- {
- // MJB: RE defect 40854
- addConnectOrDisconnectAction(childActions, shell, selectedSubSystem);
- }
-
- if (subSystemActions == null)
- {
- // premise: none of these actions' constructor need the current selection as input
- int nbrBaseActions = 0;
- if (config.supportsSubSystemConnect())
- {
- //nbrBaseActions += 2; // 4; MJB: RE defect 50854
- if (selectedSubSystem.getConnectorService().supportsUserId())
- nbrBaseActions += 1;
- }
- //if (supportsFilters())
- // nbrBaseActions += 2;
- subSystemActions = new IAction[nbrBaseActions];
- int ssIdx = 0;
- if (config.supportsSubSystemConnect())
- {
- // MJB: RE defect 40854
- //subSystemActions[ssIdx++] = new SystemConnectAction(shell);
- //subSystemActions[ssIdx++] = new SystemDisconnectAction(shell);
-
- if (selectedSubSystem.getConnectorService().supportsUserId())
- subSystemActions[ssIdx++] = new SystemClearPasswordAction(shell);
- }
- } // end if subsystemActons == null
-
- IAction[] allActions = new IAction[childActions.size() + subSystemActions.length];
- int allIndex = 0;
- for (int idx = 0; idx < childActions.size(); idx++)
- allActions[allIndex++] = (IAction) childActions.elementAt(idx);
- for (int idx = 0; idx < subSystemActions.length; idx++)
- allActions[allIndex++] = subSystemActions[idx];
-
- return allActions;
- }
-
- /**
- * Overridable method to add the connect or disconnect action.
- *
- * @param actions The list of child actions. Add the connect/disconnect action to this vector is applicable.
- * @param shell The shell.
- * @param selectedSS The selected subsystem.
- */
- protected void addConnectOrDisconnectAction(Vector actions, Shell shell, ISubSystem selectedSS)
- {
- boolean connected = selectedSS.isConnected();
- if (connected)
- {
- actions.addElement(new SystemDisconnectAction(shell));
- }
- else
- {
- actions.addElement(new SystemConnectAction(shell));
- }
- }
-
- /**
- * There is a reasonable amount of processing needed to configure filter wizards. To aid
- * in performance and memory usage, we extract that processing into this method, and then
- * use a callback contract with the filter wizard to call us back to do this processing
- * only at the time the action is actually selected to be run.
- * <p>
- * The processing we do here is to specify the filter pools to prompt the user for, in the
- * second page of the New Filter wizards.
- * <p>
- * This method is from the ISystemNewFilterActionConfigurator interface
- */
- public void configureNewFilterAction(ISubSystemConfiguration config, SystemNewFilterAction newFilterAction, Object callerData)
- {
- //System.out.println("Inside configureNewFilterAction! It worked!");
- newFilterAction.setFromRSE(true);
- boolean showFilterPools = config.showFilterPools();
-
- // It does not make sense, when invoked from a filterPool, to ask the user
- // for the parent filter pool, or to ask the user whether the filter is connection
- // specific, as they user has explicitly chosen their pool...
- //if (!showFilterPools || (callerData instanceof SubSystem))
- if (!showFilterPools)
- {
- ISubSystem selectedSubSystem = (ISubSystem) callerData;
- // When not showing filter pools, we need to distinquish between an advanced user and a new user.
- // For a new user we simply want to ask them whether this filter is to be team sharable or private,
- // and based on that, we will place the filter in the default filter pool for the appropriate profile.
- // For an advanced user who has simply turned show filter pools back off, we want to let them choose
- // explicitly which filter pool they want to place the filter in.
- // To approximate the decision, we will define an advanced user as someone who already has a reference
- // to a filter pool other than the default pools in the active profiles.
- boolean advancedUser = false;
- ISystemFilterPoolReferenceManager refMgr = selectedSubSystem.getSystemFilterPoolReferenceManager();
- ISystemFilterPool[] refdPools = refMgr.getReferencedSystemFilterPools();
- if (refdPools.length == 0)
- SystemBasePlugin.logInfo("SubSystemConfigurationImpl::getSubSystemActions - getReferencedSystemFilterPools returned array of length zero."); //$NON-NLS-1$
- // so there already exists references to more than one filter pool, but it might simply be a reference
- // to the default filter pool in the user's profile and another to reference to the default filter pool in
- // the team profile... let's see...
- else if (refdPools.length > 1)
- {
- for (int idx = 0; !advancedUser && (idx < refdPools.length); idx++)
- {
- if (!refdPools[idx].isDefault() && (refdPools[idx].getOwningParentName()==null))
- advancedUser = true;
- }
- }
- if (advancedUser)
- {
- newFilterAction.setAllowFilterPoolSelection(refdPools); // show all pools referenced in this subsystem, and let them choose one
- }
- else
- {
- boolean anyAdded = false;
- ISystemFilterPoolWrapperInformation poolWrapperInfo = getNewFilterWizardPoolWrapperInformation();
- ISystemProfile[] activeProfiles = RSECorePlugin.getTheSystemRegistry().getActiveSystemProfiles();
- ISystemProfile activeProfile = selectedSubSystem.getHost().getSystemProfile();
- for (int idx = 0; idx < activeProfiles.length; idx++)
- {
- //ISystemFilterPool defaultPool = getDefaultSystemFilterPool(config, activeProfiles[idx]);
-
- // bug 238158 - now the default pool will be the connection private one
- ISystemFilterPool defaultPool = null;
- if (selectedSubSystem != null){
- defaultPool = ((SubSystem)selectedSubSystem).getConnectionPrivateFilterPool(true);
- }
- else {
- defaultPool = getDefaultSystemFilterPool(config, activeProfiles[idx]);
- }
-
-
- if (defaultPool != null)
- {
- poolWrapperInfo.addWrapper(activeProfiles[idx].getName(), defaultPool, (activeProfiles[idx] == activeProfile)); // display name, pool to wrap, whether to preselect
- anyAdded = true;
- }
- }
- if (anyAdded)
- newFilterAction.setAllowFilterPoolSelection(poolWrapperInfo);
- }
- }
- }
-
- /**
- * Given a profile, return the first (hopefully only) default pool for this
- * profile.
- */
- public ISystemFilterPool getDefaultSystemFilterPool(ISubSystemConfiguration config, ISystemProfile profile)
- {
- ISystemFilterPool pool = null;
- ISystemFilterPoolManager mgr = config.getFilterPoolManager(profile);
- pool = mgr.getFirstDefaultSystemFilterPool(); // RETURN FIRST
- return pool;
- }
-
- /**
- * Overridable entry for child classes to supply their own flavour of ISystemFilterPoolWrapperInformation for
- * the new filter wizards.
- * @since 3.0 replaced SystemFilterPoolWrapperInformation by ISystemFilterPoolWrapperInformation
- */
- protected ISystemFilterPoolWrapperInformation getNewFilterWizardPoolWrapperInformation()
- {
- return new SystemFilterPoolWrapperInformation(SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_LABEL, SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_TOOLTIP,
- SystemResources.RESID_NEWFILTER_PAGE2_PROFILE_VERBIAGE);
- }
- /**
- * Overridable entry for child classes to supply their own "new" action(s) for creating a
- * filter pool.
- * By default, this creates an action for creating a new filter pool and a new filter pool reference.
- * @param selectedSubSystem the currently selected subsystem
- * @param shell The Shell of the view where this action was launched from
- * @return array of IAction objects to contribute to the popup menu
- */
- protected IAction[] getSubSystemNewFilterPoolActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISubSystem selectedSubSystem)
- {
- IAction[] actions = new IAction[2];
- actions[0] = new SystemFilterNewFilterPoolAction(shell);
- ((ISystemAction) actions[0]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0040"); //$NON-NLS-1$
- ((SystemFilterNewFilterPoolAction) actions[0]).setDialogHelp(RSEUIPlugin.HELPPREFIX + "wnfp0000"); //$NON-NLS-1$
- actions[1] = new SystemFilterCascadingNewFilterPoolReferenceAction(shell, selectedSubSystem.getSystemFilterPoolReferenceManager());
- ((ISystemAction) actions[1]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0041"); //$NON-NLS-1$
- return actions;
- }
-
- /**
- * Supply the image to be used for filter pool managers, within actions.
- * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
- */
- public ImageDescriptor getSystemFilterPoolManagerImage()
- {
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_PROFILE_ID);
- }
- /**
- * Supply the image to be used for filter pools, within actions.
- * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
- */
- public ImageDescriptor getSystemFilterPoolImage(ISystemFilterPool filterPool)
- {
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERPOOL_ID);
- }
- /**
- * Supply the image to be used for filters, within actions.
- * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
- */
- public ImageDescriptor getSystemFilterImage(ISystemFilter filter)
- {
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTER_ID);
- }
-
- /**
- * Supply the image to be used for filter pool references. This implementation
- * just gets the referenced filter pool and calls the method
- * getSystemFilterPoolImage(ISystemFilterPool) on it.
- * Override this method to provide custom images for filter pool references.
- */
- public ImageDescriptor getSystemFilterPoolImage(ISystemFilterPoolReference filterPoolRef)
- {
- return getSystemFilterPoolImage(filterPoolRef.getReferencedFilterPool());
- }
-
- /**
- * Supply the image to be used for filter references. This implementation
- * just gets the referenced filter and calls the method
- * getSystemFilterImage(ISystemFile) on it.
- * Override this method to provide custom images for filter references.
- */
- public ImageDescriptor getSystemFilterImage(ISystemFilterReference filterRef)
- {
- return getSystemFilterImage(filterRef.getReferencedFilter());
- }
-
-
- /*
- * Supply the image to be used for the given filter string, within actions.
- * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
- */
- public ImageDescriptor getSystemFilterStringImage(ISystemFilterString filterString)
- {
- return getSystemFilterStringImage(filterString.getString());
- }
-
- /*
- * Supply the image to be used for the given filter string string, within actions.
- * REQUIRED BY SYSTEMFILTERPOOLMANAGERPROVIDER INTERFACE
- */
- public ImageDescriptor getSystemFilterStringImage(String filterStringString)
- {
- return RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_FILTERSTRING_ID);
- }
-
-
- // ------------------------------------------------
- // HELPER METHODS TO SIMPLY EVENT FIRING...
- // ------------------------------------------------
-
-
-
- // ------------------------------------------------
- // FILTER POOL MANAGER PROVIDER CALLBACK METHODS...
- // ------------------------------------------------
-
- // ---------------------
- // FILTER POOL EVENTS...
- // ---------------------
-
- /**
- * Returns a list of actions for the popup menu when user right clicks on a
- * filter pool object within a subsystem of this subsystem configuration.
- * Only supported and used by subsystems that support filters.
- * <p>
- * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
- * <p>
- * Most actions are handled in this base, except if you have your own action for
- * creating a new filter. In this case, <b>override getNewFilterAction()</b>
- *
- * @param selectedPool the currently selected pool
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- public IAction[] getFilterPoolActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterPool selectedPool)
- {
- Vector childActions = new Vector();
- IAction[] newActions = getNewFilterPoolFilterActions(menu, selection, shell, menuGroup, config, selectedPool);
- if (newActions != null)
- {
- for (int idx = 0; idx < newActions.length; idx++)
- {
- childActions.addElement(newActions[idx]);
- //if (newActions[idx] instanceof SystemNewFilterAction)
- // ((SystemNewFilterAction) newActions[idx]).setCallBackConfigurator(this, null);
- }
- }
- if (filterPoolActions == null)
- {
- int nbr = 2;
- filterPoolActions = new IAction[nbr];
- SystemFilterCopyFilterPoolAction copyAction = new SystemFilterCopyFilterPoolAction(shell);
- copyAction.setPromptString(SystemResources.RESID_COPY_TARGET_PROFILE_PROMPT);
- copyAction.setHelp(RSEUIPlugin.HELPPREFIX + "actn0060"); //$NON-NLS-1$
- copyAction.setDialogHelp(RSEUIPlugin.HELPPREFIX + "dcfp0000"); //$NON-NLS-1$
- SystemFilterMoveFilterPoolAction moveAction = new SystemFilterMoveFilterPoolAction(shell);
- moveAction.setPromptString(SystemResources.RESID_MOVE_TARGET_PROFILE_PROMPT);
- moveAction.setHelp(RSEUIPlugin.HELPPREFIX + "actn0061"); //$NON-NLS-1$
- moveAction.setDialogHelp(RSEUIPlugin.HELPPREFIX + "dmfp0000"); //$NON-NLS-1$
- filterPoolActions[0] = copyAction;
- filterPoolActions[1] = moveAction;
- }
- for (int idx = 0; idx < filterPoolActions.length; idx++)
- {
- childActions.addElement(filterPoolActions[idx]);
- }
-
- IAction[] allFilterPoolActions = new IAction[childActions.size()];
- for (int idx = 0; idx < childActions.size(); idx++)
- allFilterPoolActions[idx] = (IAction) childActions.elementAt(idx);
-
- return allFilterPoolActions;
- }
-
- /**
- * Overridable method to return the actions for creating a new filter in a filter pool.
- * By default returns one action created by calling {@link #getNewFilterPoolFilterAction(ISubSystemConfiguration, ISystemFilterPool, Shell)}.
- * <p>
- * If you have multiple actions for creating new filters, override this.
- * <p>
- * If you have only a single action for creating new filters, override getNewFilterPoolFilterAction (without the 's').
- * <p>
- * @param selectedPool the currently selected pool
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- protected IAction[] getNewFilterPoolFilterActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterPool selectedPool)
- {
- IAction[] actions = new IAction[1];
- actions[0] = getNewFilterPoolFilterAction(config, selectedPool, shell);
- return actions;
- }
- /**
- * Overridable method to return the single action for creating a new filter in a filter pool.
- * By default returns a default supplied action for this.
- * <p>
- * If you have multiple actions for creating new filters, override getNewFilterPoolFilterActions (note the 's').
- * <p>
- * If you have only a single action for creating new filters, override this.
- * <p>
- * @param selectedPool the currently selected pool
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- protected IAction getNewFilterPoolFilterAction(ISubSystemConfiguration config, ISystemFilterPool selectedPool, Shell shell)
- {
- SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool);
- action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0042"); //$NON-NLS-1$
- action.setDialogHelp(RSEUIPlugin.HELPPREFIX + "wnfr0000"); //$NON-NLS-1$
- return action;
- }
- /**
- * Overridable method to return the action for creating a new nested filter inside another filter.
- * By default returns getNewFilterPoolFilterAction(selectedFilter.getParentFilterPool(),shell).
- * @param selectedFilter the currently selected filter
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- protected IAction getNewNestedFilterAction(ISubSystemConfiguration config, ISystemFilter selectedFilter, Shell shell)
- {
- return getNewFilterPoolFilterAction(config, selectedFilter.getParentFilterPool(), shell);
- }
- /**
- * Overridable method to return the action for changing an existing filter.
- * By default returns new SystemChangeFilterAction, unless the filter's isSingleFilterStringOnly()
- * returns true, in which case null is returned.
- *
- * @param selectedFilter the currently selected filter
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- protected IAction getChangeFilterAction(ISubSystemConfiguration config, ISystemFilter selectedFilter, Shell shell)
- {
- /* We don't do this here now as this is overridable. Now done in SystemChangeFilterAction.
- * Also, single filter string doesn't mean non-editable.
- *
- if (selectedFilter.isSingleFilterStringOnly())
- {
- //System.out.println("filter " + selectedFilter + " is single filter string only");
- return null;
- }*/
- SystemChangeFilterAction action = new SystemChangeFilterAction(shell);
- action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0081"); //$NON-NLS-1$
- action.setDialogHelp(RSEUIPlugin.HELPPREFIX + "dufr0000"); //$NON-NLS-1$
- return action;
- }
- /**
- * In addition to a change filter action, we now also support the same functionality
- * via a Properties page for filters. When this page is activated, this method is called
- * to enable customization of the page, given the selected filter.
- * <p>
- * By default, this method will call {@link #getChangeFilterAction(ISubSystemConfiguration, ISystemFilter, Shell)} to get
- * your change filter action, and will configure the given page from the dialog created by your
- * change filter action.
- * <p>
- * If your filter uses its own Change Filter dialog, versus subclassing or configuring
- * {@link org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog} you will have to override this method
- * and specify the following information for the supplied page (via its setters):
- * <ul>
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDuplicateFilterStringErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setFilterStringEditPane(org.eclipse.rse.ui.filters.SystemFilterStringEditPane)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setFilterStringValidator(org.eclipse.rse.ui.validators.ISystemValidator)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setListLabel(String, String)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setParentPoolPromptLabel(String, String)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setNamePromptLabel(String, String)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setNewListItemText(String)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDuplicateFilterStringErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setEditable(boolean)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setSupportsMultipleStrings(boolean)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemChangeFilterPropertyPage#setDescription(String)}
- * </ul>
- */
- public void customizeChangeFilterPropertyPage(ISubSystemConfiguration config, SystemChangeFilterPropertyPage page, ISystemFilter selectedFilter, Shell shell)
- {
- // default behaviour is a total hack! We want to preserve all the configuration done on the
- // Change dialog, so we instantiate it merely so that we can copy the configuration information...
- IAction changeAction = getChangeFilterAction(config, selectedFilter, shell);
- if (changeAction instanceof SystemChangeFilterAction)
- {
- SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction;
- changeFilterAction.setSelection(new StructuredSelection(selectedFilter));
- org.eclipse.jface.dialogs.Dialog dlg = changeFilterAction.createDialog(shell);
- if (dlg instanceof SystemChangeFilterDialog)
- {
- SystemChangeFilterDialog changeFilterDlg = (SystemChangeFilterDialog)dlg;
- //changeFilterAction.callConfigureFilterDialog(changeFilterDlg); createDialog calls this already!
- page.setDuplicateFilterStringErrorMessage(changeFilterDlg.getDuplicateFilterStringErrorMessage());
- page.setFilterStringEditPane(changeFilterDlg.getFilterStringEditPane(shell));
- page.setFilterStringValidator(changeFilterDlg.getFilterStringValidator());
- page.setListLabel(changeFilterDlg.getListLabel(), changeFilterDlg.getListTip());
- page.setParentPoolPromptLabel(changeFilterDlg.getParentPoolPromptLabel(), changeFilterDlg.getParentPoolPromptTip());
- page.setNamePromptLabel(changeFilterDlg.getNamePromptLabel(), changeFilterDlg.getNamePromptTip());
- page.setNewListItemText(changeFilterDlg.getNewListItemText());
-
- page.setDescription(changeFilterDlg.getTitle());
- }
- }
- if (selectedFilter.isNonChangable())
- page.setEditable(false);
- //System.out.println("Selected filter: "+selectedFilter.getName()+", isSingleFilterStringOnly: "+selectedFilter.isSetSingleFilterStringOnly());
- boolean singleFilterString = selectedFilter.isSingleFilterStringOnly() || (selectedFilter.isNonChangable() && (selectedFilter.getFilterStringCount() == 1));
- if (singleFilterString)
- page.setSupportsMultipleStrings(false);
- }
-
- /**
- * In addition to a change filter action, we now also support the same functionality
- * via a Properties page for filter strings, in the Team View. When this page is activated,
- * this method is called to enable customization of the page, given the selected filter string.
- *
- * <p>
- * By default, this method will call {@link #getChangeFilterAction(ISubSystemConfiguration, ISystemFilter, Shell)} to get
- * your change filter action, and will configure the given page from the dialog created by your
- * change filter action.
- * <p>
- * If your filter uses its own Change Filter dialog, versus subclassing or configuring
- * {@link org.eclipse.rse.ui.filters.dialogs.SystemChangeFilterDialog} you will have to
- * override this method and specify the following information for the supplied page (via its setters):
- * <ul>
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDuplicateFilterStringErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setFilterStringEditPane(org.eclipse.rse.ui.filters.SystemFilterStringEditPane)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setFilterStringValidator(org.eclipse.rse.ui.validators.ISystemValidator)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDuplicateFilterStringErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setEditable(boolean)}
- * <li>{@link org.eclipse.rse.ui.propertypages.SystemFilterStringPropertyPage#setDescription(String)}
- * </ul>
- */
- public void customizeFilterStringPropertyPage(ISubSystemConfiguration config, SystemFilterStringPropertyPage page, ISystemFilterString selectedFilterString, Shell shell)
- {
- // default behaviour is a total hack! We want to preserve all the configuration done on the
- // Change dialog, so we instantiate it merely so that we can copy the configuration information...
- ISystemFilter selectedFilter = selectedFilterString.getParentSystemFilter();
- IAction changeAction = getChangeFilterAction(config, selectedFilter, shell);
- if (changeAction instanceof SystemChangeFilterAction)
- {
- SystemChangeFilterAction changeFilterAction = (SystemChangeFilterAction)changeAction;
- changeFilterAction.setSelection(new StructuredSelection(selectedFilter));
- org.eclipse.jface.dialogs.Dialog dlg = changeFilterAction.createDialog(shell);
- if (dlg instanceof SystemChangeFilterDialog)
- {
- SystemChangeFilterDialog changeFilterDlg = (SystemChangeFilterDialog)dlg;
- //changeFilterAction.callConfigureFilterDialog(changeFilterDlg); createDialog calls this!
- page.setDuplicateFilterStringErrorMessage(changeFilterDlg.getDuplicateFilterStringErrorMessage());
- page.setFilterStringEditPane(changeFilterDlg.getFilterStringEditPane(shell));
- page.setFilterStringValidator(changeFilterDlg.getFilterStringValidator());
- page.setDescription(changeFilterDlg.getTitle());
- }
- }
- if (selectedFilter.isNonChangable())
- page.setEditable(false);
- }
-
- // ---------------------------------
- // FILTER POOL REFERENCE METHODS...
- // ---------------------------------
-
-
- /**
- * Returns a list of actions for the popup menu when user right clicks on a
- * filter pool reference object within a subsystem of this subsystem configuration. Note,
- * these are added to the list returned by getFilterPoolActions().
- * Only supported by subsystems that support filters.
- * @param selectedPoolReference the currently selected pool reference
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- public IAction[] getFilterPoolReferenceActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterPoolReference selectedPoolReference)
- {
- ISystemFilterPool selectedPool = selectedPoolReference.getReferencedFilterPool();
- if (filterPoolReferenceActions == null)
- {
- filterPoolReferenceActions = new IAction[3];
- filterPoolReferenceActions[0] = getRemoveFilterPoolReferenceAction(config, selectedPool, shell);
- filterPoolReferenceActions[1] = new SystemFilterMoveUpFilterPoolReferenceAction(shell);
- ((ISystemAction) filterPoolReferenceActions[1]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0063"); //$NON-NLS-1$
- filterPoolReferenceActions[2] = new SystemFilterMoveDownFilterPoolReferenceAction(shell);
- ((ISystemAction) filterPoolReferenceActions[2]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0064"); //$NON-NLS-1$
- }
-
- return filterPoolReferenceActions;
- }
-
- /**
- * Overridable method to return the action for removing a filter pool reference.
- * By default returns new SystemRemoveFilterPoolReferenceAction.
- * @param selectedPool the currently selected pool
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- protected IAction getRemoveFilterPoolReferenceAction(ISubSystemConfiguration config, ISystemFilterPool selectedPool, Shell shell)
- {
- ISystemAction action = new SystemFilterRemoveFilterPoolReferenceAction(shell);
- action.setHelp(RSEUIPlugin.HELPPREFIX + "actn0062"); //$NON-NLS-1$
- return action;
- }
-
- // ---------------------------------
- // FILTER METHODS
- // ---------------------------------
-
-
-
- /**
- * Prompt the user to create a new filter as a result of the user expanding a promptable
- * filter.
- * <p>
- * This base implementation prompts using the generic filter prompt. You should override this but
- * copy this code to use as a base/example how to do this.
- *
- * @return the filter created by the user or null if they cancelled the prompting
- */
- public ISystemFilter createFilterByPrompting(ISubSystemConfiguration config, ISystemFilterReference referenceToPromptableFilter, Shell shell) throws Exception
- {
- ISystemFilter filterPrompt = referenceToPromptableFilter.getReferencedFilter();
- ISystemFilterPool selectedPool = filterPrompt.getParentFilterPool();
-
- SystemNewFilterAction action = new SystemNewFilterAction(shell, selectedPool);
- Object simulatedSelectedParent = null;
- if (!config.showFilterPools()) // if we are not showing filter pools, the parent will be the subsystem itself
- {
- simulatedSelectedParent = referenceToPromptableFilter.getProvider(); // this is the subsystem
- action.setCallBackConfigurator(this, simulatedSelectedParent);
- }
- else // if we are showing filter pools, the parent will be the selected filter pool reference
- {
- simulatedSelectedParent = referenceToPromptableFilter.getParentSystemFilterReferencePool();
- action.setCallBackConfigurator(this, referenceToPromptableFilter.getProvider());
- }
- action.setSelection(new StructuredSelection(simulatedSelectedParent)); // pretend parent node was selected
-
- action.run();
- ISystemFilter newFilter = action.getNewFilter();
- return newFilter;
- }
-
- /**
- * Returns a list of actions for the popup menu when user right clicks on a
- * filter object.
- * <p>
- * Only supported and used by subsystems that support filters.
- * <p>
- * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
- * <p>
- * Most actions are handled in this base, except if you have your own action for
- * creating a new nested filter. In this case, <b>override getNewFilterAction()</b>
- */
- public IAction[] getFilterActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilter selectedFilter)
- {
- Vector childActions = new Vector();
- Vector ourChildActions = getAdditionalFilterActions(config, selectedFilter, shell);
- int pasteIndex = -1;
- if (ourChildActions != null)
- for (int idx = 0; idx < ourChildActions.size(); idx++)
- {
- // we want to make sure the order is kept consistent at
- // Copy, Paste, Move, Delete Rename
- if (ourChildActions.elementAt(idx) instanceof SystemPasteFromClipboardAction) pasteIndex = idx;
- else childActions.addElement(ourChildActions.elementAt(idx));
- }
-
- // Add our static default-supplied actions
- if (filterActions == null)
- {
- int additionalActions = 4;
- if (pasteIndex > -1) additionalActions++;
- int fsIdx = 0;
- filterActions = new IAction[additionalActions];
- SystemFilterCopyFilterAction copyAction = new SystemFilterCopyFilterAction(shell);
- copyAction.setPromptString(SystemResources.RESID_COPY_TARGET_FILTERPOOL_PROMPT);
- copyAction.setHelp(RSEUIPlugin.HELPPREFIX + "actn0082"); //$NON-NLS-1$
- copyAction.setDialogHelp(RSEUIPlugin.HELPPREFIX + "dcfr0000"); //$NON-NLS-1$
- filterActions[fsIdx++] = copyAction;
-
- // we want to make sure the order is kept consistent at
- // Copy, Paste, Move, Delete Rename
- if (pasteIndex > -1 && ourChildActions != null)
- {
- filterActions[fsIdx++] = (IAction) ourChildActions.elementAt(pasteIndex);
- }
-
- SystemFilterMoveFilterAction moveAction = new SystemFilterMoveFilterAction(shell);
- moveAction.setPromptString(SystemResources.RESID_MOVE_TARGET_FILTERPOOL_PROMPT);
- moveAction.setHelp(RSEUIPlugin.HELPPREFIX + "actn0083"); //$NON-NLS-1$
- moveAction.setDialogHelp(RSEUIPlugin.HELPPREFIX + "dmfr0000"); //$NON-NLS-1$
- filterActions[fsIdx++] = moveAction;
-
- filterActions[fsIdx] = new SystemFilterMoveUpFilterAction(shell);
- ((SystemFilterMoveUpFilterAction) filterActions[fsIdx++]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0084"); //$NON-NLS-1$
- filterActions[fsIdx] = new SystemFilterMoveDownFilterAction(shell);
- ((SystemFilterMoveDownFilterAction) filterActions[fsIdx++]).setHelp(RSEUIPlugin.HELPPREFIX + "actn0085"); //$NON-NLS-1$
- }
- // add overridable dynamic actions
- if (config.supportsNestedFilters())
- {
- IAction newNestedFilterAction = getNewNestedFilterAction(config, selectedFilter, shell);
- if (newNestedFilterAction != null)
- childActions.addElement(newNestedFilterAction);
- }
-
- // IAction chgFilterAction = getChangeFilterAction(config, selectedFilter, shell);
- // if (chgFilterAction != null)
- // childActions.addElement(chgFilterAction);
- /*
- if (showFilterStrings())
- {
- IAction[] newStringActions = getNewFilterStringActions(selectedFilter, shell);
- if (newStringActions != null)
- for (int idx=0; idx<newStringActions.length; idx++)
- childActions.addElement(newStringActions[idx]);
- }
- */
- IAction[] allFilterActions = new IAction[childActions.size() + filterActions.length];
- int allIdx = 0;
-
- for (int idx = 0; idx < childActions.size(); idx++)
- allFilterActions[allIdx++] = (IAction) childActions.elementAt(idx);
- for (int idx = 0; idx < filterActions.length; idx++)
- allFilterActions[allIdx++] = filterActions[idx];
-
- return allFilterActions;
- }
-
-
- /**
- * Overridable entry for child classes to contribute filter actions beyond the
- * default supplied actions.
- * <p>
- * By default, this returns null.
- * @return Vector of IAction objects.
- * @see #getFilterActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystemConfiguration, ISystemFilter)
- */
- protected Vector getAdditionalFilterActions(ISubSystemConfiguration config, ISystemFilter selectedFilter, Shell shell)
- {
- return null;
- }
-
- // ---------------------------------
- // FILTER REFERENCE METHODS
- // ---------------------------------
-
- /**
- * Returns a list of actions for the popup menu when user right clicks on a
- * filter reference object within a subsystem of this subsystem configuration.
- * Only supported and used by subsystems that support filters.
- * <p>
- * YOU DO NOT NEED TO OVERRIDE THIS METHOD.
- * <p>
- * Most actions are handled in this base, except if you have your own action for
- * creating a new filter. In this case, <b>override getNewFilterAction()</b>
- *
- * @param selectedFilterRef the currently selected filter reference
- * @param shell parent shell of viewer where the popup menu is being constructed
- */
- public IAction[] getFilterReferenceActions(SystemMenuManager menu, IStructuredSelection selection, Shell shell, String menuGroup, ISubSystemConfiguration config, ISystemFilterReference selectedFilterRef)
- {
- return null;
- }
-
- // -------------------------
- // SERVER LAUNCH SUPPORT ...
- // -------------------------
-
- /**
- * Return the form used in the property page, etc for this server launcher.
- * Only called if {@link ISubSystemConfiguration#supportsServerLaunchProperties(org.eclipse.rse.core.model.IHost)} returns true.
- * <p>
- * Override if appropriate.
- * @return the UI form for the server launcher.
- */
- public IServerLauncherForm getServerLauncherForm(ISubSystemConfiguration config, Shell shell, ISystemMessageLine msgLine)
- {
- return new RemoteServerLauncherForm(shell, msgLine);
- }
-
- /**
- * Return the validator for the password which is prompted for at runtime.
- * Returns null by default.
- */
- public ISystemValidator getPasswordValidator(ISubSystemConfiguration configuration)
- {
- return null;
- }
- /**
- * Return the validator for the port.
- * A default is supplied.
- * This must be castable to ICellEditorValidator for the property sheet support.
- */
- public ISystemValidator getPortValidator(ISubSystemConfiguration configuration)
- {
- ISystemValidator portValidator = new ValidatorPortInput();
- return portValidator;
- }
-
-
-
- public PropertyPage getPropertyPage(ISubSystem subsystem, Composite parent) {
- return ((SubSystem)subsystem).getPropertyPage(parent);
- }
-
-
- public ISystemValidator getUserIdValidator(ISubSystemConfiguration config) {
- ISystemValidator userIdValidator =
- new ValidatorSpecialChar(
- "=;", //$NON-NLS-1$
- false,
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_NOTVALID),
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY));
- // false => allow empty? No.
- return userIdValidator;
- }
-
- /**
- * The default implementation does not filter and simply returns the children passed in.
- * Subclasses should override if they want to filter objects.
- * @param parent the parent context.
- * @param children the children to filter.
- * @return the children after filtering.
- */
- public Object[] applyViewFilters(IContextObject parent, Object[] children) {
- return children;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java
deleted file mode 100644
index 30a3475d5..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAbstractAPIProvider.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * Martin Oberhuber (Wind River) - [218524][api] Remove deprecated ISystemViewInputProvider#getShell()
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemMessageObject;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-import org.eclipse.rse.core.model.SystemMessageObject;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-
-
-/**
- * This is a base class that a provider of root nodes to the remote systems tree
- * viewer part can use as a parent class.
- *
- * This class existed in RSE 1.0, was made "internal" for RSE 2.0 and restored
- * as API for RSE 3.0.
- *
- * @since 3.0
- */
-public abstract class SystemAbstractAPIProvider
- implements ISystemViewInputProvider
-{
- protected Viewer viewer;
- /**
- * @deprecated don't use this field
- */
- protected ISystemRegistry sr;
-
- /**
- * @deprecated don't use this field
- */
- protected Object[] emptyList = new Object[0];
- /**
- * @deprecated don't use this field
- */
- protected Object[] msgList = new Object[1];
- /**
- * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
- */
- protected SystemMessageObject nullObject = null;
- /**
- * This field was renamed from canceledObject in RSE 3.0.
- *
- * @since org.eclipse.rse.ui 3.0
- * @deprecated don't use this field
- */
- protected SystemMessageObject cancelledObject = null;
- /**
- * @deprecated don't use this field
- */
- protected SystemMessageObject errorObject = null;
-
- private Preferences fPrefStore = null;
-
- /**
- * Constructor
- */
- public SystemAbstractAPIProvider()
- {
- super();
- sr = RSECorePlugin.getTheSystemRegistry();
- }
-
- /**
- * This is the method required by the IAdaptable interface.
- * Given an adapter class type, return an object castable to the type, or
- * null if this is not possible.
- */
- public Object getAdapter(Class adapterType)
- {
- return Platform.getAdapterManager().getAdapter(this, adapterType);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#setViewer(java.lang.Object)
- */
- public void setViewer(Object viewer)
- {
- this.viewer = (Viewer)viewer;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.rse.ui.view.ISystemViewInputProvider#getViewer()
- */
- public Object getViewer()
- {
- return viewer;
- }
-
- protected final void initMsgObjects()
- {
- nullObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),ISystemMessageObject.MSGTYPE_EMPTY, null);
- cancelledObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_LIST_CANCELLED),ISystemMessageObject.MSGTYPE_CANCEL, null);
- errorObject = new SystemMessageObject(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_FAILED),ISystemMessageObject.MSGTYPE_ERROR, null);
- }
-
- /**
- * In getChildren, return <samp>checkForEmptyList(children, parent,
- * true/false)</samp> versus your array directly. This method checks for a
- * null array which is not allowed and replaces it with an empty array. If
- * true is passed then it returns the "Empty list" message object if the
- * array is null or empty.
- * <p>
- * <i>Callable by subclasses. Do not override.</i> <br>
- *
- * @param children The list of children.
- * @param parent The parent for the children.
- * @param returnNullMsg <code>true</code> if an "Empty List" message should
- * be returned.
- * @return The list of children, a list with the "Empty List" message object
- * or an empty list.
- * @nooverride This method is not intended to be re-implemented or extended
- * by clients.
- */
- protected Object[] checkForEmptyList(Object[] children, Object parent, boolean returnNullMsg) {
- if ((children == null) || (children.length == 0)) {
- if (fPrefStore == null) {
- fPrefStore = RSEUIPlugin.getDefault().getPluginPreferences();
- }
- if (!returnNullMsg
- || (fPrefStore != null && !fPrefStore
- .getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS))) {
- return emptyList;
- } else {
- return new Object[] {
- new SystemMessageObject(
- RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXPAND_EMPTY),
- ISystemMessageObject.MSGTYPE_EMPTY,
- parent)};
- }
- }
- return children;
- }
-
- /**
- * In getChildren, return checkForNull(children, true/false) vs your array directly.
- * This method checks for a null array which not allow and replaces it with an empty array.
- * If true is passed then it returns the "Empty list" message object if the array is null or empty
- *
- * @deprecated Use {@link #checkForEmptyList(Object[], Object, boolean)} instead.
- */
- protected Object[] checkForNull(Object[] children, boolean returnNullMsg)
- {
- if ((children == null) || (children.length==0))
- {
- if (!returnNullMsg)
- return emptyList;
- else
- {
- if (nullObject == null)
- initMsgObjects();
- msgList[0] = nullObject;
- return msgList;
- }
- }
- else
- return children;
- }
-
- /**
- * Return the "Operation cancelled by user" msg as an object array so can be used to answer getChildren()
- */
- protected Object[] getCancelledMessageObject()
- {
- if (cancelledObject == null)
- initMsgObjects();
- msgList[0] = cancelledObject;
- return msgList;
- }
-
- /**
- * Return the "Operation failed" msg as an object array so can be used to answer getChildren()
- */
- protected Object[] getFailedMessageObject()
- {
- if (errorObject == null)
- initMsgObjects();
- msgList[0] = errorObject;
- return msgList;
- }
-
- /**
- * Return true if we are listing connections or not, so we know whether we are interested in
- * connection-add events
- */
- public boolean showingConnections()
- {
- return false;
- }
-
- // ------------------
- // HELPER METHODS...
- // ------------------
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- protected ISystemViewElementAdapter getViewAdapter(Object o)
- {
- return SystemAdapterHelpers.getViewAdapter(o);
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- return SystemAdapterHelpers.getRemoteAdapter(o);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAdapterHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAdapterHelpers.java
deleted file mode 100644
index 9d321f7a7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemAdapterHelpers.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - [174418] SystemAdapterHelpers.getViewAdapter(Object) try to find adapter twice
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.model.ISystemViewInputProvider;
-
-
-/**
- * This class has static helper methods that will get an adapter given an object.
- */
-public class SystemAdapterHelpers {
-
- /**
- * Returns the implementation of ISystemViewElement for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
- public static ISystemViewElementAdapter getViewAdapter(Object o) {
- ISystemViewElementAdapter adapter = null;
-
- // In case the object itself is an adaptable, call the objects getAdapter() method
- if (o instanceof IAdaptable) {
- adapter = (ISystemViewElementAdapter)((IAdaptable)o).getAdapter(ISystemViewElementAdapter.class);
- } else if (o != null) {
- // object is not an adaptable itself, call the adapter manager
- adapter = (ISystemViewElementAdapter)Platform.getAdapterManager().getAdapter(o, ISystemViewElementAdapter.class);
- }
-
- return adapter;
- }
-
- /**
- * Overload to use when calling from a viewer. This not only finds and returns
- * the adapter, but also sets its viewer to the given viewer. Many actions rely
- * on this being set.
- */
- public static ISystemViewElementAdapter getViewAdapter(Object o, Viewer viewer) {
- ISystemViewElementAdapter adapter = getViewAdapter(o);
- if (adapter != null) {
- //FIXME This is not thread-safe.
- adapter.setViewer(viewer);
- }
- return adapter;
- }
-
- /**
- * Overload to use when calling from a viewer. This not only finds and returns
- * the adapter, but also sets its viewer and input provider to the given viewer.
- * Many actions rely on this being set.
- */
- public static ISystemViewElementAdapter getViewAdapter(Object o, Viewer viewer, ISystemViewInputProvider inputProvider) {
- ISystemViewElementAdapter adapter = getViewAdapter(o, viewer);
-
- if (adapter != null) {
- //FIXME This is not thread-safe.
- adapter.setInput(inputProvider);
- }
-
- return adapter;
- }
-
- /**
- * Returns the implementation of ISystemRemoteElementAdapter for the given
- * remote object. Returns null if this object does not adaptable to this.
- */
- public static ISystemRemoteElementAdapter getRemoteAdapter(Object o) {
- ISystemRemoteElementAdapter adapter = null;
-
- // In case the object itself is an adaptable, call the objects getAdapter() method
- if (o instanceof IAdaptable) {
- adapter = (ISystemRemoteElementAdapter)((IAdaptable)o).getAdapter(ISystemRemoteElementAdapter.class);
- } else if (o != null) {
- // object is not an adaptable itself, call the adapter manager
- adapter = (ISystemRemoteElementAdapter)Platform.getAdapterManager().getAdapter(o, ISystemRemoteElementAdapter.class);
- }
-
- return adapter;
- }
-
- /**
- * Overload to use when calling from a viewer. This not only finds and returns
- * the adapter, but also sets its viewer to the given viewer. Many actions rely
- * on this being set.
- */
- public static ISystemRemoteElementAdapter getRemoteAdapter(Object o, Viewer viewer) {
- ISystemRemoteElementAdapter adapter = getRemoteAdapter(o);
- if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
- ((ISystemViewElementAdapter)adapter).setViewer(viewer);
- return adapter;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java
deleted file mode 100644
index 59c91d1a7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemLongRunningRequestEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-import org.eclipse.swt.widgets.Event;
-
-/**
- * An event object as passed for ISystemLongRunningRequestListener methods.
- */
-public class SystemLongRunningRequestEvent extends Event
-{
-
- /**
- * Constructor for SystemLongRunningRequestEvent
- */
- public SystemLongRunningRequestEvent()
- {
- super();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java
deleted file mode 100644
index 53b29a961..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java
+++ /dev/null
@@ -1,2089 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Kevin Doyle (IBM) - [187736] Marked _objectInput stale when new resource created
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Xuan Chen (IBM) - [187016] [menus] Remote Systems Details View should have Refresh on context menu
- * David McKnight (IBM) - [193329] using "Resource" instead of "Name" in the label column
- * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread
- * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
- * Martin Oberhuber (Wind River) - [227516] [regression] Fix ArrayIndexOutOfBoundsException in TableView
- * David McKnight (IBM) - [187058] Incorrect Right Click Menu in Remote System Details View with no selection
- ********************************************************************************/
-
-package org.eclipse.rse.ui.view;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.window.SameShellProvider;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvent;
-import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
-import org.eclipse.rse.core.events.ISystemRemoteChangeListener;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.IRemoteObjectIdentifier;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.actions.SystemCommonDeleteAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonRenameAction;
-import org.eclipse.rse.internal.ui.actions.SystemCommonSelectAllAction;
-import org.eclipse.rse.internal.ui.actions.SystemImportConnectionAction;
-import org.eclipse.rse.internal.ui.actions.SystemOpenExplorerPerspectiveAction;
-import org.eclipse.rse.internal.ui.actions.SystemShowInTableAction;
-import org.eclipse.rse.internal.ui.actions.SystemSubMenuManager;
-import org.eclipse.rse.internal.ui.view.SystemDecoratingLabelProvider;
-import org.eclipse.rse.internal.ui.view.SystemInheritableTextCellEditor;
-import org.eclipse.rse.internal.ui.view.SystemTableViewColumnManager;
-import org.eclipse.rse.internal.ui.view.SystemTableViewFilter;
-import org.eclipse.rse.internal.ui.view.SystemTableViewSorter;
-import org.eclipse.rse.internal.ui.view.SystemView;
-import org.eclipse.rse.internal.ui.view.SystemViewDataDragAdapter;
-import org.eclipse.rse.internal.ui.view.SystemViewDataDropAdapter;
-import org.eclipse.rse.internal.ui.view.SystemViewMenuListener;
-import org.eclipse.rse.services.clientserver.StringCompare;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemContextMenuConstants;
-import org.eclipse.rse.ui.ISystemDeleteTarget;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.ISystemRenameTarget;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
-import org.eclipse.rse.ui.actions.ISystemAction;
-import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
-import org.eclipse.rse.ui.actions.SystemRefreshAction;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-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.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.part.EditorInputTransfer;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-
-/**
- * This subclass of the standard JFace table viewer is used to
- * show a generic table view of the selected object in the Systems view
- * <p>
- */
-public class SystemTableView
- extends TableViewer
- implements IMenuListener,
- ISystemDeleteTarget, ISystemRenameTarget, ISystemSelectAllTarget,
- ISystemResourceChangeListener, ISystemRemoteChangeListener,
- ISystemShellProvider, ISelectionChangedListener, ISelectionProvider
-{
-
-
- // inner class to support cell editing
- private ICellModifier cellModifier = new ICellModifier()
- {
- public Object getValue(Object element, String property)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- adapter.setPropertySourceInput(element);
- Object value = adapter.getPropertyValue(property);
- if (value == null)
- {
- value = ""; //$NON-NLS-1$
- }
- return value;
- }
-
- public boolean canModify(Object element, String property)
- {
- boolean modifiable = true;
- return modifiable;
- }
-
- public void modify(Object element, String property, Object value)
- {
- if (element instanceof TableItem && value != null)
- {
- Object obj = ((TableItem) element).getData();
- ISystemViewElementAdapter adapter = getViewAdapter(obj);
- if (adapter != null)
- {
- adapter.setPropertyValue(property, value);
-
- SelectionChangedEvent event = new SelectionChangedEvent(SystemTableView.this, getSelection());
-
- // fire the event
- fireSelectionChanged(event);
- }
- }
- }
- };
-
- private class HeaderSelectionListener extends SelectionAdapter
- {
-
- public HeaderSelectionListener()
- {
- _upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEUP_ID);
- _downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_MOVEDOWN_ID);
- }
-
-
- /**
- * Handles the case of user selecting the
- * header area.
- * <p>If the column has not been selected previously,
- * it will set the sorter of that column to be
- * the current table view sorter. Repeated
- * presses on the same column header will
- * toggle sorting order (ascending/descending).
- */
- public void widgetSelected(SelectionEvent e)
- {
- Table table = getTable();
- if (!table.isDisposed())
- {
- // column selected - need to sort
- TableColumn tcolumn = (TableColumn)e.widget;
- int column = table.indexOf(tcolumn);
- SystemTableViewSorter oldSorter = (SystemTableViewSorter) getSorter();
- if (oldSorter != null && column == oldSorter.getColumnNumber())
- {
- oldSorter.setReversed(!oldSorter.isReversed());
- if (tcolumn.getImage() == _upI)
- {
- tcolumn.setImage(_downI);
- }
- else
- {
- tcolumn.setImage(_upI);
- }
- }
- else
- {
- setSorter(new SystemTableViewSorter(column, SystemTableView.this, _columnManager));
- tcolumn.setImage(_downI);
- }
-
- // unset image of other columns
- TableColumn[] allColumns = table.getColumns();
- for (int i = 0; i < allColumns.length; i++)
- {
- if (i != column)
- {
- if (allColumns[i].getImage() != null)
- {
- allColumns[i].setImage(null);
- }
- }
- }
- refresh();
- }
- }
- }
-
- private Object _objectInput;
- private TableLayout _layout;
- protected SystemTableViewProvider _provider;
- private HeaderSelectionListener _columnSelectionListener;
- private MenuManager _menuManager;
- private SystemTableViewFilter _filter;
- private IPropertyDescriptor[] _uniqueDescriptors;
- private SystemTableViewColumnManager _columnManager;
-
- // these variables were copied from SystemView to allow for limited support
- // of actions. I say limited because somethings don't yet work properly.
- private SystemNewConnectionAction _newConnectionAction;
- private SystemImportConnectionAction _importConnectionAction;
- protected SystemRefreshAction _refreshAction;
- protected PropertyDialogAction _propertyDialogAction;
- private SystemOpenExplorerPerspectiveAction _openToPerspectiveAction;
- private SystemShowInTableAction _showInTableAction;
-
- // global actions
- // Note the Edit menu actions are set in SystemViewPart. Here we use these
- // actions from our own popup menu actions.
- private SystemCommonDeleteAction _deleteAction;
- // for global delete menu item
- private SystemCommonRenameAction _renameAction;
- // for common rename menu item
- private SystemCommonSelectAllAction _selectAllAction;
- // for common Ctrl+A select-all
-
- protected boolean _selectionShowRefreshAction;
- protected boolean _selectionShowOpenViewActions;
- protected boolean _selectionShowDeleteAction;
- protected boolean _selectionShowRenameAction;
- protected boolean _selectionShowPropertiesAction;
- protected boolean _selectionEnableDeleteAction;
- protected boolean _selectionEnableRenameAction;
-
-
- protected boolean _selectionIsRemoteObject = true;
- protected boolean _selectionFlagsUpdated = false;
-
- private ISystemMessageLine _messageLine;
-
- private int[] _lastWidths = null;
- private int _charWidth = 3;
-
- private boolean _showColumns = true;
-
- private Image _upI;
- private Image _downI;
-
- protected boolean menuListenerAdded = false;
-
- private static final int LEFT_BUTTON = 1;
- private int mouseButtonPressed = LEFT_BUTTON;
- /**
- * Constructor for the table view
- *
- */
- public SystemTableView(Table table, ISystemMessageLine msgLine)
- {
- super(table);
- _layout = new TableLayout();
- _messageLine = msgLine;
-
- _columnManager = new SystemTableViewColumnManager(this);
- _provider = getProvider();
- _columnSelectionListener = new HeaderSelectionListener();
-
- setContentProvider(_provider);
-
- setLabelProvider(new SystemDecoratingLabelProvider(_provider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- //setLabelProvider(_provider);
-
- _filter = new SystemTableViewFilter();
- addFilter(_filter);
-
- _charWidth = table.getFont().getFontData()[0].getHeight() / 2;
- computeLayout();
-
- _menuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- _menuManager.setRemoveAllWhenShown(true);
- _menuManager.addMenuListener(this);
- Menu menu = _menuManager.createContextMenu(table);
- table.setMenu(menu);
-
- addSelectionChangedListener(this);
-
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.addSystemResourceChangeListener(this);
- sr.addSystemRemoteChangeListener(this);
-
- initDragAndDrop();
-
- table.setVisible(false);
-
- // key listening for delete press
- getControl().addKeyListener(new KeyAdapter()
- {
- public void keyPressed(KeyEvent e)
- {
- handleKeyPressed(e);
- }
- });
- getControl().addMouseListener(new MouseAdapter()
- {
- public void mouseDown(MouseEvent e)
- {
- mouseButtonPressed = e.button; //d40615
- }
- });
-
-
- _upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_UP_ID);
- _downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN_ID);
- }
-
- /**
- * @since 3.0 Moved SystemTableViewProvider from internal to API
- * @return
- */
- protected SystemTableViewProvider getProvider()
- {
- if (_provider == null)
- {
- _provider = new SystemTableViewProvider(_columnManager);
- }
- return _provider;
- }
-
- public void showColumns(boolean flag)
- {
- _showColumns = flag;
- }
-
-
- public Layout getLayout()
- {
- return _layout;
- }
-
-
- public void setViewFilters(String[] filter)
- {
- if (_filter.getFilters() != filter)
- {
- _filter.setFilters(filter);
- refresh();
- }
- }
-
- public String[] getViewFilters()
- {
- return _filter.getFilters();
- }
-
- /**
- * Return the popup menu for the table
- */
- public Menu getContextMenu()
- {
- return getTable().getMenu();
- }
- /**
- * Return the popup menu for the table
- */
- public MenuManager getContextMenuManager()
- {
- return _menuManager;
- }
-
- /**
- * Called whenever the input for the view changes
- */
- public void inputChanged(Object newObject, Object oldObject)
- {
- if (newObject instanceof IAdaptable)
- {
- getTable().setVisible(true);
- _objectInput = newObject;
- computeLayout();
-
- // reset the filter
- //setViewFilters(null);
-
- super.inputChanged(newObject, oldObject);
-
- }
- else if (newObject == null)
- {
- getTable().setVisible(false);
- _objectInput = null;
- computeLayout();
-
- setViewFilters(null);
- }
- }
-
- public Object getInput()
- {
- return _objectInput;
- }
-
- /**
- * Convenience method for retrieving the view adapter for an object
- */
- protected ISystemViewElementAdapter getViewAdapter(Object obj)
- {
- ISystemViewElementAdapter adapter = SystemAdapterHelpers.getViewAdapter(obj, this);
- if (adapter != null)
- adapter.setPropertySourceInput(obj);
- return adapter;
- }
-
- /**
- * Convenience method for retrieving the view adapter for an object's children
- */
- public ISystemViewElementAdapter getAdapterForContents()
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
- Object[] children = provider.getChildren(getInput());
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
- return getViewAdapter(child);
- }
- return null;
- }
-
- /**
- * Used to determine what the columns should be on the table.
- */
- public IPropertyDescriptor[] getVisibleDescriptors(Object object)
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
- Object[] children = provider.getChildren(object);
- return getVisibleDescriptors(children);
- }
-
- private IPropertyDescriptor[] getVisibleDescriptors(Object[] children)
- {
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
- return getCustomDescriptors(getViewAdapter(child));
- }
-
- return new IPropertyDescriptor[0];
- }
-
- /**
- * @since 3.0 replaced SystemTableViewColumnManager by
- * ISystemTableViewColumnManager
- * @return
- */
- public ISystemTableViewColumnManager getColumnManager()
- {
- return _columnManager;
- }
-
- public IPropertyDescriptor getNameDescriptor(Object object)
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
- Object[] children = provider.getChildren(object);
- return getNameDescriptor(children);
- }
-
- private IPropertyDescriptor getNameDescriptor(Object[] children)
- {
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
- return getViewAdapter(child).getPropertyDescriptors()[0];
- }
-
- return null;
- }
-
- /**
- * Used to determine the formats of each descriptor.
- */
- private ArrayList getFormatsIn()
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
- Object[] children = provider.getChildren(_objectInput);
- return getFormatsIn(children);
- }
-
- private IPropertyDescriptor[] getCustomDescriptors(ISystemViewElementAdapter adapter)
- {
- return _columnManager.getVisibleDescriptors(adapter);
- }
-
- private ArrayList getFormatsIn(Object[] children)
- {
- ArrayList results = new ArrayList();
-
- if (children != null && children.length > 0)
- {
- IAdaptable child = (IAdaptable) children[0];
-
- Object adapter = child.getAdapter(ISystemViewElementAdapter.class);
- if (adapter instanceof ISystemViewElementAdapter)
- {
- ISystemViewElementAdapter ad = (ISystemViewElementAdapter) adapter;
- ad.setPropertySourceInput(child);
-
- IPropertyDescriptor[] descriptors = getCustomDescriptors(ad);
- for (int i = 0; i < descriptors.length; i++)
- {
- IPropertyDescriptor descriptor = descriptors[i];
-
- try
- {
- Object key = descriptor.getId();
- Object propertyValue = ad.getPropertyValue(key, false);
- if (propertyValue != null) {
- // FIXME Since we're only checking the FIRST element
- // in the list of elements for its descriptor, we
- // might get null here if the first element is
- // invalid - although other elements might be valid.
- // This issue is tracked in
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=193329#c5
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=187571
- results.add(propertyValue.getClass());
- } else {
- // FIXME Fallback: Display property value as String,
- // is this always possible?
- results.add(String.class);
- }
- }
- catch (Exception e)
- {
- results.add(String.class);
- }
-
- }
- }
- }
-
- return results;
- }
-
- public void computeLayout()
- {
- computeLayout(false);
- }
-
- private CellEditor getCellEditor(Table parent, IPropertyDescriptor descriptor)
- {
- CellEditor editor = descriptor.createPropertyEditor(parent);
- if (editor instanceof SystemInheritableTextCellEditor)
- {
- ((SystemInheritableTextCellEditor) editor).getInheritableEntryField().setAllowEditingOfInheritedText(true);
- }
-
- return editor;
- }
-
- private boolean sameDescriptors(IPropertyDescriptor[] descriptors1, IPropertyDescriptor[] descriptors2)
- {
- if (descriptors1 == null || descriptors2 == null)
- {
- return false;
- }
- if (descriptors1.length == descriptors2.length)
- {
- boolean same = true;
- for (int i = 0; i < descriptors1.length && same; i++)
- {
- same = descriptors1[i] == descriptors2[i];
- }
- return same;
- }
- else
- {
- return false;
- }
- }
-
- /**
- * Determines what columns should be shown in this view. The columns may change
- * anytime the view input changes. The columns in the control are modified and
- * columns may be added or deleted as necessary to make it conform to the
- * new data.
- */
- public void computeLayout(boolean force)
- {
- if (_showColumns == false)
- return;
- if (_objectInput == null)
- return;
-
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
- Object[] children = provider.getChildren(_objectInput);
-
- // if no children, don't update
- if (children == null || children.length == 0)
- {
- return;
- }
-
- IPropertyDescriptor[] descriptors = getVisibleDescriptors(children);
- IPropertyDescriptor nameDescriptor = getNameDescriptor(children);
-
- int n = descriptors.length; // number of columns we need (name column + other columns)
- if (nameDescriptor != null)
- n += 1;
- if (n == 0)
- return; // there is nothing to lay out!
-
-
- if (sameDescriptors(descriptors,_uniqueDescriptors) && !force)
- {
- setLastColumnWidths(getCurrentColumnWidths());
- return;
- }
- _uniqueDescriptors = descriptors;
- Table table = getTable();
- if (table == null || table.isDisposed())
- return;
-
- // set column attributes, create new columns if necessary
- TableColumn[] columns = table.getColumns();
- int numColumns = columns.length; // number of columns in the control
- CellEditor editors[] = new CellEditor[n];
- String headings[] = new String[n];
- String propertyIds[] = new String[n];
- ArrayList formats = getFormatsIn();
-
-
- _layout = new TableLayout();
- for (int i = 0; i < n; i++)
- { // for each column
- String name = null;
- String propertyId = null;
- CellEditor editor = null;
- int alignment = SWT.LEFT;
- int weight = 100;
- if (i == 0)
- {
- // this is the first column -- treat it special
- //name = SystemPropertyResources.RESID_PROPERTY_NAME_LABEL;
- name = SystemResources.RESID_RENAME_COLHDG_OLDNAME;
- if (nameDescriptor != null)
- {
- propertyId = (String) nameDescriptor.getId();
- editor = getCellEditor(table, nameDescriptor);
- weight = 200;
- }
- }
- else
- { // these columns come from the regular descriptors
- IPropertyDescriptor descriptor = descriptors[i - 1];
-
- Class format = (Class) formats.get(i - 1);
- name = descriptor.getDisplayName();
- propertyId = (String) descriptor.getId();
- editor = getCellEditor(table, descriptor);
- if (format != String.class)
- alignment = SWT.RIGHT;
- }
- TableColumn tc = null;
- if (i >= numColumns)
- {
- tc = new TableColumn(table, alignment, i);
- tc.setMoveable(true);
- tc.addSelectionListener(_columnSelectionListener);
- }
- else
- {
- tc = columns[i];
- tc.setAlignment(alignment);
- }
- _layout.addColumnData(new ColumnWeightData(weight));
- tc.setText(name);
- if (i == 0)
- {
- // tc.setImage(_downI);
- }
- headings[i] = name;
- editors[i] = editor;
- propertyIds[i] = propertyId;
- }
- setColumnProperties(propertyIds);
- setCellEditors(editors);
- setCellModifier(cellModifier);
-
- // dispose of any extra columns the table control may have
- for (int i = n; i < numColumns; i++)
- {
- columns[i].dispose();
- columns[i] = null;
- }
-
- // compute column widths
- columns = table.getColumns();
- numColumns = columns.length;
- Rectangle clientA = table.getClientArea();
- int totalWidth = clientA.width - 5;
- if (totalWidth <= 0)
- {
- // find a default
- totalWidth = 500;
- }
-
-
- int[] lastWidths = getLastColumnWidths();
- if (numColumns > 1)
- {
- // check if previous widths can be used
- if (lastWidths != null && lastWidths.length == numColumns)
- {
-
- // use previously established widths
- setCurrentColumnWidths(lastWidths);
- }
- else
- {
- if (totalWidth > 0)
- {
- // no previous widths or number of columns has changed - need to calculate
- int averageWidth = totalWidth / numColumns;
- int firstWidth = Math.max(averageWidth, 150);
- averageWidth = (totalWidth - firstWidth) / (numColumns - 1);
- averageWidth = Math.max(averageWidth, 80);
- columns[0].setWidth(firstWidth);
- for (int i = 1; i < numColumns; i++)
- {
-
- columns[i].setWidth(averageWidth);
- }
- setLastColumnWidths(getCurrentColumnWidths());
- }
- }
- table.setHeaderVisible(true);
- }
- else
- {
-
- if (numColumns == 1)
- {
- int width = totalWidth;
- if (lastWidths != null && lastWidths.length == 1)
- {
- width = (totalWidth > lastWidths[0]) ? totalWidth : lastWidths[0];
- }
-
-
- int maxWidth = provider.getMaxCharsInColumnZero() * _charWidth;
- if (maxWidth > width)
- {
- width = maxWidth;
- }
-
- if (width > 0)
- {
- columns[0].setWidth(width);
- }
- table.setHeaderVisible(false);
- }
- }
- }
-
- public int[] getCurrentColumnWidths()
- {
- Table table = getTable();
- if (table != null && !table.isDisposed())
- {
- int[] widths = new int[table.getColumnCount()];
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < columns.length; i++)
- {
- widths[i] = columns[i].getWidth();
- }
- return widths;
- }
-
- return new int[0];
- }
-
- public void setCurrentColumnWidths(int[] widths)
- {
- Table table = getTable();
- if (table != null && !table.isDisposed())
- {
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < columns.length && i < widths.length; i++)
- {
- columns[i].setWidth(widths[i]);
- }
- }
- }
-
- public int[] getLastColumnWidths()
- {
- return _lastWidths;
- }
-
- public void setLastColumnWidths(int[] widths)
- {
- _lastWidths = widths;
- }
-
- /**
- * Initialize drag and drop support for this view.
- *
- */
- protected void initDragAndDrop()
- {
- int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] dragtransfers = new Transfer[]
- { PluginTransfer.getInstance(),
- EditorInputTransfer.getInstance()
- };
-
- Transfer[] droptransfers = new Transfer[]
- { PluginTransfer.getInstance(),
- FileTransfer.getInstance(),
- EditorInputTransfer.getInstance()
- };
-
- addDragSupport(ops | DND.DROP_DEFAULT, dragtransfers, new SystemViewDataDragAdapter(this));
- addDropSupport(ops | DND.DROP_DEFAULT, droptransfers, new SystemViewDataDropAdapter(this));
- }
-
- /**
- * Used to asynchronously update the view whenever properties change.
- * @see org.eclipse.rse.core.events.ISystemResourceChangeListener#systemResourceChanged(org.eclipse.rse.core.events.ISystemResourceChangeEvent)
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
-
- boolean madeChange = false;
- Object parent = event.getParent();
- Object child = event.getSource();
- int eventType = event.getType();
- switch (eventType)
- {
- case ISystemResourceChangeEvents.EVENT_RENAME_FILTER_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_CHANGE_FILTER_REFERENCE:
- case ISystemResourceChangeEvents.EVENT_CHANGE_FILTERSTRING_REFERENCE:
- {
- if (_objectInput instanceof ISystemFilterReference)
- {
- if (child == ((ISystemFilterReference)_objectInput).getReferencedFilter())
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
-
- if (provider != null)
- {
- if (!madeChange)
- {
- provider.flushCache();
- madeChange = true;
- }
-
- computeLayout();
- try
- {
- internalRefresh(_objectInput);
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError(e.getMessage());
- }
- }
-
- }
- }
- }
- break;
- case ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE :
- case ISystemResourceChangeEvents.EVENT_PROPERTYSHEET_UPDATE :
- case ISystemResourceChangeEvents.EVENT_ICON_CHANGE:
- {
- try
- {
- Widget w = findItem(child);
- if (w != null)
- {
- updateItem(w, child);
- }
- }
- catch (Exception e)
- {
-
- }
- }
- return;
- //break;
-
- case ISystemResourceChangeEvents.EVENT_DELETE:
- case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
- {
- if (child instanceof ISystemFilterReference)
- {
- Widget w = findItem(child);
- if (w != null)
- {
- remove(child);
- }
- }
- }
- break;
-
- case ISystemResourceChangeEvents.EVENT_ADD :
- case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE :
- {
- boolean addingConnection = (child instanceof IHost);
- if (_objectInput instanceof ISystemRegistry && addingConnection)
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
-
- if (provider != null)
- {
- if (!madeChange)
- {
- provider.flushCache();
- madeChange = true;
- }
-
- computeLayout();
- internalRefresh(_objectInput);
- }
- }
- }
- break;
-
- case ISystemResourceChangeEvents.EVENT_REFRESH:
- case ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE:
- {
- if (child == RSECorePlugin.getTheSystemRegistry())
- {
- // treat this as refresh all
- child = _objectInput;
- break;
- }
- try
- {
- Widget w = findItem(child);
- if (w != null && w.getData() != _objectInput)
- {
- //child is the children of this table input.
- //Need to refresh the whole view to handler
- //And we need to make _objectInput to stale, otherwise deleted object
- //could not be removed from the table.
- if (_objectInput instanceof ISystemContainer)
- {
- ((ISystemContainer)_objectInput).markStale(true);
- }
- child = _objectInput;
- }
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError(e.getMessage());
- }
-
- }
- break;
- default :
- break;
-
- }
-
- if (child == _objectInput || parent == _objectInput)
- {
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
-
- if (provider != null)
- {
- if (!madeChange)
- {
- provider.flushCache();
- madeChange = true;
- }
-
- computeLayout();
- try
- {
- internalRefresh(_objectInput);
- }
- catch (Exception e)
- {
- SystemBasePlugin.logError(e.getMessage());
- }
- }
- }
- }
-
- /**
- * This is the method in your class that will be called when a remote resource
- * changes. You will be called after the resource is changed.
- * @see org.eclipse.rse.core.events.ISystemRemoteChangeListener#systemRemoteResourceChanged(org.eclipse.rse.core.events.ISystemRemoteChangeEvent)
- */
- public void systemRemoteResourceChanged(ISystemRemoteChangeEvent event)
- {
- boolean madeChange = false;
- int eventType = event.getEventType();
- Object remoteResourceParent = event.getResourceParent();
- Object remoteResource = event.getResource();
- List remoteResourceNames = null;
- if (remoteResource instanceof List) {
- remoteResourceNames = (List) remoteResource;
- remoteResource = remoteResourceNames.get(0);
- }
-
- String remoteResourceParentName = getRemoteResourceAbsoluteName(remoteResourceParent);
- String remoteResourceName = getRemoteResourceAbsoluteName(remoteResource);
- if (remoteResourceName == null)
- return;
- SystemTableViewProvider provider = (SystemTableViewProvider) getContentProvider();
-
- if (_objectInput instanceof ISystemContainer && ((ISystemContainer)_objectInput).isStale())
- {
- provider.flushCache();
- refresh();
- return;
- }
-
- switch (eventType)
- {
- // --------------------------
- // REMOTE RESOURCE CHANGED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CHANGED :
- {
- if (remoteResourceParent == getInput())
- {
- Widget w = findItem(remoteResource);
- if (w != null)
- {
- updateItem(w, remoteResource);
- }
-
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE CREATED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_CREATED :
- {
- String inputResourceName = getRemoteResourceAbsoluteName(getInput());
- if (remoteResourceParentName != null && remoteResourceParentName.equals(inputResourceName))
- {
- if (provider == null)
- {
- return;
- }
- if (!madeChange)
- {
- if (_objectInput instanceof ISystemContainer)
- {
- ((ISystemContainer)_objectInput).markStale(true);
- }
- provider.flushCache();
- madeChange = true;
- }
-
- refresh();
- }
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE DELETED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED :
- {
- {
- Object dchild = remoteResource;
-
- ISystemViewElementAdapter dadapt = getViewAdapter(dchild);
- if (dadapt != null)
- {
- ISubSystem dSubSystem = dadapt.getSubSystem(dchild);
- String dkey = dadapt.getAbsoluteName(dchild);
-
- if (provider != null)
- {
- Object[] children = provider.getChildren(_objectInput);
- for (int i = 0; i < children.length; i++)
- {
- Object existingChild = children[i];
- if (existingChild != null)
- {
- ISystemViewElementAdapter eadapt = getViewAdapter(existingChild);
- ISubSystem eSubSystem = eadapt.getSubSystem(existingChild);
-
- if (dSubSystem == eSubSystem)
- {
- String ekey = eadapt.getAbsoluteName(existingChild);
- if (ekey.equals(dkey))
- {
- if (!madeChange)
- {
- if (_objectInput instanceof ISystemContainer)
- {
- ((ISystemContainer)_objectInput).markStale(true);
- }
-
- provider.flushCache();
- madeChange = true;
-
- // do a full refresh
- refresh();
- }
- }
- }
-
- }
- }
- }
- }
- }
-
- }
- break;
-
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
- {
- String oldName = event.getOldNames()[0]; // assuming only one resource
- Object child = event.getResource();
-
- if (provider != null)
- {
- Object[] previousResults = provider.getCache();
- if (previousResults != null)
- {
- for (int i = 0; i < previousResults.length; i++)
- {
- Object previousResult = previousResults[i];
-
- if (previousResult == child)
- {
- Widget widget = findItem(previousResult);
- if (widget != null)
- {
- widget.setData(child);
- updateItem(widget, child);
- return;
- }
- }
- else
- {
- String previousName = getViewAdapter(previousResult).getAbsoluteName(previousResult);
-
- if (previousName != null && previousName.equals(oldName))
- {
- provider.flushCache();
- internalRefresh(_objectInput);
- return;
- }
- }
- }
-
- }
- }
- }
-
- break;
-
- /*
- // --------------------------
- // REMOTE RESOURCE RENAMED...
- // --------------------------
- case ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED :
- {
- if (remoteResourceParent == getInput())
- {
- if (provider != null)
- {
- provider.flushCache();
- }
-
- refresh();
- }
-
- }
- break;
- */
- }
- }
-
- /**
- * Turn a given remote object reference into a fully qualified absolute name
- */
- private String getRemoteResourceAbsoluteName(Object remoteResource)
- {
- if (remoteResource == null)
- return null;
- String remoteResourceName = null;
- if (remoteResource instanceof String)
- remoteResourceName = (String) remoteResource;
- else
- {
- IRemoteObjectIdentifier ra = getViewAdapter(remoteResource);
- if (ra == null)
- return null;
- remoteResourceName = ra.getAbsoluteName(remoteResource);
- }
- return remoteResourceName;
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- Object firstSelection = sel.getFirstElement();
- if (firstSelection == null)
- return;
-
- _selectionFlagsUpdated = false;
- ISystemViewElementAdapter adapter = getViewAdapter(firstSelection);
- if (adapter != null)
- {
- displayMessage(adapter.getStatusLineText(firstSelection));
- if ((mouseButtonPressed == LEFT_BUTTON))
- adapter.selectionChanged(firstSelection);
- }
- else
- clearMessage();
- }
-
- public void dispose()
- {
- removeSelectionChangedListener(this);
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- sr.removeSystemResourceChangeListener(this);
- sr.removeSystemRemoteChangeListener(this);
- _menuManager.removeAll();
-
- Table table = getTable();
-
- if (!table.isDisposed())
- {
- table.removeAll();
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < columns.length; i++)
- {
- TableColumn column = columns[i];
- if (column != null && !column.isDisposed())
- {
- column.removeSelectionListener(_columnSelectionListener);
- column.dispose();
- column = null;
- }
- }
-
- table.dispose();
- }
- }
-
- /*
- * Everything below is basically stuff copied and pasted from SystemsView
- * -There needs to be cleaning up of the below code as some of this stuff
- * is broken for the table view
- *
- *
- public void createStandardGroups(IMenuManager menu)
- {
- if (!menu.isEmpty())
- return;
- // simply sets partitions in the menu, into which actions can be directed.
- // Each partition can be delimited by a separator (new Separator) or not (new GroupMarker).
- // Deleted groups are not used yet.
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_NEW));
- // new->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GOTO));
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_EXPANDTO));
- // expand to->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_EXPAND));
- // expand, collapse
- // goto into, go->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPENWITH));
- // open with->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_BROWSEWITH));
- // browse with ->
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_OPEN));
- // open xxx
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_WORKWITH));
- // work with->
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_SHOW)); // show->type hierarchy, in-navigator
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_BUILD));
- // build, rebuild, refresh
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CHANGE));
- // update, change
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORGANIZE));
- // rename,move,copy,delete,bookmark,refactoring
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_REORDER));
- // move up, move down
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_GENERATE));
- // getters/setters, etc. Typically in editor
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_SEARCH));
- // search
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_CONNECTION));
- // connection-related actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_IMPORTEXPORT));
- // get or put actions
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADAPTERS));
- // actions queried from adapters
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_ADDITIONS));
- // user or BP/ISV additions
- //menu.add(new Separator(ISystemContextMenuConstants.GROUP_VIEWER_SETUP)); // ? Probably View->by xxx, yyy
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_TEAM));
- // Team
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_COMPAREWITH));
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_REPLACEWITH));
- menu.add(new Separator(ISystemContextMenuConstants.GROUP_PROPERTIES));
- // Properties
- }
-
- /**
- * Rather than pre-defining this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected PropertyDialogAction getPropertyDialogAction()
- {
- if (_propertyDialogAction == null)
- {
- _propertyDialogAction = new PropertyDialogAction(new SameShellProvider(getShell()), this);
- //propertyDialogAction.setToolTipText(" ");
- }
- _propertyDialogAction.selectionChanged(getSelection());
- return _propertyDialogAction;
- }
-
- /**
- * Return the select All action
- */
- protected IAction getSelectAllAction()
- {
- if (_selectAllAction == null)
- _selectAllAction = new SystemCommonSelectAllAction(getShell(), this, this);
- return _selectAllAction;
- }
-
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected IAction getRenameAction()
- {
- if (_renameAction == null)
- _renameAction = new SystemCommonRenameAction(getShell(), this);
- return _renameAction;
- }
- /**
- * Rather than pre-defined this common action we wait until it is first needed,
- * for performance reasons.
- */
- protected IAction getDeleteAction()
- {
- if (_deleteAction == null)
- _deleteAction = new SystemCommonDeleteAction(getShell(), this);
- return _deleteAction;
- }
-
- /**
- * Return the refresh action
- */
- protected IAction getRefreshAction()
- {
- if (_refreshAction == null)
- _refreshAction = new SystemRefreshAction(getShell());
- return _refreshAction;
- }
-
-
- /**
- * Rather than pre-defining this common action we wait until it is first
- * needed, for performance reasons.
- *
- * @since 3.0
- */
- public IAction getNewConnectionAction() {
- if (_newConnectionAction == null) _newConnectionAction = new SystemNewConnectionAction(getShell(), true, this); // true=>from popup menu
- return _newConnectionAction;
- }
-
- /**
- * Rather than pre-defining this common action we wait until it is first needed,
- * for performance reasons.
- */
- private IAction getImportConnectionAction() {
- if (_importConnectionAction == null) {
- _importConnectionAction = new SystemImportConnectionAction(); // true=>from popup menu
- _importConnectionAction.setShell(getShell());
- _importConnectionAction.setText(SystemResources.RESID_IMPORT_CONNECTION_LABEL_LONG);
- }
- return _importConnectionAction;
- }
-
-
- /*
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- *
- protected SystemCascadingOpenToAction getOpenToAction()
- {
- if (openToAction == null)
- openToAction = new SystemCascadingOpenToAction(getShell(),getWorkbenchWindow());
- return openToAction;
- } NOT USED YET */
- /**
- * Get the common "Open to->" action for opening a new Remote System Explorer view,
- * scoped to the currently selected object.
- */
- private SystemOpenExplorerPerspectiveAction getOpenToPerspectiveAction()
- {
- if (_openToPerspectiveAction == null)
- {
- IWorkbench desktop = PlatformUI.getWorkbench();
- IWorkbenchWindow win = desktop.getActiveWorkbenchWindow();
-
- _openToPerspectiveAction = new SystemOpenExplorerPerspectiveAction(getShell(), win);
- }
- //getWorkbenchWindow());
- return _openToPerspectiveAction;
- }
-
- private SystemShowInTableAction getShowInTableAction()
- {
- if (_showInTableAction == null)
- {
- _showInTableAction = new SystemShowInTableAction(getShell());
- }
- //getWorkbenchWindow());
- return _showInTableAction;
- }
-
- public Shell getShell()
- {
- return getTable().getShell();
- }
-
- /**
- * Required method from ISystemDeleteTarget.
- * Decides whether to even show the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showDelete()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionShowDeleteAction;
- }
- /**
- * Required method from ISystemDeleteTarget
- * Decides whether to enable the delete menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canDelete()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionEnableDeleteAction;
- }
-
- /*
- * Required method from ISystemDeleteTarget
- */
- public boolean doDelete(IProgressMonitor monitor)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- //int selectedCount = selection.size();
- //Object multiSource[] = new Object[selectedCount];
- //int idx = 0;
- Object element = null;
- //Object parentElement = getSelectedParent();
- ISystemViewElementAdapter adapter = null;
- boolean ok = true;
- boolean anyOk = false;
- Vector deletedVector = new Vector();
- try
- {
- while (ok && elements.hasNext())
- {
- element = elements.next();
- //multiSource[idx++] = element;
- adapter = getViewAdapter(element);
- ok = adapter.doDelete(getShell(), element, monitor);
- if (ok)
- {
- anyOk = true;
- deletedVector.addElement(element);
- }
- }
- }
- catch (SystemMessageException exc)
- {
- SystemMessageDialog.displayErrorMessage(getShell(), exc.getSystemMessage());
- ok = false;
- }
- catch (Exception exc)
- {
- String msg = exc.getMessage();
- if ((msg == null) || (exc instanceof ClassCastException))
- msg = exc.getClass().getName();
- SystemMessageDialog.displayErrorMessage(getShell(), RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_DELETING).makeSubstitution(element, msg));
- ok = false;
- }
- if (anyOk)
- {
- Object[] deleted = new Object[deletedVector.size()];
- for (int idx = 0; idx < deleted.length; idx++)
- deleted[idx] = deletedVector.elementAt(idx);
- if (_selectionIsRemoteObject)
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_DELETED, deletedVector, null, null, null, this);
- else
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(deleted, ISystemResourceChangeEvents.EVENT_DELETE_MANY, getInput()));
- }
- return ok;
- }
-
-
- /**
- * Decides whether to even show the properties menu item.
- * Assumes scanSelections() has already been called
- */
- protected boolean showProperties() {
- return _selectionShowPropertiesAction;
- }
-
- // ---------------------------
- // ISYSTEMRENAMETARGET METHODS
- // ---------------------------
-
- private class RenameJob extends WorkspaceJob
- {
- String[] newNames = null;
- Object[] elements = null;
- Object[] elementAdapters = null;
- Object parentElement = null;
- String renameMessage = null;
- /**
- * RenameJob job.
- * @param newNames array of new names of all the elements need to be renamed
- * @param elements array of all the elements need to be renamed
- * @param elementAdapters array of all the view adapters of the elements need to be renamed
- * @param renameMessage the title of the Rename job.
- */
- public RenameJob(String[] newNames, Object[] elements, Object[] elementAdapters, String renameMessage)
- {
- super(renameMessage);
- this.newNames = newNames;
- this.elements = elements;
- this.elementAdapters = elementAdapters;
- setUser(true);
- }
-
- public IStatus runInWorkspace(IProgressMonitor monitor)
- {
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- Object element = null;
- ISystemViewElementAdapter adapter = null;
- ISystemRemoteElementAdapter remoteAdapter = null;
- String oldFullName = null;
- String oldName = null;
- Vector fileNamesRenamed = new Vector();
- boolean ok = true;
-
- try {
- int steps = elements.length;
- monitor.beginTask(renameMessage, steps);
- for (int i=0; i < elements.length; i++)
- {
- element = elements[i];
- adapter = (ISystemViewElementAdapter)elementAdapters[i];
- remoteAdapter = getRemoteAdapter(element);
- Object parentElement = getParentForContent(element);
- if (remoteAdapter != null)
- {
- oldName = remoteAdapter.getName(element);
- oldFullName = remoteAdapter.getAbsoluteName(element); // pre-rename
- monitor.subTask(getRenamingMessage(oldName).getLevelOneText());
- }
- ok = adapter.doRename(null, element, newNames[i], monitor);
- if (ok)
- {
- fileNamesRenamed.add(oldName);
- if (remoteAdapter != null)
- {
- // Don't think we need to do findItem and updateItem here.
- sr.fireRemoteResourceChangeEvent(ISystemRemoteChangeEvents.SYSTEM_REMOTE_RESOURCE_RENAMED, element, parentElement, adapter.getSubSystem(element), new String[]{oldFullName}, this);
-
- }
-
- else
- sr.fireEvent(new org.eclipse.rse.core.events.SystemResourceChangeEvent(element, ISystemResourceChangeEvents.EVENT_RENAME, parentElement));
- }
- monitor.worked(1);
- }
- }
- catch (SystemMessageException exc) {
- ok = false;
- //If this operation is cancelled, need to display a proper message to the user.
- if (monitor.isCanceled() && fileNamesRenamed.size() > 0)
- {
- //Get the renamed file names
- String renamedFileNames = (String)(fileNamesRenamed.get(0));
- for (int i=1; i<(fileNamesRenamed.size()); i++)
- {
- renamedFileNames = renamedFileNames + "\n" + fileNamesRenamed.get(i); //$NON-NLS-1$
- }
- //getMessage("RSEG1125").makeSubstitution(movedFileName));
- SystemMessage thisMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_RENAME_INTERRUPTED);
- thisMessage.makeSubstitution(renamedFileNames);
- SystemMessageDialog.displayErrorMessage(null, thisMessage);
- }
- else
- {
- SystemMessageDialog.displayErrorMessage(null, exc.getSystemMessage());
- }
- } catch (Exception exc) {
- exc.printStackTrace();
- SystemMessageDialog.displayErrorMessage(null, RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_EXCEPTION_RENAMING).makeSubstitution(element, exc), //msg),
- exc);
- ok = false;
- }
-
- return Status.OK_STATUS;
- }
- }
- /**
- * Required method from ISystemRenameTarget.
- * Decides whether to even show the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean showRename()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionShowRenameAction;
- }
- /**
- * Required method from ISystemRenameTarget
- * Decides whether to enable the rename menu item.
- * Assumes scanSelections() has already been called
- */
- public boolean canRename()
- {
- if (!_selectionFlagsUpdated)
- scanSelections();
- return _selectionEnableRenameAction;
- }
-
- // default implementation
- // in default table, parent is input
- protected Object getParentForContent(Object element)
- {
- return _objectInput;
- }
-
- /**
- * Get the specific "Renaming %1..."
- *
- * @since 3.0
- */
- protected SystemMessage getRenamingMessage(String oldName)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_RENAMEGENERIC_PROGRESS);
- msg.makeSubstitution(oldName);
- return msg;
- }
-
- /**
- * Required method from ISystemRenameTarget
- */
- public boolean doRename(String[] newNames)
- {
-
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
-
-
- Object[] renameElements = new Object[newNames.length];
- Object[] elementAdapters = new Object[newNames.length];
- int i = 0;
- while (elements.hasNext()) {
- renameElements[i] = elements.next();
- elementAdapters[i] = getViewAdapter(renameElements[i]);
- i++;
- //remoteAdapter = getRemoteAdapter(element);
- }
- SystemMessage renameMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_RENAMEGENERIC_PROGRESS);
- renameMessage.makeSubstitution(""); //$NON-NLS-1$
- String renameMessageText = renameMessage.getLevelOneText();
- RenameJob renameJob = new RenameJob(newNames, renameElements, elementAdapters, renameMessageText);
- renameJob.schedule();
- return true;
-
- }
-
- /**
- * Returns the implementation of ISystemRemoteElement for the given
- * object. Returns null if this object does not adaptable to this.
- */
- protected ISystemRemoteElementAdapter getRemoteAdapter(Object o)
- {
- ISystemRemoteElementAdapter adapter = null;
- if (!(o instanceof IAdaptable))
- adapter = (ISystemRemoteElementAdapter) Platform.getAdapterManager().getAdapter(o, ISystemRemoteElementAdapter.class);
- else
- adapter = (ISystemRemoteElementAdapter) ((IAdaptable) o).getAdapter(ISystemRemoteElementAdapter.class);
- if ((adapter != null) && (adapter instanceof ISystemViewElementAdapter))
- ((ISystemViewElementAdapter) adapter).setViewer(this);
- return adapter;
- }
-
-
- /**
- * Return true if select all should be enabled for the given object.
- * For a tree view, you should return true if and only if the selected object has children.
- * You can use the passed in selection or ignore it and query your own selection.
- */
- public boolean enableSelectAll(IStructuredSelection selection)
- {
- return true;
- }
- /**
- * When this action is run via Edit->Select All or via Ctrl+A, perform the
- * select all action. For a tree view, this should select all the children
- * of the given selected object. You can use the passed in selected object
- * or ignore it and query the selected object yourself.
- */
- public void doSelectAll(IStructuredSelection selection)
- {
- Table table = getTable();
- TableItem[] items = table.getItems();
-
- table.setSelection(items);
- Object[] objects = new Object[items.length];
- for (int idx = 0; idx < items.length; idx++)
- objects[idx] = items[idx].getData();
- fireSelectionChanged(new SelectionChangedEvent(this, new StructuredSelection(objects)));
- }
-
- public void menuAboutToShow(IMenuManager manager)
- {
- fillContextMenu(manager);
-
- if (!menuListenerAdded)
- {
- if (manager instanceof MenuManager)
- {
- Menu m = ((MenuManager)manager).getMenu();
- if (m != null)
- {
- menuListenerAdded = true;
- SystemViewMenuListener ml = new SystemViewMenuListener();
- if (_messageLine != null)
- ml.setShowToolTipText(true, _messageLine);
- m.addMenuListener(ml);
- }
- }
- }
-
- }
-
- public ISelection getSelection()
- {
- ISelection selection = super.getSelection();
- if (selection == null || selection.isEmpty())
- {
- // make the selection the parent
- ArrayList list = new ArrayList();
- if (_objectInput != null)
- {
- list.add(_objectInput);
- selection = new StructuredSelection(list);
- }
- }
-
- return selection;
- }
-
- public void fillContextMenu(IMenuManager menu)
- {
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Object firstIn = selection.getFirstElement();
- if (firstIn instanceof ISystemRegistry)
- {
- menu.add(getNewConnectionAction());
- menu.add(getImportConnectionAction());
- menu.add(new GroupMarker(ISystemContextMenuConstants.GROUP_ADDITIONS)); // user or BP/ISV additions
- }
- else
- {
- SystemView.createStandardGroups(menu);
- // ADD COMMON ACTIONS...
- // no need for refresh of object in table
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_BUILD, getRefreshAction());
-
- // COMMON RENAME ACTION...
- if (canRename())
- {
- if (showRename())
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getRenameAction());
- }
-
- // ADAPTER SPECIFIC ACTIONS
- SystemMenuManager ourMenu = new SystemMenuManager(menu);
-
- Iterator elements = selection.iterator();
- Hashtable adapters = new Hashtable();
- while (elements.hasNext())
- {
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
- adapters.put(adapter, element); // want only unique adapters
- }
- Enumeration uniqueAdapters = adapters.keys();
- Shell shell = getShell();
- while (uniqueAdapters.hasMoreElements())
- {
- ISystemViewElementAdapter nextAdapter = (ISystemViewElementAdapter) uniqueAdapters.nextElement();
- nextAdapter.addActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
-
- if (nextAdapter instanceof AbstractSystemViewAdapter)
- {
- AbstractSystemViewAdapter aVA = (AbstractSystemViewAdapter)nextAdapter;
- // add remote actions
- aVA.addCommonRemoteActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADAPTERS);
-
- // add dynamic menu popups
- aVA.addDynamicPopupMenuActions(ourMenu, selection, shell, ISystemContextMenuConstants.GROUP_ADDITIONS);
- }
- }
-
- // wail through all actions, updating shell and selection
- IContributionItem[] items = menu.getItems();
- for (int idx = 0; idx < items.length; idx++)
- {
- if ((items[idx] instanceof ActionContributionItem) && (((ActionContributionItem) items[idx]).getAction() instanceof ISystemAction))
- {
- ISystemAction item = (ISystemAction) (((ActionContributionItem) items[idx]).getAction());
- //item.setShell(getShell());
- //item.setSelection(selection);
- //item.setViewer(this);
- item.setInputs(getShell(), this, selection);
- }
- else if (items[idx] instanceof SystemSubMenuManager)
- {
- SystemSubMenuManager item = (SystemSubMenuManager) items[idx];
- //item.setShell(getShell());
- //item.setSelection(selection);
- //item.setViewer(this);
- item.setInputs(getShell(), this, selection);
- }
- }
-
- // COMMON DELETE ACTION...
- if (canDelete() && showDelete())
- {
- //menu.add(getDeleteAction());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_REORGANIZE, getDeleteAction());
- ((ISystemAction) getDeleteAction()).setInputs(getShell(), this, selection);
- menu.add(new Separator());
- }
-
- // PROPERTIES ACTION...
- // This is supplied by the system, so we pretty much get it for free. It finds the
- // registered propertyPages extension points registered for the selected object's class type.
- //propertyDialogAction.selectionChanged(selection);
-
- if (showProperties())
- {
- PropertyDialogAction pdAction = getPropertyDialogAction();
- if (pdAction.isApplicableForSelection())
- {
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_PROPERTIES, pdAction);
- }
- }
-
- // OPEN IN NEW PERSPECTIVE ACTION... if (fromSystemViewPart && showOpenViewActions())
- if (!_selectionIsRemoteObject)
- {
- //SystemCascadingOpenToAction openToAction = getOpenToAction();
- SystemOpenExplorerPerspectiveAction openToPerspectiveAction = getOpenToPerspectiveAction();
- SystemShowInTableAction showInTableAction = getShowInTableAction();
- openToPerspectiveAction.setSelection(selection);
- showInTableAction.setSelection(selection);
- //menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToAction.getSubMenu());
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, openToPerspectiveAction);
- menu.appendToGroup(ISystemContextMenuConstants.GROUP_OPEN, showInTableAction);
-
- }
-
-
- }
- }
-
- /**
- * --------------------------------------------------------------------------------
- * For many actions we have to walk the selection list and examine each selected
- * object to decide if a given common action is supported or not.
- * <p>
- * Walking this list multiple times while building the popup menu is a performance
- * hit, so we have this common method that does it only once, setting instance
- * variables for all of the decisions we are in interested in.
- * --------------------------------------------------------------------------------
- */
- protected void scanSelections()
- {
- // initial these variables to true. Then if set to false even once, leave as false always...
- _selectionShowRefreshAction = true;
- _selectionShowOpenViewActions = true;
- _selectionShowDeleteAction = true;
- _selectionShowRenameAction = true;
- _selectionShowPropertiesAction = true;
- _selectionEnableDeleteAction = true;
- _selectionEnableRenameAction = true;
- _selectionIsRemoteObject = true;
- _selectionFlagsUpdated = true;
-
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- Iterator elements = selection.iterator();
- while (elements.hasNext())
- {
- Object element = elements.next();
- ISystemViewElementAdapter adapter = getViewAdapter(element);
-
- if (_selectionShowRefreshAction)
- _selectionShowRefreshAction = adapter.showRefresh(element);
-
- if (_selectionShowOpenViewActions)
- _selectionShowOpenViewActions = adapter.showOpenViewActions(element);
-
- if (_selectionShowDeleteAction)
- _selectionShowDeleteAction = adapter.showDelete(element);
-
- if (_selectionShowRenameAction)
- _selectionShowRenameAction = adapter.showRename(element);
-
- if (_selectionShowPropertiesAction)
- _selectionShowPropertiesAction = adapter.showProperties(element);
-
- if (_selectionEnableDeleteAction)
- _selectionEnableDeleteAction = _selectionShowDeleteAction && adapter.canDelete(element);
- //System.out.println("ENABLE DELETE SET TO " + selectionEnableDeleteAction);
-
- if (_selectionEnableRenameAction)
- _selectionEnableRenameAction = _selectionShowRenameAction && adapter.canRename(element);
-
- if (_selectionIsRemoteObject)
- _selectionIsRemoteObject = adapter.isRemote(element);
- }
-
- }
-
- public void positionTo(String name)
- {
- ArrayList selectedItems = new ArrayList();
- Table table = getTable();
- int topIndex = 0;
- for (int i = 0; i < table.getItemCount(); i++)
- {
- TableItem item = table.getItem(i);
- Object data = item.getData();
- if (data instanceof IAdaptable)
- {
- ISystemViewElementAdapter adapter = getViewAdapter(data);
- String itemName = adapter.getName(data);
-
- if (StringCompare.compare(name, itemName, false))
- {
- if (topIndex == 0)
- {
- topIndex = i;
- }
- selectedItems.add(item);
- }
- }
- }
-
- if (selectedItems.size() > 0)
- {
- TableItem[] tItems = new TableItem[selectedItems.size()];
- for (int i = 0; i < selectedItems.size(); i++)
- {
- tItems[i] = (TableItem) selectedItems.get(i);
- }
-
- table.setSelection(tItems);
- table.setTopIndex(topIndex);
- setSelection(getSelection(), true);
- }
- }
-
- void handleKeyPressed(KeyEvent event)
- {
- //System.out.println("Key Pressed");
- //System.out.println("...event character : " + event.character + ", "+(int)event.character);
- //System.out.println("...event state mask: " + event.stateMask);
- //System.out.println("...CTRL : " + SWT.CTRL);
- if ((event.character == SWT.DEL) && (event.stateMask == 0) && (((IStructuredSelection) getSelection()).size() > 0))
- {
- scanSelections();
- /* DKM - 53694
- if (showDelete() && canDelete())
- {
- SystemCommonDeleteAction dltAction = (SystemCommonDeleteAction) getDeleteAction();
- dltAction.setShell(getShell());
- dltAction.setSelection(getSelection());
- dltAction.setViewer(this);
- dltAction.run();
- }
- */
- }
- }
-
- /**
- * Display a message/status on the message/status line
- */
- public void displayMessage(String msg)
- {
- if (_messageLine != null)
- _messageLine.setMessage(msg);
- }
- /**
- * Clear message/status shown on the message/status line
- */
- public void clearMessage()
- {
- if (_messageLine != null)
- _messageLine.clearMessage();
- }
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java
deleted file mode 100644
index e5084f3ee..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableViewProvider.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * David McKnight (IBM) - [216161] table view needs to handle context when filter reference is input
- * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.view;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.filters.ISystemFilterReference;
-import org.eclipse.rse.core.model.ISystemContainer;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.view.SystemViewPromptableAdapter;
-import org.eclipse.rse.internal.ui.view.SystemViewRootInputAdapter;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
-
-
-/**
- * This is the content and label provider for the SystemTableView. This class is
- * used both to populate the SystemTableView but also to resolve the icon and
- * labels for the cells in the table.
- *
- * @since 3.0 Moved from internal to API
- */
-public class SystemTableViewProvider implements ILabelProvider, ITableLabelProvider, ITreeContentProvider
-{
-
-
- private ListenerList listeners = new ListenerList(1);
-
- protected Object[] _lastResults = null;
- protected Object _lastObject = null;
- protected SimpleDateFormat _dateFormat = new SimpleDateFormat();
- protected Viewer _viewer = null;
- protected int _maxCharsInColumnZero = 0;
-
- /**
- * The cache of images that have been dispensed by this provider.
- * Maps ImageDescriptor->Image.
- */
- private Map imageTable = new Hashtable(40);
- private ISystemTableViewColumnManager _columnManager;
- private HashMap cache;
- /**
- * Constructor for table view provider where a column manager is present.
- * In this case, the columns are customizable by the user.
- * @param columnManager
- */
- public SystemTableViewProvider(ISystemTableViewColumnManager columnManager)
- {
- super();
- _columnManager= columnManager;
- cache = new HashMap();
- }
-
- /**
- * Constructor for table view provider where a column manager is not present.
- * In this case, the column can not be customized.
- */
- public SystemTableViewProvider()
- {
- super();
- _columnManager= null;
- }
-
-
- public void inputChanged(Viewer visualPart, Object oldInput, Object newInput)
- {
- _viewer = visualPart;
- }
-
-
-
-
-
-
- public boolean isDeleted(Object element)
- {
- return false;
- }
-
- public Object[] getChildren(Object object)
- {
- return getElements(object);
- }
-
- public Object getParent(Object object)
- {
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- return adapter.getParent(object);
- return null;
- }
-
- public boolean hasChildren(Object object)
- {
- return false;
- }
-
- public Object getElementAt(Object object, int i)
- {
-
- return null;
- }
-
- protected ISystemViewElementAdapter getAdapterFor(Object object)
- {
- ISystemViewElementAdapter result = null;
- if (_viewer != null)
- {
- result = SystemAdapterHelpers.getViewAdapter(object, _viewer);
- }
- else
- {
- result = SystemAdapterHelpers.getViewAdapter(object);
- }
- if (result != null)
- result.setPropertySourceInput(object);
- return result;
- }
-
- public Object[] getElements(Object object)
- {
- Object[] results = null;
- /*
- if (object == _lastObject && (_lastResults != null && _lastResults.length > 0)
- {
- return _lastResults;
- }
- else
- if (object instanceof IAdaptable)
- */
- {
- ISystemViewElementAdapter adapter = getAdapterFor(object);
- if (adapter != null)
- {
- adapter.setViewer(_viewer);
-
- // do we have context?
- if (object instanceof ISystemFilterReference) {
- ISubSystem ss = adapter.getSubSystem(object);
-
- ContextObject context = new ContextObject(object, ss, (ISystemFilterReference)object);
- results = adapter.getChildren(context, new NullProgressMonitor());
- }
- else {
- results = adapter.getChildren((IAdaptable)object, new NullProgressMonitor());
-
- }
- if (adapter instanceof SystemViewRootInputAdapter)
- {
- ArrayList filterredResults = new ArrayList();
- for (int i = 0; i < results.length; i++)
- {
- Object result = results[i];
- ISystemViewElementAdapter cadapter = getAdapterFor(result);
- if (!(cadapter instanceof SystemViewPromptableAdapter))
- {
- filterredResults.add(result);
- }
- }
- results = filterredResults.toArray();
- }
-
- _lastResults = results;
- _lastObject = object;
- }
- }
- if (results == null)
- {
- return new Object[0];
- }
-
- return results;
- }
-
- public String getText(Object object)
- {
- String result = getAdapterFor(object).getText(object);
- int len = result.length();
- if (len > _maxCharsInColumnZero)
- {
- _maxCharsInColumnZero = len;
- }
- return result;
- }
-
- public int getMaxCharsInColumnZero()
- {
- return _maxCharsInColumnZero;
- }
-
- public Image getImage(Object object)
- {
- ImageDescriptor descriptor = getAdapterFor(object).getImageDescriptor(object);
-
- Image image = null;
- if (descriptor != null)
- {
- Object iobj = imageTable.get(descriptor);
- if (iobj == null)
- {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- else
- {
- image = (Image) iobj;
- }
- }
- return image;
- }
-
- public String getColumnText(Object obj, int index)
- {
- if (index == 0)
- {
- // get the first descriptor
- return getText(obj);
- }
- else
- {
-
- index = index - 1;
- ISystemViewElementAdapter adapter = getAdapterFor(obj);
-
- IPropertyDescriptor[] descriptors = null;
- if (_columnManager != null)
- {
- descriptors = _columnManager.getVisibleDescriptors(adapter);
- }
- else
- {
- descriptors = adapter.getUniquePropertyDescriptors();
- }
-
- if (descriptors.length > index)
- {
- IPropertyDescriptor descriptor = descriptors[index];
-
- try
- {
- Object key = descriptor.getId();
-
- Object propertyValue = adapter.getPropertyValue(key);
-
- if (propertyValue instanceof String)
- {
- return (String) propertyValue;
- }
- else if (propertyValue instanceof Date)
- {
- return _dateFormat.format((Date)propertyValue);
- }
- else
- if (propertyValue != null)
- {
- return propertyValue.toString();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- return ""; //$NON-NLS-1$
- }
-
- }
-
- public Image getColumnImage(Object obj, int i)
- {
- if (i == 0)
- {
- return getImage(obj);
- }
- else
- {
- return null;
- }
- }
-
- public void addListener(ILabelProviderListener listener)
- {
- listeners.add(listener);
- }
-
- public boolean isLabelProperty(Object element, String property)
- {
- return true;
- }
-
- public void removeListener(ILabelProviderListener listener)
- {
- listeners.remove(listener);
- }
-
- /**
- * Cache the objects for the given parent.
- * @param parent the parent object.
- * @param children the children to cache.
- */
- public void setCachedObjects(Object parent, Object[] children) {
- cache.put(parent, children);
- }
-
- /**
- * Returns the cached objects for the given parent.
- * @param parent the parent object.
- * @return the cached children.
- */
- public Object[] getCachedObjects(Object parent) {
- return (Object[])(cache.get(parent));
- }
-
-
- public void setCache(Object[] newCache)
- {
- _lastResults = newCache;
- }
-
- public Object[] getCache()
- {
- return _lastResults;
- }
-
- public boolean flushCache()
- {
- if (_lastResults == null)
- {
- return false;
- }
- if (_lastObject instanceof ISystemContainer)
- {
- // ((ISystemContainer)_lastObject).markStale(true);
- }
-
- _lastResults = null;
- return true;
- }
-
- public void dispose()
- {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/EnvironmentVariablesForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/EnvironmentVariablesForm.java
deleted file mode 100644
index e68738194..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/EnvironmentVariablesForm.java
+++ /dev/null
@@ -1,610 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import java.util.Collection;
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.dialogs.EnvironmentVariablesPromptDialog;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-
-/**
- * Preference page which allows the user to manage persisted environment
- * variables for an RSE connection.
- */
-public class EnvironmentVariablesForm extends SystemBaseForm implements SelectionListener, MouseListener {
-
-
- // constants
- private static final String VAR_NAME = "NAME"; //$NON-NLS-1$
- private static final String VAR_VALUE = "VALUE"; //$NON-NLS-1$
- private static final String[] COLUMN_PROPERTIES = {VAR_NAME, VAR_VALUE};
-
- // instance variables
- private Table envVarTable;
- private Vector envVars;
- private EnvironmentVariablesTableContentProvider provider;
- private Object selectedObject;
- private TableViewer envVarTableViewer;
- private IRSESystemType systemType;
- private String invalidNameChars;
-
- private Button addButton, changeButton, removeButton, moveUpButton, moveDownButton;
-
- // Temporary class for storing environment variable information
- // until we pass it to the commands subsystem.
- public class EnvironmentVariable {
- protected String _name;
- protected String _value;
-
- public EnvironmentVariable(String name, String value)
- {
- _name = name;
- _value = value;
- }
-
- public String getName() { return _name;}
- public String getValue() { return _value;}
- public void setName(String name) {_name = name;}
- public void setValue(String value) { _value = value;}
- }
-
- protected class EnvironmentVariablesTableContentProvider implements IStructuredContentProvider,
- ITableLabelProvider,
- ICellModifier, ICellEditorValidator
- {
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object inputElement) {
- return envVars.toArray();
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex == 0) {
- return ((EnvironmentVariable) element).getName();
- } else {
- return ((EnvironmentVariable) element).getValue();
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(Object, String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /**
- * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
- // yantzi:2.1.2 Added ability to directly edit in env var table
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
- */
- public boolean canModify(Object element, String property) {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
- */
- public Object getValue(Object element, String property) {
- if (VAR_NAME.equals(property))
- {
- return ((EnvironmentVariable) element).getName();
- }
- else // VAR_VALUE
- {
- return ((EnvironmentVariable) element).getValue();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
- */
- public void modify(Object element, String property, Object value) {
- if (VAR_NAME.equals(property))
- {
- SystemMessage msg = validateName((String)value);
- if (msg != null)
- {
- getMessageLine().setErrorMessage(msg);
- }
- else
- {
- if (invalidNameChars != null && invalidNameChars.indexOf(' ') != -1)
- {
- ((EnvironmentVariable) ((TableItem)element).getData()).setName(((String) value).trim());
- }
- else
- {
- ((EnvironmentVariable) ((TableItem)element).getData()).setName((String) value);
- }
- getMessageLine().clearErrorMessage();
- }
- }
- else
- {
- ((EnvironmentVariable) ((TableItem)element).getData()).setValue((String) value);
- }
-
- envVarTableViewer.refresh();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ICellEditorValidator#isValid(java.lang.Object)
- */
- public String isValid(Object value)
- {
- SystemMessage msg = validateName((String) value);
- if (msg != null)
- {
- getMessageLine().setErrorMessage(msg);
- }
- else
- {
- getMessageLine().clearErrorMessage();
- }
-
- // always return null because we handle displaying the error message
- return null;
- }
-
- }
-
- /**
- * Constructor for EnvironmentVariablesForm.
- * @param msgLine
- */
- public EnvironmentVariablesForm(Shell shell, ISystemMessageLine msgLine, Object selectedObject, String invalidNameChars) {
- super(shell, msgLine);
- this.selectedObject = selectedObject;
- this.invalidNameChars = invalidNameChars;
- envVars = new Vector();
- provider = new EnvironmentVariablesTableContentProvider();
-
- if (selectedObject instanceof ISubSystem)
- {
- systemType = ((ISubSystem) selectedObject).getHost().getSystemType();
- }
-
- }
-
- /**
- * @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite)
- */
- public Control createContents(Composite parent) {
-
- SystemWidgetHelpers.createLabel(parent, SystemResources.RESID_SUBSYSTEM_ENVVAR_DESCRIPTION);
-
- // Environment Variables List
- envVarTable = new Table(parent, SWT.FULL_SELECTION |SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- envVarTable.setLinesVisible(true);
- envVarTable.setHeaderVisible(true);
- envVarTable.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_TOOLTIP);
- envVarTable.addSelectionListener(this);
- envVarTable.addMouseListener(this);
-
- TableLayout tableLayout = new TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(100, true));
- tableLayout.addColumnData(new ColumnWeightData(100, true));
- envVarTable.setLayout(tableLayout);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- gd.heightHint = 200;
- envVarTable.setLayoutData(gd);
-
- // Name column
- TableColumn hostnameColumn = new TableColumn(envVarTable, SWT.NONE);
- hostnameColumn.setText(SystemResources.RESID_SUBSYSTEM_ENVVAR_NAME_TITLE);
-
- // Value column
- TableColumn sysTypeColumn = new TableColumn(envVarTable, SWT.NONE);
- sysTypeColumn.setText(SystemResources.RESID_SUBSYSTEM_ENVVAR_VALUE_TITLE);
-
- envVarTableViewer = new TableViewer(envVarTable);
- envVarTableViewer.setContentProvider(provider);
- envVarTableViewer.setLabelProvider(provider);
-
- // yantzi:2.1.2 Added ability to directly edit in env var table
- envVarTableViewer.setCellModifier(provider);
- envVarTableViewer.setColumnProperties(COLUMN_PROPERTIES);
-
- CellEditor[] cellEditors = new CellEditor[2];
- cellEditors[0] = new TextCellEditor(envVarTable);
- cellEditors[0].setValidator(provider);
- cellEditors[1] = new TextCellEditor(envVarTable);
- envVarTableViewer.setCellEditors(cellEditors);
-
- envVarTableViewer.setInput(selectedObject);
-
- // Create the buttons for add, change, remove, move up and move down
- Composite buttonBar = SystemWidgetHelpers.createComposite(parent, 5);
-
- addButton = SystemWidgetHelpers.createPushButton(buttonBar, SystemResources.RESID_PREF_SIGNON_ADD_LABEL, null);
- addButton.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_ADD_TOOLTIP);
- addButton.addSelectionListener(this);
-
- changeButton = SystemWidgetHelpers.createPushButton(buttonBar, SystemResources.RESID_PREF_SIGNON_CHANGE_LABEL, null);
- changeButton.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_CHANGE_TOOLTIP);
- changeButton.addSelectionListener(this);
- changeButton.setEnabled(false);
-
- removeButton = SystemWidgetHelpers.createPushButton(buttonBar, SystemResources.RESID_PREF_SIGNON_REMOVE_LABEL, null);
- removeButton.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_REMOVE_TOOLTIP);
- removeButton.addSelectionListener(this);
- removeButton.setEnabled(false);
-
- moveUpButton = SystemWidgetHelpers.createPushButton(buttonBar, SystemResources.RESID_SUBSYSTEM_ENVVAR_MOVEUP_LABEL, null);
- moveUpButton.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_MOVEUP_TOOLTIP);
- moveUpButton.addSelectionListener(this);
- moveUpButton.setEnabled(false);
-
- moveDownButton = SystemWidgetHelpers.createPushButton(buttonBar, SystemResources.RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_LABEL, null);
- moveDownButton.setToolTipText(SystemResources.RESID_SUBSYSTEM_ENVVAR_MOVEDOWN_TOOLTIP);
- moveDownButton.addSelectionListener(this);
- moveDownButton.setEnabled(false);
-
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "envv0000"); //$NON-NLS-1$
-
- return parent;
- }
-
- /**
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- /**
- * Helper method for retrieving the list of existing environment variable names
- */
- private String[] getVariableNames()
- {
- String[] existingNames = new String[envVars.size()];
- for (int i = 0; i < envVars.size(); i++)
- {
- existingNames[i] = ((EnvironmentVariable) envVars.get(i))._name;
- }
-
- return existingNames;
- }
-
- /**
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
-
- if (e.getSource() == addButton)
- {
- // Prompt the user for the new environment variable
- EnvironmentVariablesPromptDialog dialog =
- new EnvironmentVariablesPromptDialog(
- getShell(),
- SystemResources.RESID_SUBSYSTEM_ENVVAR_ADD_TITLE,
- systemType,
- invalidNameChars,
- getVariableNames(),
- false);
-
- if (dialog.open() == Window.OK) {
- // Add new variable to model
- EnvironmentVariable var = new EnvironmentVariable(dialog.getName(), dialog.getValue());
- envVars.add(var);
- envVarTableViewer.refresh();
-
- //dy defect 47040 position table so new variable is shown
- envVarTableViewer.reveal(var);
- }
- }
- else if (e.getSource() == removeButton)
- {
- int[] selections = envVarTable.getSelectionIndices();
- if (selections != null && selections.length > 0) {
- for (int loop = selections.length - 1; loop >= 0; loop--) {
- envVars.remove(selections[loop]);
- }
- envVarTableViewer.refresh();
- }
- }
- else if (e.getSource() == changeButton)
- {
- changeCurrentlySelectedVariable();
- }
- else if (e.getSource() == moveUpButton)
- {
- int[] selections = envVarTable.getSelectionIndices();
- envVarTable.deselectAll();
-
- if (selections != null) {
- // Move the selected objects up one position in the table
- Object temp;
- for (int loop=0; loop < selections.length; loop++) {
- temp = envVars.remove(selections[loop]);
- envVars.add(selections[loop] - 1, temp);
- }
-
- envVarTableViewer.refresh();
-
- //dy defect 47040 position table so top variable is shown
- envVarTableViewer.reveal(envVars.get(selections[0] - 1));
-
- // Reselect the entries
- for (int loop=0; loop < selections.length; loop++) {
- if (selections[loop] > 0)
- envVarTable.select(selections[loop] - 1);
- else
- envVarTable.select(selections[loop]);
- }
- }
- }
- else if (e.getSource() == moveDownButton)
- {
- int[] selections = envVarTable.getSelectionIndices();
- envVarTable.deselectAll();
-
- // move the selected entries down one position in the table
- if (selections != null) {
- Object temp;
- for (int loop=selections.length - 1; loop >= 0; loop--) {
- if (selections[loop] < envVars.size() - 1) {
- temp = envVars.remove(selections[loop]);
- envVars.add(selections[loop] + 1, temp);
- }
- }
-
- envVarTableViewer.refresh();
-
- //dy defect 47040 position table so bottom variable is shown
- envVarTableViewer.reveal(envVars.get(selections[selections.length - 1] + 1));
-
- // reselect the entries
- for (int loop=0; loop < selections.length; loop++) {
- if (selections[loop] < envVars.size() - 1)
- envVarTable.select(selections[loop] + 1);
- else
- envVarTable.select(selections[loop]);
- }
- }
- }
-
- // Update table buttons based on changes
- if (envVarTable.getSelectionCount() == 0) {
- changeButton.setEnabled(false);
- removeButton.setEnabled(false);
- moveUpButton.setEnabled(false);
- moveDownButton.setEnabled(false);
- } else {
- int[] selectionIndices = envVarTable.getSelectionIndices();
- boolean upEnabled = true;
- boolean downEnabled = true;
- for (int loop = 0; loop < selectionIndices.length; loop++) {
- if (selectionIndices[loop] == 0)
- upEnabled = false;
-
- if (selectionIndices[loop] == (envVarTable.getItemCount() - 1))
- downEnabled = false;
- }
-
- if (selectionIndices.length == 1)
- {
- changeButton.setEnabled(true);
- }
- else
- {
- changeButton.setEnabled(false);
- }
- removeButton.setEnabled(true);
- moveUpButton.setEnabled(upEnabled);
- moveDownButton.setEnabled(downEnabled);
- }
-
- }
-
- /**
- * Get the environment variables currently in the table.
- */
- public Collection getEnvVars()
- {
- return envVars;
- }
-
- /**
- * Set the input for the environment variables table
- */
- public void setEnvVars(Vector envVars)
- {
- this.envVars = envVars;
- if (envVarTableViewer != null)
- {
- envVarTableViewer.refresh();
- }
- }
-
- /**
- * Helper method so the same code can be run when the user selets the chagne button or
- * double clicks in the table.
- */
- private void changeCurrentlySelectedVariable()
- {
- int[] selections = envVarTable.getSelectionIndices();
- if (selections != null && selections.length == 1)
- {
- EnvironmentVariablesPromptDialog dialog = new
- EnvironmentVariablesPromptDialog(
- getShell(),
- SystemResources.RESID_SUBSYSTEM_ENVVAR_CHANGE_TITLE,
- systemType,
- invalidNameChars,
- getVariableNames(),
- true);
- dialog.setName(((EnvironmentVariable)envVars.get(selections[0])).getName());
- dialog.setValue(((EnvironmentVariable)envVars.get(selections[0])).getValue());
-
- if (dialog.open() == Window.OK)
- {
- envVars.remove(selections[0]);
- envVars.add(selections[0], new EnvironmentVariable(dialog.getName(), dialog.getValue()));
- envVarTableViewer.refresh();
- }
- }
- }
-
- /**
- * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e)
- {
- // Shortcut for change
- changeCurrentlySelectedVariable();
- }
-
- /**
- * @see org.eclipse.swt.events.MouseListener#mouseDown(MouseEvent)
- */
- public void mouseDown(MouseEvent e)
- {
- }
-
- /**
- * @see org.eclipse.swt.events.MouseListener#mouseUp(MouseEvent)
- */
- public void mouseUp(MouseEvent e)
- {
- }
-
- /**
- * validate the environment variable's name
- */
- private SystemMessage validateName(String value)
- {
- SystemMessage msg = null;
- String name = value;
- if (name == null || name.trim().equals("")) //$NON-NLS-1$
- {
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_NONAME);
- }
- else
- {
- if (invalidNameChars != null)
- {
- if (invalidNameChars.indexOf(' ') != -1)
- {
- name = (value).trim();
- }
-
- // first check for invalid characters
- if (invalidNameChars != null)
- {
- for (int i = 0; i < invalidNameChars.length() && msg == null; i++)
- {
- if (name.indexOf(invalidNameChars.charAt(i)) != -1)
- {
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_INVALIDCHAR);
- }
- }
- }
-
- // next check for duplicate env var names
- int numberFound = 0;
- int itemCount = envVarTable.getItemCount();
- for (int i = 0; i < itemCount; i++) {
- TableItem item = envVarTable.getItem(i);
- String itemName = item.getText(0);
- if (itemName.equals(name)) numberFound++;
- }
- if (numberFound > 1) {
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE);
- msg.makeSubstitution(name);
- }
- }
- }
-
- return msg;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/GridUtil.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/GridUtil.java
deleted file mode 100644
index 2b20210a7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/GridUtil.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import org.eclipse.swt.layout.GridData;
-
-/**
- * A utility class to create convenient grid data objects.
- */
-public class GridUtil
-{
- /**
- * GridUtil constructor comment.
- */
- public GridUtil()
- {
- super();
- }
-
- /**
- * Creates a grid data object that occupies vertical and horizontal space.
- */
- static public GridData createFill()
- {
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessVerticalSpace = true;
- return gd;
- }
-
- /**
- * Creates a grid data object that occupies horizontal space.
- */
- static public GridData createHorizontalFill()
- {
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- return gd;
- }
-
- /**
- * Creates a grid data object that occupies vertical space.
- */
- static public GridData createVerticalFill()
- {
- GridData gd = new GridData();
- gd.verticalAlignment = GridData.FILL;
- gd.grabExcessVerticalSpace = true;
- return gd;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IInheritableEntryFieldStateChangeListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IInheritableEntryFieldStateChangeListener.java
deleted file mode 100644
index 21b634a5d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IInheritableEntryFieldStateChangeListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-/**
- * Any listener that wants to be notified of state changes to the inheritable
- * entry field widget must implement this interface.
- */
-public interface IInheritableEntryFieldStateChangeListener {
-
- /**
- * Called when the state of the inheritable field has changed. The new state of the field can be queried by calling
- * <code>isLocal</code> on on the entry field.
- * @param field the inheritable field which has changed state.
- */
- public void stateChanged(InheritableEntryField field);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java
deleted file mode 100644
index 82d086068..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/IServerLauncherForm.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * An interface implemented by server launchers in order to prompt for the
- * properties of that server launcher.
- * @see org.eclipse.rse.core.subsystems.IServerLauncherProperties
- */
-public interface IServerLauncherForm
-{
- /**
- * Create the contents of the form
- */
- public abstract Control createContents(Composite parent);
-
- /*
- * Sets the hostname associated with this form
- */
- public void setHostname(String hostname);
-
- /**
- * Set the initial values for the widgets, based on the server launcher values
- */
- public void initValues(IServerLauncherProperties launcher);
- /**
- * Verify the contents of the widgets, when OK is pressed.
- * Return true if all is well, false if an error found.
- */
- public boolean verify();
- /**
- * Update the actual values in the server launcher, from the widgets. Called on successful press of OK.
- * @return true if all went well, false if something failed for some reason.
- */
- public boolean updateValues(IServerLauncherProperties launcher);
-
- /**
- * Returns whether anything has changed in the server launcher form.
- * @return <code>true</code> if the server launcher form has changed, <code>false</code> otherwise.
- */
- public boolean isDirty();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java
deleted file mode 100644
index f1bfcfce2..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemAddListener.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import org.eclipse.rse.core.model.IHost;
-/**
- * This is an interface used by the AS400SelectFieldForm, AS400SelectFieldDialog and
- * AS400SelectFieldAction classes to enable the caller to be informed when the user
- * presses the Add button for the selected field.
- * <p>
- * If you call the enableAddButton method you must pass an object that implements this interface.
- * The dialog will call you back when the user presses the Add button, so you can take
- * appropriate action.
- */
-public interface ISystemAddListener
-{
-
-
- /**
- * The user has pressed the Add button.
- * Do something appropriate with the request.
- * If this action fails for some reason, or you wish to display a completion
- * message, return message text that will be displayed in the dialog's message
- * line. Else, return null.
- */
- public String addButtonPressed(IHost selectedConnection, Object selectedObject);
- /**
- * The user has selected an object. Is this field valid to be added?
- * If so, return null. If not, return a string to display on the
- * message line indicating why it is not valid, such as it already has
- * been added
- */
- public String okToEnableAddButton(IHost selectedConnection, Object selectedObject);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java
deleted file mode 100644
index e49ad13ff..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCollapsableSectionListener.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-/**
- * Listener for collapse / expand events on the SystemCollapsableSection widget.
- */
-public interface ISystemCollapsableSectionListener {
-
-
- /**
- * Notifies listeners of a section collapsed or expanded.
- */
- public void sectionCollapsed(boolean collapsed);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java
deleted file mode 100644
index f5b629ed9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemCombo.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Combo;
-
-
-/**
- * We have a number of composite widgets that include a combo-box. This
- * interface enforces some common methods on all of them to make it easier
- * to code to this in a consistent manner.
- */
-public interface ISystemCombo
-{
-
-
-
- /**
- * Return the embedded combo box widget
- */
- public Combo getCombo();
- /**
- * Set auto-uppercase. When enabled, all non-quoted values are uppercased when appropriate
- */
- public void setAutoUpperCase(boolean enable);
- /**
- * Set the width hint for the combo box widget (in pixels).
- * A rule of thumb is 10 pixels per character, but allow 15 for the litte button on the right.
- * You must call this versus setting it yourself, else you may see truncation.
- */
- public void setWidthHint(int widthHint);
- /**
- * Query the combo field's current contents
- */
- public String getText();
- /**
- * Disable/Enable all the child controls
- */
- public void setEnabled(boolean enabled);
- /**
- * Set the tooltip text for the combo field
- */
- public void setToolTipText(String tip);
- /**
- * Set the tooltip text for the history button
- */
- public void setButtonToolTipText(String tip);
- /**
- * Set the focus to the combo field
- */
- public boolean setFocus();
- /**
- * Select the combo dropdown list entry at the given index
- */
- public void select(int selIdx);
- /**
- * Same as {@link #select(int)}
- */
- public void setSelectionIndex(int selIdx);
- /**
- * Clear the entered/selected contents of the combo box. Clears the text selection and the list selection
- */
- public void clearSelection();
- /**
- * Clear the entered/selected contents of the combo box. Clears only the text selection, not the list selection
- */
- public void clearTextSelection();
- /**
- * Get the index number of the currently selected item.
- */
- public int getSelectionIndex();
- /**
- * Register a listener interested in an item is selected in the combo box
- * @see #removeSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener);
- /**
- * Remove a previously set combo box selection listener.
- * @see #addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener);
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java
deleted file mode 100644
index 4a8171caf..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/ISystemEditPaneStates.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-/**
- * @author coulthar
- *
- * This interfaces defines the constants for the modes and states
- * of the {@link org.eclipse.rse.ui.widgets.SystemEditPaneStateMachine}
- * class.
- */
-public interface ISystemEditPaneStates
-{
-
- /**
- * MODE - UNSET. Nothing is selected so overall edit pane is hidden/disabled
- */
- public static final int MODE_UNSET = 2;
- /**
- * MODE - NEW. The user is creating a "new" thing
- */
- public static final int MODE_NEW = 4;
- /**
- * MODE - EDIT. The user is editing an existing thing
- */
- public static final int MODE_EDIT = 8;
-
- /**
- * STATE - NO CHANGES. No changes have been made by the user
- */
- public static final int STATE_INITIAL = 128;
- /**
- * STATE - CHANGES PENDING. User has made changes but they haven't been applied yet
- */
- public static final int STATE_PENDING = 256;
- /**
- * STATE - CHANGES MADE. User has made changes and applied them. None pending
- */
- public static final int STATE_APPLIED = 512;
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java
deleted file mode 100644
index 2083d9ea8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritButton.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [226561] Add API markup for noextend / noimplement where needed
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-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.Display;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * An InheritButton is a specialized control that
- * wraps a push button control with two states:
- * "inherit" and "local". The initial state is "inherit". The button is
- * painted with arrowhead image that points either left or right if the
- * button is in "inherit" or "local" state respectively.
- * <p>
- * Pressing the button will trigger a SelectionEvent which the client
- * can listen for. Typically the client will use this to change the
- * button state.
- * <p>
- * An InheritButton is assumed to exist inside a composite control with a GridLayout.
- * There is no need to set its layout data unless you wish to override the
- * default characteristics.
- * <p>
- * Although this control extends Composite, it does not make sense to
- * add children to this control or to set a layout on it.
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class InheritButton extends Composite {
-
- /**
- * Value is 12 pixels.
- */
- public static final int DEFAULT_WIDTH = 12;
-
- /**
- * Value is 20 pixels.
- */
- public static final int DEFAULT_HEIGHT = 20;
-
- private Image leftArrow = null; // arrow points left, value is inherited
- private Image rightArrow = null; // arrow points right, value is the local value
- private boolean isLocal = false; // default is "inherit"
- private Button toggle = null;
- private boolean isDrawn = false; // button is to be drawn or use arrow implementation
-
- /**
- * Create a new InheritButton.
- * @param parent the composite owning this button
- */
- public InheritButton(Composite parent) {
- super(parent, SWT.NONE);
- isDrawn = System.getProperty("os.name").toLowerCase().startsWith("win"); //$NON-NLS-1$ //$NON-NLS-2$
- GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, false);
- data.widthHint = DEFAULT_WIDTH;
- data.heightHint = DEFAULT_HEIGHT;
- setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- setLayout(layout);
- initializeToggle(this);
- }
-
- private void initializeToggle(Composite parent) {
- if (isDrawn) {
- toggle = new Button(parent, SWT.PUSH );
- createToggleImages(toggle.getBackground());
- toggle.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- disposeToggleImages();
- }
- });
- } else {
- toggle = new Button(parent, SWT.ARROW );
- }
- toggle.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
- e.result = ""; //$NON-NLS-1$
- }
- public void getName(AccessibleEvent e) { // this is the one that apparently does supply the text heard.
- e.result = toggle.getToolTipText();
- String prefix = null;
- Composite parent = toggle.getParent();
- while (parent != null && prefix == null) {
- if (parent instanceof Group) {
- Group group = (Group) parent;
- prefix = group.getText();
- }
- parent = parent.getParent();
- }
- if (prefix != null) {
- e.result = prefix + " " + e.result; //$NON-NLS-1$
- }
- }
- });
- toggle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setToggleImage();
- }
-
- /**
- * Set the inherit/local state.
- * In the "local" state, the arrow image points to the right.
- * In the "inherit" state, the arrow image points to the left.
- * @param isLocal true if the button should be in "local" state. false if the
- * button should be in "inherit" state.
- */
- public void setLocal(boolean isLocal) {
- this.isLocal = isLocal;
- setToggleImage();
- }
-
- /**
- * Query the inherit/local state.
- * @return true if the button is in local state
- */
- public boolean isLocal() {
- return isLocal;
- }
-
- /**
- * Register a listener interested in when the button is pressed.
- * <p>
- * @see InheritButton#removeSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener) {
- if (toggle == null) return;
- toggle.addSelectionListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Control#addKeyListener(org.eclipse.swt.events.KeyListener)
- */
- public void addKeyListener(KeyListener listener) {
- if (toggle == null) return;
- toggle.addKeyListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Control#removeKeyListener(org.eclipse.swt.events.KeyListener)
- */
- public void removeKeyListener(KeyListener listener) {
- if (toggle == null) return;
- toggle.removeKeyListener(listener);
- }
-
- /**
- * Remove a previously set selection listener.
- * @see InheritButton#addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener) {
- if (toggle == null) return;
- toggle.removeSelectionListener(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Control#setFocus()
- */
- public boolean setFocus() {
- return toggle.setFocus();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Control#isFocusControl()
- */
- public boolean isFocusControl() {
- return toggle.isFocusControl();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Control#setToolTipText(java.lang.String)
- */
- public void setToolTipText(String string) {
- toggle.setToolTipText(string);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.widgets.Control#getToolTipText()
- */
- public String getToolTipText() {
- return toggle.getToolTipText();
- }
-
- /**
- * Places the correct graphic on the button depending on the current
- * button state.
- * In the "local" state, the arrow image points to the right.
- * In the "inherit" state, the arrow image points to the left.
- */
- private void setToggleImage() {
- if (isDrawn) {
- toggle.setImage(isLocal ? rightArrow : leftArrow);
- } else {
- int alignment = isLocal ? SWT.RIGHT : SWT.LEFT;
- toggle.setAlignment(alignment);
- }
- }
-
- /**
- * Creates the images used for the button graphics. This should be done
- * when the button is created.
- * @param backgroundColor The background color with which the arrow images
- * should be painted. The foreground color is black.
- */
- private void createToggleImages(Color backgroundColor) {
- Display display = Display.getCurrent();
- GC gc = null;
- if (display != null) {
- leftArrow = new Image(display, 3, 5);
- gc = new GC(leftArrow);
- gc.setBackground(backgroundColor);
- gc.fillRectangle(leftArrow.getBounds());
- gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.drawLine(0, 2, 0, 2);
- gc.drawLine(1, 1, 1, 3);
- gc.drawLine(2, 0, 2, 4);
- gc.dispose();
- rightArrow = new Image(display, 3, 5);
- gc = new GC(rightArrow);
- gc.setBackground(backgroundColor);
- gc.fillRectangle(rightArrow.getBounds());
- gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.drawLine(0, 0, 0, 4);
- gc.drawLine(1, 1, 1, 3);
- gc.drawLine(2, 2, 2, 2);
- gc.dispose();
- }
- }
-
- /**
- * Dispose of the images used for the arrow graphics. Should be invoked
- * when the button is disposed.
- */
- private void disposeToggleImages() {
- if (leftArrow != null) leftArrow.dispose();
- if (rightArrow != null) rightArrow.dispose();
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java
deleted file mode 100644
index 0756c631d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControl.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.TypedListener;
-
-/**
- * A widget like the old ET/400 inherit/override widget.
- * There are left and right arrows beside each other.
- * Typically, clicking on left means to inherit from parent,
- * clicking on right means to override locally.
- * However, the control can be used for any binary decision!
- * THIS IS NOT USED AND NOT WORKING. USE INHERITABLEENTRYFIELD INSTEAD
- *
- * @deprecated
- * @see org.eclipse.rse.ui.widgets.InheritableEntryField
- */
-public class InheritControl
- extends Composite
-{
- private Image local,interim,inherit;
- private Button button;
- private boolean isLocal=false;
- /**
- * Constructor.
- * @param parent Composite to place this widget into
- * @param style Widget style. Passed on to
- * {@link org.eclipse.swt.widgets.Composite#Composite(org.eclipse.swt.widgets.Composite, int) constructor} of parent class Composite
- */
- public InheritControl(Composite parent, int style)
- {
- super(parent, style);
- setLayout(new InheritControlLayout());
- //Class c = InheritControl.class;
- //String imagePath = "icons" + java.io.File.separatorChar;
- //RSEUIPlugin sp = RSEUIPlugin.getDefault();
- try
- {
- //ImageData source = new ImageData(c.getResourceAsStream (imagePath+"local.gif"));
- /*
- Image image = sp.getImage(ISystemConstants.ICON_INHERITWIDGET_LOCAL_ID);
- ImageData source = image.getImageData();
- ImageData mask = source.getTransparencyMask();
- //local = new Image (null, source, mask);
- local = image;
-
- image = sp.getImage(ISystemConstants.ICON_INHERITWIDGET_INHERIT_ID);
- source = image.getImageData();
- //source = new ImageData(c.getResourceAsStream (imagePath+"inherit.gif"));
- mask = source.getTransparencyMask();
- //inherit = new Image (null, source, mask);
- inherit = image;
-
- // don't know how to add third state, and don't really
- // need it for Button. Could use it if we implement as Label ....
- //source = new ImageData(c.getResourceAsStream (imagePath+"interim.gif"));
- image = sp.getImage(ISystemConstants.ICON_INHERITWIDGET_INTERIM_ID);
- source = image.getImageData();
- mask = source.getTransparencyMask();
- //interim = new Image (null, source, mask);
- interim = image;
- */
- } catch (Throwable ex)
- {
- System.out.println ("failed to load images"); //$NON-NLS-1$
- ex.printStackTrace();
- }
- button=new Button(this,style);
- setLocal(true);
- addDisposeListener(new DisposeListener()
- {
- public void widgetDisposed(DisposeEvent e)
- {
- // dispose of created resources!
- InheritControl.this.widgetDisposed(e);
- }
- });
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- setLocal(!isLocal());
- notifyListeners(SWT.Selection, new Event());
- }
- };
- button.addSelectionListener(selectionListener);
- }
- /**
- * Add a listener that is called whenever the left or right side is selected.
- * <p>
- * Call {@link #isLocal()} to determine if left (false) or right (true) was pressed.
- * @see #addSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener)
- {
- addListener(SWT.Selection, new TypedListener(listener));
- }
- /**
- * Returns true if the right-side is selected, false if the left is selected
- */
- public boolean isLocal()
- {
- return isLocal;
- }
- /**
- * Remove a previously set selection listener.
- * @see #addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener)
- {
- removeListener(SWT.Selection, listener);
- }
- /**
- * Programmatically select left (false) or right/local (true) arrow.
- */
- public void setLocal(boolean l)
- {
- isLocal=l;
- button.setImage(isLocal?local:inherit);
- }
- /**
- * Set tooltip text (hover help)
- */
- public void setToolTipText(String tip)
- {
- button.setToolTipText(tip);
- }
- /**
- * Private hook called by system when this widget is disposed.
- */
- public void widgetDisposed(DisposeEvent e)
- {
- if (local!=null)
- local.dispose();
- if (interim!=null)
- interim.dispose();
- if (inherit!=null)
- inherit.dispose();
- }
- /*
- public static void main(String[] args)
- {
- // Example on how to use widget
- final InheritControl c1,c2,c3;
- final Text text1,text2,text3;
- Display display = new Display();
- Shell shell = new Shell();
- GridLayout g=new GridLayout();
- g.numColumns=2;
- shell.setLayout(g);
- c1=new InheritControl(shell,SWT.NULL);
- text1 = new Text (shell, SWT.BORDER);
- c2=new InheritControl(shell,SWT.NULL);
- text2 = new Text (shell, SWT.BORDER);
- c3=new InheritControl(shell,SWT.NULL);
- text3 = new Text (shell, SWT.BORDER);
- Button b1=new Button(shell,SWT.NULL);
- b1.setText("Normal button ....");
- //Add listeners:
- c1.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- text1.setEnabled(c1.isLocal);
- };
- });
- c2.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- text2.setEnabled(c2.isLocal);
- };
- });
- c3.addSelectionListener(new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- text3.setEnabled(c3.isLocal);
- };
- });
- shell.pack();
- shell.open();
- // Event loop
- while (! shell.isDisposed())
- {
- if (! display.readAndDispatch()) display.sleep();
- }
- display.dispose();
- System.exit(0);
- }
- */
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java
deleted file mode 100644
index ca002ff0c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritControlLayout.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Layout;
-
-public class InheritControlLayout extends Layout
-{
- private Point iExtent; // the cached size
-
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean changed)
- {
- Control [] children = composite.getChildren();
- if (changed || (iExtent == null) )
- //iExtent = children[0].computeSize(SWT.DEFAULT, SWT.DEFAULT, false);
- iExtent = children[0].computeSize(wHint, hHint, true);
- return new Point(iExtent.x, iExtent.y);
- }
- protected void layout(Composite composite, boolean changed)
- {
- Control [] children = composite.getChildren();
- if (changed || (iExtent == null) )
- iExtent = children[0].computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- children[0].setBounds(0, 0, iExtent.x, iExtent.y);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java
deleted file mode 100644
index fa4382c1d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/InheritableEntryField.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyListener;
-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.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * This is an entry which allows the user to decide whether to
- * inherit a parent value or type in his own local value.
- * <p>
- * To accomplish this, we create a composite containing a toggle button
- * followed by an entry field.
- * <p>
- * The toggle button has left and right arrows.
- * Typically, an arrow pointing to the left means to inherit from parent,
- * and pointing to the right means to override locally.
- * However, the control can be used for any binary decision!
- * <p>
- * Although this control inherits from Composite it does not make sense to
- * set a layout for it or to add children to it.
- */
-/*
- * dwd: modified for defect 57974 (accessibility problems)
- * Formatted source and organized imports.
- * Removed all references to InheritControl.
- * Changed button from SWT.ARROW to SWT.PUSH. SWT.ARROW buttons are not accessible.
- * Simplified internal call structure complicated by case handling for InheritControl.
- */
-public class InheritableEntryField extends Composite implements KeyListener {
- private InheritButton toggleButton = null;
- private Text entryField = null;
- private String inheritValue = ""; //$NON-NLS-1$
- private String localValue = ""; //$NON-NLS-1$
- private boolean isLocal = true;
- private boolean allowEditOfInherited = false;
- private List listeners;
-
- /**
- * Constructor
- * @param parent The parent composite to hold this widget
- * @param style the SWT style for this widget (eg, SWT.BORDER or SWT.NULL)
- */
- public InheritableEntryField(Composite parent, int style) {
- this(parent, style, SWT.NULL, SWT.SINGLE | SWT.BORDER, true);
- }
-
- /**
- * Constructor when you want to set the style of the toggle button and entry field too.
- * @param parent The parent composite to hold this widget
- * @param style the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)
- * @param buttonStyle the SWT style for the toggle button widget
- * @param textStyle the SWT style for the entry field widget
- */
- public InheritableEntryField(Composite parent, int style, int buttonStyle, int textStyle) {
- this(parent, style, buttonStyle, textStyle, true);
- }
-
- /**
- * Constructor when you want to hide the toggle button
- * @param parent The parent composite to hold this widget
- * @param style the SWT style for this overall widget (eg, SWT.BORDER or SWT.NULL)
- * @param buttonStyle the SWT style for the toggle button widget
- * @param textStyle the SWT style for the entry field widget
- * @param showToggleButton true to show the toggle button, false not to
- */
- public InheritableEntryField(Composite parent, int style, int buttonStyle, int textStyle, boolean showToggleButton) {
- super(parent, style);
-
- // must initialize list of listeners before anything else
- listeners = new Vector();
-
- prepareComposite(2);
- if (showToggleButton) {
- createToggleButton(this, buttonStyle);
- }
- createTextField(this, textStyle);
- setLocal(true); // default state
- }
-
- /**
- * Toggle the inherit/local state.
- * It is important that you have already called setLocalText and setInheritedText
- */
- public void setLocal(boolean local) {
- boolean wasLocal = isLocal;
- isLocal = local;
-
- if (isLocal != wasLocal) {
- notifyStateChangeListeners();
- }
-
- if (isLocal) { // from inherit to local
- if (allowEditOfInherited && !wasLocal) inheritValue = entryField.getText();
- entryField.setEnabled(true);
- entryField.setText(localValue);
- } else { // from local to inherit
- if (wasLocal) // if this is actually a toggle
- localValue = entryField.getText(); // remember what old local value was
- entryField.setText(inheritValue);
- entryField.setEnabled(allowEditOfInherited);
- }
- if (toggleButton != null) {
- toggleButton.setLocal(isLocal);
- }
- }
-
- /**
- * Query the inherit/local state
- */
- public boolean isLocal() {
- return isLocal;
- }
-
- /**
- * Specify if user is allowed to edit the inherited text. Default is false.
- */
- public void setAllowEditingOfInheritedText(boolean allow) {
- allowEditOfInherited = allow;
- }
-
- /**
- * Set the entry field's inherited text value
- */
- public void setInheritedText(String text) {
- if (text == null) text = ""; //$NON-NLS-1$
- this.inheritValue = text;
- }
-
- /**
- * Query the entry field's inherited text value.
- * If widget is in inherit mode, returns entry field contents, else returns cached value
- */
- public String getInheritedText() {
- if (!isLocal)
- return entryField.getText();
- else
- return inheritValue;
- }
-
- /**
- * Set the entry field's local text value
- */
- public void setLocalText(String text) {
- if (text == null) text = ""; //$NON-NLS-1$
- this.localValue = text;
- }
-
- /**
- * Query the entry field's local text value.
- * If widget is in local mode, returns entry field contents, else returns "".
- */
- public String getLocalText() {
- if (isLocal)
- return entryField.getText();
- else
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Query the entry field's current contents, regardless of local/inherit state
- */
- public String getText() {
- return entryField.getText();
- }
-
- /**
- * Return a reference to the entry field
- */
- public Text getTextField() {
- return entryField;
- }
-
- /**
- * Return the toggle button
- */
- public InheritButton getToggleButton() {
- return toggleButton;
- }
-
- /**
- * Disable the toggle. Used when there is no inherited value
- */
- public void setToggleEnabled(boolean enabled) {
- if (toggleButton == null) return;
- toggleButton.setEnabled(enabled);
- }
-
- /**
- * Set the tooltip text for the toggle button
- */
- public void setToggleToolTipText(String tip) {
- if (toggleButton == null) return;
- toggleButton.setToolTipText(tip);
- }
-
- /**
- * Set the tooltip text for the entry field
- */
- public void setTextFieldToolTipText(String tip) {
- entryField.setToolTipText(tip);
- }
-
- /**
- * Set the entry field's text limit
- */
- public void setTextLimit(int limit) {
- entryField.setTextLimit(limit);
- }
-
- /**
- * Set the focus to the toggle button
- */
- public void setToggleButtonFocus() {
- if (toggleButton == null) return;
- toggleButton.setFocus();
- }
-
- /**
- * Set the focus to the entry field
- */
- public void setTextFieldFocus() {
- entryField.setFocus();
- }
-
- /**
- * Register a listener interested in when the button is toggled
- * <p>
- * Call {@link #isLocal()} to determine if left (false) or right (true) was pressed.
- * @see #removeSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener) {
- if (toggleButton == null) return;
- toggleButton.addSelectionListener(listener);
- }
-
- /**
- * Remove a previously set toggle button selection listener.
- * @see #addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener) {
- if (toggleButton == null) return;
- toggleButton.removeSelectionListener(listener);
- }
-
- /**
- * Register a listener interested in entry field modify events
- * <p>
- * @see #removeModifyListener(ModifyListener)
- */
- public void addModifyListener(ModifyListener listener) {
- entryField.addModifyListener(listener);
- }
-
- /**
- * Remove a previously set entry field listener.
- * @see #addModifyListener(ModifyListener)
- */
- public void removeModifyListener(ModifyListener listener) {
- entryField.removeModifyListener(listener);
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
- /**
- * Prepares the given composite control and sets the default layout data.
- * @param numColumns the number of columns in the composite layout.
- */
- protected Composite prepareComposite(int numColumns) {
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- composite.setLayoutData(data);
- return composite;
- }
-
- /**
- * Creates a text field with a given style.
- * @param parent the parent composite.
- * @param textStyle the style of the text field.
- */
- protected void createTextField(Composite parent, int textStyle) {
- entryField = new Text(parent, textStyle);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = 150;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- entryField.setLayoutData(data);
- entryField.addKeyListener(this);
- }
-
- protected void createToggleButton(Composite parent, int buttonStyle) {
- toggleButton = new InheritButton(parent);
- toggleButton.addKeyListener(this);
- toggleButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setLocal(!isLocal());
- }
- });
- }
-
- public void setToggleButtonHeight(int height) {
- if (toggleButton == null) return;
- ((GridData) toggleButton.getLayoutData()).heightHint = height;
- ((GridData) toggleButton.getLayoutData()).grabExcessVerticalSpace = false;
- ((GridData) toggleButton.getLayoutData()).verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- }
-
- public void keyPressed(KeyEvent e) {
- }
-
- public void keyReleased(KeyEvent e) {
- if ((e.stateMask == SWT.CTRL) && (e.keyCode == SWT.ARROW_LEFT) && isLocal()) {
- setLocal(false);
- } else if ((e.stateMask == SWT.CTRL) && (e.keyCode == SWT.ARROW_RIGHT) && !isLocal()) {
- setLocal(true);
- }
- }
-
- /**
- * Adds a state change listener. If the listener was already added, it will not be added again.
- * @param l the listener to add.
- */
- public void addStateChangeListener(IInheritableEntryFieldStateChangeListener l) {
-
- if (!listeners.contains(l)) {
- listeners.add(l);
- }
- }
-
- /**
- * Removes a state change listener.
- * @param l the listener to remove.
- */
- public void removeStateChangeListener(IInheritableEntryFieldStateChangeListener l) {
- listeners.remove(l);
- }
-
- /**
- * Notifies all state change listeners.
- */
- private void notifyStateChangeListeners() {
- Iterator iter = listeners.iterator();
-
- while (iter.hasNext()) {
- IInheritableEntryFieldStateChangeListener listener = (IInheritableEntryFieldStateChangeListener)(iter.next());
- listener.stateChanged(this);
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteBaseServerLauncherForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteBaseServerLauncherForm.java
deleted file mode 100644
index 9c637ad7f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteBaseServerLauncherForm.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - refactoring IConnectorService and ServerLauncher hierarchies
- * Martin Oberhuber (Wind River) - [226364][api][breaking] RemoteBaseServerLauncherForm should not implement RemoteServerLauncherConstants.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.rse.core.subsystems.ServerLaunchType;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.propertypages.ISystemConnectionWizardErrorUpdater;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * Base Remote server launcher form. Extend this to provide a specialized server launcher form
- */
-public abstract class RemoteBaseServerLauncherForm extends SystemBaseForm implements IServerLauncherForm, ISystemConnectionWizardErrorUpdater
-{
- protected String _hostName;
-
- protected ISystemMessageLine _msgLine;
-
- /**
- * Constructor for EnvironmentVariablesForm.
- * @param msgLine
- */
- public RemoteBaseServerLauncherForm(Shell shell, ISystemMessageLine msgLine)
- {
- super(shell, msgLine);
- _msgLine = msgLine;
- }
-
- public abstract void disable();
-
-
- /**
- * @see org.eclipse.rse.ui.SystemBaseForm#createContents(Composite)
- */
- public Control createContents(Composite parent)
- {
- // server lanucher group
- Group group =createGroupControl(parent);
-
- // create launcher type controls
- createLauncherControls(group);
-
- // help
- SystemWidgetHelpers.setCompositeHelp(parent, RSEUIPlugin.HELPPREFIX + "srln0000"); //$NON-NLS-1$
-
- // initialization
- initDefaults();
- return parent;
- }
-
- protected Group createGroupControl(Composite parent)
- {
- return SystemWidgetHelpers.createGroupComposite(
- parent,
- 1,
- SystemResources.RESID_PROP_SERVERLAUNCHER_MEANS);
-
- }
- protected abstract void createLauncherControls(Group group);
- protected abstract ServerLaunchType getLaunchType();
- protected abstract void setLaunchType(ServerLaunchType type);
-
-
-
-
- protected abstract void initDefaults();
-
-
-
- /**
- * Verify page contents on OK.
- * @return true if all went well, false if error found.
- */
- public abstract boolean verify();
-
- /**
- * Update the actual values in the server launcher, from the widgets. Called on successful press of OK.
- * @return true if all went well, false if something failed for some reason.
- */
- public abstract boolean updateValues(IServerLauncherProperties launcher);
-
-
- public void setHostname(String hostname)
- {
- _hostName = hostname;
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteServerLauncherForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteServerLauncherForm.java
deleted file mode 100644
index 796f19458..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/RemoteServerLauncherForm.java
+++ /dev/null
@@ -1,661 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [226364][api][breaking] RemoteBaseServerLauncherForm should not implement RemoteServerLauncherConstants.
- * David McKnight (IBM) - [235577] [dstore][launcher] Number 0 is accepted as valid port number
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import org.eclipse.rse.core.subsystems.IRemoteServerLauncher;
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.rse.core.subsystems.RemoteServerLauncherConstants;
-import org.eclipse.rse.core.subsystems.ServerLaunchType;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.SystemNumericVerifyListener;
-import org.eclipse.rse.ui.validators.ValidatorPortInput;
-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.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Comment goes here
- */
-public class RemoteServerLauncherForm extends RemoteBaseServerLauncherForm
-{
-
- private Button _radioDaemon, _radioRexec, _radioNone, _checkBoxSSL, _checkBoxRexecSSL, _checkBoxAutoDetect;
- private Text _fieldDaemonPort;
- private Label _labelDaemonPort;
-
- private Text _fieldRexecPath, _fieldRexecInvocation, _fieldRexecPort;
- private Label _labelRexecPath, _labelRexecInvocation, _labelRexecPort;
-
- private Composite _daemonControls, _rexecControls, _noneControls;
-
- private ValidatorPortInput _daemonPortValidator;
- private ValidatorPortInput _rexecPortValidator;
-
-
- private ServerLaunchType _origlaunchType;
- private String _origPath;
- private String _origInvocation;
- private int _origRexecPort;
- private int _origDaemonPort;
- private boolean _origUseSSL;
- private boolean _origAutoDetect;
-
- /**
- * Constructor for EnvironmentVariablesForm.
- * @param msgLine
- */
- public RemoteServerLauncherForm(Shell shell, ISystemMessageLine msgLine)
- {
- super(shell, msgLine);
- _daemonPortValidator = new ValidatorPortInput();
- _rexecPortValidator = new ValidatorPortInput();
- }
-
- public boolean isDirty()
- {
- boolean isDirty = _origlaunchType != getLaunchType() ||
- !_origPath.equals(getServerInstallPath()) ||
- !_origInvocation.equals(getServerInvocation()) ||
- _origRexecPort != getREXECPortAsInt() ||
- _origDaemonPort != getDaemonPortAsInt() ||
- _origUseSSL != getUseSSL() ||
- _origAutoDetect != getAutoDetect();
- return isDirty;
- }
-
- public void disable()
- {
- _radioDaemon.setEnabled(false);
- _radioRexec.setEnabled(false);
- _radioNone.setEnabled(false);
- _fieldRexecInvocation.setEnabled(false);
- _fieldRexecPath.setEnabled(false);
- _fieldRexecPort.setEnabled(false);
- _fieldDaemonPort.setEnabled(false);
- _checkBoxSSL.setEnabled(false);
- _checkBoxRexecSSL.setEnabled(false);
- _checkBoxAutoDetect.setEnabled(false);
- }
-
-
-
- protected void createLauncherControls(Group group)
- {
- // daemon controls
- _radioDaemon =
- SystemWidgetHelpers.createRadioButton(
- group,
- SystemResources.RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON,
- this);
- _radioDaemon.setToolTipText(
- SystemResources.RESID_PROP_SERVERLAUNCHER_RADIO_DAEMON_TOOLTIP);
-
- _daemonControls = SystemWidgetHelpers.createComposite(group, 1);
- GridLayout dlayout = new GridLayout();
- dlayout.numColumns = 3;
- GridData ddata = new GridData(GridData.FILL_HORIZONTAL);
- ddata.horizontalIndent = 20;
-
- GridData dd = new GridData();
- dd.widthHint = 30;
- String portRange = " (1-" + ValidatorPortInput.MAXIMUM_PORT_NUMBER + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- _labelDaemonPort =
- SystemWidgetHelpers.createLabel(
- _daemonControls,
- SystemResources.RESID_CONNECTION_DAEMON_PORT_LABEL + portRange);
- _fieldDaemonPort = SystemWidgetHelpers.createTextField(_daemonControls, this);
- _fieldDaemonPort.setToolTipText(SystemResources.RESID_CONNECTION_DAEMON_PORT_TIP);
- _fieldDaemonPort.setLayoutData(dd);
- _fieldDaemonPort.addVerifyListener(new SystemNumericVerifyListener());
- _daemonControls.setLayout(dlayout);
- _daemonControls.setLayoutData(ddata);
-
- // rexec controls
- _radioRexec =
- SystemWidgetHelpers.createRadioButton(
- group,
- SystemResources.RESID_PROP_SERVERLAUNCHER_RADIO_REXEC,
- this);
- _radioRexec.setToolTipText(
- SystemResources.RESID_PROP_SERVERLAUNCHER_RADIO_REXEC_TOOLTIP);
-
- _rexecControls = SystemWidgetHelpers.createComposite(group, 1);
- GridLayout layout = new GridLayout();
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalIndent = 20;
- _labelRexecPath =
- SystemWidgetHelpers.createLabel(
- _rexecControls,
- SystemResources.RESID_PROP_SERVERLAUNCHER_PATH);
- _fieldRexecPath = SystemWidgetHelpers.createTextField(_rexecControls, this);
- _fieldRexecPath.setToolTipText(
- SystemResources.RESID_PROP_SERVERLAUNCHER_PATH_TOOLTIP);
-
- Composite subRexecControls = SystemWidgetHelpers.createComposite(_rexecControls, 1);
- GridLayout l2 = new GridLayout();
- GridData d2 = new GridData(GridData.FILL_HORIZONTAL);
- l2.numColumns = 4;
-
- _labelRexecInvocation =
- SystemWidgetHelpers.createLabel(
- subRexecControls,
- SystemResources.RESID_PROP_SERVERLAUNCHER_INVOCATION);
- _fieldRexecInvocation = SystemWidgetHelpers.createTextField(subRexecControls, this);
- _fieldRexecInvocation.setToolTipText(
- SystemResources.RESID_PROP_SERVERLAUNCHER_INVOCATION_TOOLTIP);
-
- GridData d3 = new GridData();
- d3.widthHint = 30;
-
- _labelRexecPort =
- SystemWidgetHelpers.createLabel(
- subRexecControls,
- SystemResources.RESID_CONNECTION_PORT_LABEL + portRange);
- _fieldRexecPort = SystemWidgetHelpers.createTextField(subRexecControls, this);
- _fieldRexecPort.setToolTipText(SystemResources.RESID_CONNECTION_PORT_TIP);
- _fieldRexecPort.setLayoutData(d3);
- _fieldRexecPort.addVerifyListener(new SystemNumericVerifyListener());
-
- subRexecControls.setLayout(l2);
- subRexecControls.setLayoutData(d2);
-
- _checkBoxAutoDetect = SystemWidgetHelpers.createCheckBox(_rexecControls, SystemResources.RESID_SUBSYSTEM_AUTODETECT_LABEL, this);
- _checkBoxAutoDetect.setToolTipText(SystemResources.RESID_SUBSYSTEM_AUTODETECT_TIP);
- _checkBoxRexecSSL = SystemWidgetHelpers.createCheckBox(_rexecControls, SystemResources.RESID_SUBSYSTEM_SSL_LABEL, this);
- _checkBoxRexecSSL.setToolTipText(SystemResources.RESID_SUBSYSTEM_SSL_TIP);
-
- _rexecControls.setLayout(layout);
- _rexecControls.setLayoutData(data);
-
- // manual controls
- _radioNone =
- SystemWidgetHelpers.createRadioButton(
- group,
- SystemResources.RESID_PROP_SERVERLAUNCHER_RADIO_NONE,
- this);
- _radioNone.setToolTipText(
- SystemResources.RESID_PROP_SERVERLAUNCHER_RADIO_NONE_TOOLTIP);
- _noneControls = SystemWidgetHelpers.createComposite(group, 1);
- GridLayout nlayout = new GridLayout();
- GridData ndata = new GridData(GridData.FILL_HORIZONTAL);
- ndata.horizontalIndent = 20;
- _checkBoxSSL = SystemWidgetHelpers.createCheckBox(_noneControls, SystemResources.RESID_SUBSYSTEM_SSL_LABEL, this);
- _checkBoxSSL.setToolTipText(SystemResources.RESID_SUBSYSTEM_SSL_TIP);
- _noneControls.setLayout(nlayout);
- _noneControls.setLayoutData(ndata);
-
- // help
- SystemWidgetHelpers.setHelp(_radioDaemon, RSEUIPlugin.HELPPREFIX + "srln0001"); //$NON-NLS-1$
- SystemWidgetHelpers.setHelp(_radioRexec, RSEUIPlugin.HELPPREFIX + "srln0002"); //$NON-NLS-1$
- SystemWidgetHelpers.setHelp(_radioNone, RSEUIPlugin.HELPPREFIX + "srln0003"); //$NON-NLS-1$
- SystemWidgetHelpers.setHelp(_fieldRexecPath, RSEUIPlugin.HELPPREFIX + "srln0004"); //$NON-NLS-1$
- SystemWidgetHelpers.setHelp(_fieldRexecInvocation, RSEUIPlugin.HELPPREFIX + "srln0005"); //$NON-NLS-1$
- }
-
- protected void initDefaults()
- {
- _radioDaemon.setSelection(true);
- _fieldDaemonPort.setEnabled(_radioDaemon.getSelection());
- _fieldRexecPath.setEnabled(_radioRexec.getSelection());
- _labelRexecPath.setEnabled(_radioRexec.getSelection());
- _fieldRexecInvocation.setEnabled(_radioRexec.getSelection());
- _labelRexecInvocation.setEnabled(_radioRexec.getSelection());
- _labelRexecPort.setEnabled(_radioRexec.getSelection());
- _fieldRexecPort.setEnabled(_radioRexec.getSelection());
- _checkBoxRexecSSL.setEnabled(_radioRexec.getSelection());
- _checkBoxAutoDetect.setEnabled(_radioRexec.getSelection());
- _checkBoxSSL.setEnabled(_radioNone.getSelection());
-
- _fieldDaemonPort.setText(String.valueOf(RemoteServerLauncherConstants.DEFAULT_DAEMON_PORT));
- _fieldRexecPath.setText(RemoteServerLauncherConstants.DEFAULT_REXEC_PATH);
- _fieldRexecInvocation.setText(RemoteServerLauncherConstants.DEFAULT_REXEC_SCRIPT);
- _fieldRexecPort.setText(String.valueOf(RemoteServerLauncherConstants.DEFAULT_REXEC_PORT));
- }
-
- /**
- * Set the initial values for the widgets, based on the server launcher
- */
- public void initValues(IServerLauncherProperties launcher)
- {
- IRemoteServerLauncher isl = (IRemoteServerLauncher)launcher;
-
- ServerLaunchType type = isl.getServerLaunchType();
- String path = isl.getServerPath();
- String invocation = isl.getServerScript();
- int rexecport = isl.getRexecPort(); // changed from getPortAsInt via d54335
- int daemonPort = isl.getDaemonPort(); // defect 54335
- boolean useSSL = isl.getConnectorService().isUsingSSL();
- boolean autoDetectSSL = isl.getAutoDetectSSL();
-
- // find out if daemon can be launched
- boolean allowDaemon = isl.isEnabledServerLaunchType(ServerLaunchType.DAEMON_LITERAL);
-
- // find out if rexec can be launched
- boolean allowRexec = isl.isEnabledServerLaunchType(ServerLaunchType.REXEC_LITERAL);
-
- // find out if connect to running server should be allowed
- boolean allowNo = isl.isEnabledServerLaunchType(ServerLaunchType.RUNNING_LITERAL);
-
- // enable/disable as appropriate
- setDaemonLaunchEnabled(allowDaemon);
- setRexecLaunchEnabled(allowRexec);
- setNoLaunchEnabled(allowNo);
-
- setLaunchType(type);
-
- setDaemonPort(daemonPort);
- setServerInstallPath(path);
- setServerInvocation(invocation);
- setREXECPort(rexecport);
- setUseSSL(useSSL);
- setAutoDetect(autoDetectSSL);
-
- if (!allowDaemon && !allowRexec && !allowNo) {
- disable();
- }
-
-
- _origlaunchType = getLaunchType();
- _origPath = getServerInstallPath();
- _origInvocation = getServerInvocation();
- _origRexecPort = getREXECPortAsInt();
- _origDaemonPort = getDaemonPortAsInt();
- _origUseSSL = getUseSSL();
- _origAutoDetect = getAutoDetect();
- }
-
- /**
- * Verify page contents on OK.
- * @return true if all went well, false if error found.
- */
- public boolean verify()
- {
- SystemMessage msg = null;
- ServerLaunchType launchType = getLaunchType();
- if (launchType == ServerLaunchType.REXEC_LITERAL)
- {
- String port = getREXECPort();
-
- int portAsInt = 0;
- if (port != null && port.length() > 0){
- try {
- portAsInt = Integer.parseInt(port);
- }
- catch (Exception e){
- portAsInt = 0;
- }
- }
-
- msg = _rexecPortValidator.validate(port);
-
- // for daemons we don't allow 0
- if (msg == null && portAsInt == 0)
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_NOTVALID);
-
- if (msg == null)
- {
- String path = getServerInstallPath();
-
- if (path == null || path.length() == 0)
- {
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_PWD_BLANKFIELD);
- }
-
- if (msg != null)
- {
- _msgLine.setErrorMessage(msg.getLevelOneText());
- }
- else
- {
- _msgLine.clearErrorMessage();
- }
- }
- else
- {
- _msgLine.setErrorMessage(msg);
- }
- }
- else if (launchType == ServerLaunchType.DAEMON_LITERAL)
- {
- String port = getDaemonPort();
-
- int portAsInt = 0;
- if (port != null && port.length() > 0){
- try {
- portAsInt = Integer.parseInt(port);
- }
- catch (Exception e){
- portAsInt = 0;
- }
- }
-
- msg = _daemonPortValidator.validate(port);
-
- // for daemons we don't allow 0
- if (msg == null && portAsInt == 0)
- msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PORT_NOTVALID);
-
-
- if (msg == null)
- {
- _msgLine.clearErrorMessage();
- }
- else
- {
- _msgLine.setErrorMessage(msg);
- }
- }
- else
- {
- _msgLine.clearErrorMessage();
- }
- notifyVerifyListeners();
- return (msg==null);
- }
-
- /**
- * Update the actual values in the server launcher, from the widgets. Called on successful press of OK.
- * @return true if all went well, false if something failed for some reason.
- */
- public boolean updateValues(IServerLauncherProperties launcher)
- {
- ServerLaunchType launchType = getLaunchType();
- String path = getServerInstallPath();
- String invocation = getServerInvocation();
- int rexecPort = getREXECPortAsInt();
- int daemonPort = getDaemonPortAsInt();
- boolean useSSL = getUseSSL();
- boolean autoDetect = getAutoDetect();
-
- IRemoteServerLauncher isl = (IRemoteServerLauncher)launcher;
- isl.setServerLaunchType(launchType);
- isl.setServerPath(path);
- isl.setServerScript(invocation);
- isl.setRexecPort(rexecPort); // changed from setPort via d54335. Phil
- isl.setDaemonPort(daemonPort);
- isl.setAutoDetectSSL(autoDetect);
- isl.getConnectorService().setIsUsingSSL(useSSL);
- try
- {
- isl.getConnectorService().commit();
- }
- catch (Exception e)
- {
- return false;
- }
- return true;
- }
-
-
- public void handleEvent(Event evt)
- {
-
- boolean useRexec = _radioRexec.getSelection();
- _fieldDaemonPort.setEnabled(_radioDaemon.getSelection());
- _fieldRexecPath.setEnabled(useRexec);
- _labelRexecPath.setEnabled(useRexec);
- _fieldRexecInvocation.setEnabled(useRexec);
- _labelRexecInvocation.setEnabled(useRexec);
- _fieldRexecPort.setEnabled(useRexec);
- _labelRexecPort.setEnabled(useRexec);
- _checkBoxAutoDetect.setEnabled(useRexec);
- _checkBoxRexecSSL.setEnabled(useRexec && !_checkBoxAutoDetect.getSelection());
- _checkBoxSSL.setEnabled(_radioNone.getSelection());
-
- verify();
- }
-
- protected ServerLaunchType getLaunchType()
- {
- if (_radioDaemon.getSelection())
- return ServerLaunchType.DAEMON_LITERAL;
- else if (_radioRexec.getSelection())
- return ServerLaunchType.REXEC_LITERAL;
- else if (_radioNone.getSelection())
- return ServerLaunchType.RUNNING_LITERAL;
- else
- return null;
- }
-
- protected boolean getUseSSL()
- {
- if (_radioRexec.getSelection())
- return _checkBoxRexecSSL.getSelection();
- else return _checkBoxSSL.getSelection();
- }
-
- protected boolean getAutoDetect()
- {
- if (_radioNone.getSelection()) return false;
- if (_radioRexec.getSelection())
- return _checkBoxAutoDetect.getSelection();
- else return true;
- }
-
- protected void setUseSSL(boolean use)
- {
- _checkBoxSSL.setSelection(use);
- _checkBoxRexecSSL.setSelection(use);
- }
-
- protected void setAutoDetect(boolean use)
- {
- _checkBoxAutoDetect.setSelection(use);
- }
-
- protected void setLaunchType(ServerLaunchType type)
- {
- if (type == ServerLaunchType.DAEMON_LITERAL)
- {
- _radioDaemon.setSelection(true);
- _radioRexec.setSelection(false);
- _radioNone.setSelection(false);
- }
- else if (type == ServerLaunchType.REXEC_LITERAL)
- {
- _radioRexec.setSelection(true);
- _radioDaemon.setSelection(false);
- _radioNone.setSelection(false);
- }
- else if (type == ServerLaunchType.RUNNING_LITERAL)
- {
- _radioNone.setSelection(true);
- _radioRexec.setSelection(false);
- _radioDaemon.setSelection(false);
- }
- else
- {
- _radioNone.setSelection(false);
- _radioRexec.setSelection(false);
- _radioDaemon.setSelection(false);
- }
- }
-
-
- /**
- * Sets whether to enable daemon launch.
- * @param enable <code>true</code> if daemon launch should be enabled, <code>false</code> otherwise.
- */
- public void setDaemonLaunchEnabled(boolean enable)
- {
- //_radioDaemon.setVisible(enable);
- //_daemonControls.setVisible(enable);
- //_daemonControls.getLayout().
- _labelDaemonPort.setEnabled(enable);
- _fieldDaemonPort.setEnabled(enable);
-
- _radioDaemon.setEnabled(enable);
- }
-
- /**
- * Sets whether to enable rexec launch.
- * @param enable <code>true</code> if rexec launch should be enabled, <code>false</code> otherwise.
- */
- public void setRexecLaunchEnabled(boolean enable)
- {
- /*
- _radioRexec.setVisible(enable);
- _rexecControls.setVisible(enable);
- _labelRexecInvocation.setVisible(enable);
- _labelRexecPath.setVisible(enable);
- _labelRexecPort.setVisible(enable);
- */
- _fieldRexecInvocation.setEnabled(enable);
- _fieldRexecPath.setEnabled(enable);
- _fieldRexecPort.setEnabled(enable);
-
- _radioRexec.setEnabled(enable);
- }
-
- public void setHostname(String hostname)
- {
- _hostName = hostname;
- }
-
- /**
- * Set the daemon port widget value
- * @param port - the port value as a string
- */
- public void setDaemonPort(String port)
- {
- _fieldDaemonPort.setText(port);
- }
-
- /**
- * Set the daemon port widget value
- * @param port - the port value as an int
- */
- public void setDaemonPort(int port)
- {
- _fieldDaemonPort.setText(Integer.toString(port));
- }
-
- /**
- * Get the Daemon port widget value
- * @return the widget's current value as an int
- */
- public int getDaemonPortAsInt()
- {
- int port = 0;
- try {
- port = Integer.parseInt(_fieldDaemonPort.getText().trim());
- } catch (Exception exc) { }
- return port;
- }
- /**
- * Get the daemon port widget value
- * @return the widget's current value as a string
- */
- public String getDaemonPort()
- {
- return _fieldDaemonPort.getText().trim();
- }
-
- /**
- * Set the REXEC port's widget value, as a String
- * @param port - the value to apply to the widget
- */
- public void setREXECPort(String port)
- {
- _fieldRexecPort.setText(port);
- }
- /**
- * Set the REXEC port's widget value, given an int port value
- * @param port - the value to apply to the widget.
- */
- public void setREXECPort(int port)
- {
- _fieldRexecPort.setText(Integer.toString(port));
- }
- /**
- * Get the REXEC port widget value
- * @return the widget's current value as an int
- */
- public int getREXECPortAsInt()
- {
- int port = 0;
- try {
- port = Integer.parseInt(_fieldRexecPort.getText().trim());
- } catch (Exception exc) { }
- return port;
- }
- /**
- * Get the REXEC port widget value
- * @return the widget's current value as a string
- */
- public String getREXECPort()
- {
- return _fieldRexecPort.getText().trim();
- }
-
-
- /**
- * Sets whether to enable no launch.
- * @param enable <code>true</code> if no launch should be enabled, <code>false</code> otherwise.
- */
- public void setNoLaunchEnabled(boolean enable)
- {
- _radioNone.setEnabled(enable);
- _checkBoxSSL.setEnabled(enable);
- }
- /**
- * Return the current value of the REXEC server install path widget
- * @return widget value as a string
- */
- public String getServerInstallPath()
- {
- return _fieldRexecPath.getText().trim();
- }
- /**
- * Set the REXEC server install path widget's value
- * @param path - the text to set the widget's value to
- */
- public void setServerInstallPath(String path)
- {
- _fieldRexecPath.setText(path);
- }
- /**
- * Return the current value of the REXEC server invocation widget
- * @return widget value as a string
- */
- public String getServerInvocation()
- {
- return _fieldRexecInvocation.getText();
- }
- /**
- * Set the REXEC server invocation widget's value
- * @param invocation - the text to set the widget's value to
- */
- public void setServerInvocation(String invocation)
- {
- _fieldRexecInvocation.setText(invocation);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java
deleted file mode 100644
index e40946624..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemCollapsableSection.java
+++ /dev/null
@@ -1,441 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Class to provide a collapsible composite that can be collapsed
- * to hide some controls
- */
-public class SystemCollapsableSection extends Composite implements MouseListener, PaintListener
-{
-
- public static final String Copyright =
- "(C) Copyright IBM Corp. 2002, 2003. All Rights Reserved."; //$NON-NLS-1$
-
- protected boolean _bCollapsed = false;
- protected boolean _bMouseOver = false;
- protected Composite _compositePage = null;
- protected String _strText = null;
- protected String _strExpandedText = null;
- protected String _strCollapsedText = null;
- protected String _strExpandedToolTip = null;
- protected String _strCollapsedToolTip = null;
- protected Label _labelTitle = null;
-
- protected static Color _colorCollapsable = null;
-
- // yantzi: added so we can have a collapse / expand action in the iSeries table view for
- // accessability reasons.
- private List listeners = new ArrayList(5);
-
- /**
- *
- */
- protected class RTwisteeLayout extends Layout
- {
-
- /**
- *
- */
- protected Point computeSize(
- Composite composite,
- int wHint,
- int hHint,
- boolean flushCache)
- {
- checkWidget();
-
- Point ptSize = getTitleSize(_strText);
- Point ptPageSize =
- _compositePage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-
- ptSize.x = Math.max(ptSize.x, ptPageSize.x + 8);
-
- if (_bCollapsed == false)
- ptSize.y += ptPageSize.y;
-
- return ptSize;
- }
-
- /**
- * Layout.
- */
- protected void layout(Composite composite, boolean flushCache)
- {
- Point ptTitleSize = getTitleSize(_strText);
- getLocation();
-
- if (_bCollapsed == true)
- {
- Rectangle rectClient = getClientArea();
- Point ptPageSize =
- new Point(
- rectClient.width - 16,
- rectClient.height - ptTitleSize.y);
- _compositePage.setBounds(16, ptTitleSize.y, ptPageSize.x, 4);
- setSize(
- Math.max(ptTitleSize.x, ptPageSize.x + 16),
- ptTitleSize.y);
- }
-
- else
- {
- Rectangle rectClient = getClientArea();
- Point ptPageSize =
- new Point(
- rectClient.width - 16,
- rectClient.height - ptTitleSize.y);
- // Point ptPageSize = _compositePage.computeSize( SWT.DEFAULT, SWT.DEFAULT, true );
- _compositePage.setBounds(
- 16,
- ptTitleSize.y,
- ptPageSize.x,
- ptPageSize.y);
- setSize(
- Math.max(ptTitleSize.x, ptPageSize.x + 16),
- ptTitleSize.y + ptPageSize.y);
- }
- }
- }
-
- /**
- * Constructor
- */
- public SystemCollapsableSection(Composite compositeParent)
- {
-
- super(compositeParent, SWT.NULL);
-
- if (_colorCollapsable == null)
- {
- Display display = Display.getCurrent();
- _colorCollapsable = new Color(display, 0, 140, 140);
- }
-
- setLayout(new RTwisteeLayout());
-
- // Page content
- //-------------
- _compositePage = new Composite(this, SWT.NULL);
-
- GridData gridData = new GridData();
- setLayoutData(gridData);
-
- addPaintListener(this);
- addMouseListener(this);
- }
-
- /**
- * Get the actual composite inside the collapsible section to
- * be usde for filling it up with controls
- */
- public Composite getPageComposite()
- {
- return _compositePage;
- }
-
- /**
- * Compute the title area size.
- */
- private Point getTitleSize(String strText)
- {
-
- if (strText == null || strText.length() == 0)
- {
- strText = "MMMMMMMMMMMM"; //$NON-NLS-1$
- }
-
- GC gc = new GC(this);
-
- Point ptSize = gc.textExtent(strText);
- ptSize.y = Math.max(ptSize.y, gc.getFontMetrics().getHeight());
-
- ptSize.x += 20;
- ptSize.y = Math.max(ptSize.y, 20);
-
- gc.dispose();
-
- return ptSize;
- }
-
- /**
- * Return the collapse state
- */
- public boolean getCollapsed()
- {
- return _bCollapsed;
- }
-
- /**
- * Get the default title text
- */
- public String getText()
- {
- return _strText;
- }
-
- /**
- *
- */
- public void mouseDoubleClick(MouseEvent e)
- {
-
- }
-
- /**
- *
- */
- public void mouseDown(MouseEvent e)
- {
-
- }
-
- /**
- * Handle the collapse or expand request from the mouse up event
- */
- public void mouseUp(MouseEvent e)
- {
-
- _bCollapsed = _bCollapsed == true ? false : true;
-
- if (_bCollapsed)
- {
- setToolTipText(_strCollapsedToolTip);
- }
- else
- {
- setToolTipText(_strExpandedToolTip);
- }
-
- List list = new ArrayList();
-
- Composite compositeParent = this;
-
- do
- {
- list.add(compositeParent);
- compositeParent = compositeParent.getParent();
- }
- while (compositeParent instanceof Shell == false);
-
- for (int i = list.size() - 1; i >= 0; --i)
- {
- compositeParent = (Composite) list.get(i);
- compositeParent.layout();
- }
-
- fireCollapseEvent(_bCollapsed);
- // composite.redraw();
- }
-
- /**
- * Paint the control
- */
- public void paintControl(PaintEvent e)
- {
-
- paintCollapsable(e.gc, 0, 2, _bCollapsed);
-
- if (_bCollapsed)
- {
- setToolTipText(_strCollapsedToolTip);
- if (_strCollapsedText != null)
- _strText = _strCollapsedText;
- }
- else
- {
- setToolTipText(_strExpandedToolTip);
- if (_strExpandedText != null)
- _strText = _strExpandedText;
- }
-
- if (_strText == null)
- return;
-
- e.gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
- e.gc.drawString(_strText, 17, 0, true);
- }
-
- /**
- * Paints the two states of a collapsable indicator of a collapsable container.
- */
- public static void paintCollapsable(
- GC gc,
- int iX,
- int iY,
- boolean bCollapsed)
- {
-
- // Not collapsed: v
- //-----------------
-
- if (bCollapsed == false)
- {
- gc.setForeground(_colorCollapsable);
-
- int iA = iX;
- int iB = iY + 3;
- gc.drawLine(iA, iB, iA + 10, iB);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA + 8, iB);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA + 6, iB);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA + 4, iB);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA + 2, iB);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA, iB);
-
- iA = iX;
- iB = iY;
- }
-
- // Collapsed: >
- //-------------
- else
- {
- gc.setForeground(_colorCollapsable);
-
- int iA = iX + 2;
- int iB = iY;
-
- gc.drawLine(iA, iB, iA, iB + 10);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA, iB + 8);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA, iB + 6);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA, iB + 4);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA, iB + 2);
- iA++;
- iB++;
- gc.drawLine(iA, iB, iA, iB);
- }
- }
-
- /**
- * Set the section to be collapsed
- */
- public void setCollapsed(boolean bCollapsed)
- {
-
- _bCollapsed = bCollapsed;
- if (_bCollapsed)
- setToolTipText(_strCollapsedToolTip);
- else
- setToolTipText(_strExpandedToolTip);
-
- redraw();
-
- fireCollapseEvent(bCollapsed);
- }
-
- /**
- * Set the default text title
- */
- public void setText(String strText)
- {
- _strText = strText;
- redraw();
- }
- /**
- * Set the title to be displayed when the section is expanded
- */
- public void setExpandedText(String strText)
- {
- _strExpandedText = strText;
- }
- /**
- * Set the title to be displayed when the section is collapsed
- */
- public void setCollapsedText(String strText)
- {
- _strCollapsedText = strText;
- }
-
- /**
- * Sets tooltips used in expanded and collapsed states.
- * @param strExpandedToolTip tooltip for the expanded state. For example, "click line to collapse the section".
- * @param strCollapsedToolTip tooltip for the collapsed state. For example, "click line to expand the section".
- */
- public void setToolTips(String strExpandedToolTip, String strCollapsedToolTip)
- {
- _strCollapsedToolTip = strCollapsedToolTip;
- _strExpandedToolTip = strExpandedToolTip;
- }
-
- /**
- * Add a collapse / expand event listener
- */
- public void addCollapseListener(ISystemCollapsableSectionListener listener)
- {
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- /**
- * Remove a collapse / expand event listener
- */
- public void removeCollapseListener(ISystemCollapsableSectionListener listener)
- {
- listeners.remove(listener);
- }
-
- /**
- * Notify collapse / expand listeners of an event
- */
- private void fireCollapseEvent(boolean collapsed)
- {
- for (int i = 0; i < listeners.size(); i++)
- {
- ((ISystemCollapsableSectionListener) listeners.get(i)).sectionCollapsed(collapsed);
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java
deleted file mode 100644
index 309496f9e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemEditPaneStateMachine.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [183165] Do not implement constant interfaces
- * David Dykstal (IBM) - [232318] force layout and repaint after changing labels
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-
-/**
- * This class encapsulates the states an edit page (with apply/reset buttons)
- * can go through and handle managing the state transitions. For example, it manages
- * the enabled/disabled state of the apply/reset buttons.
- * <p>
- * There are three <b>modes</b> supported:
- * <ol>
- * <li>New -> user is creating a "new thing". In this state, the apply button label is
- * "New", and the reset button is hidden
- * <li>Edit -> user is editing an existing thing. The apply and reset buttons have usual labels
- * <li>Unset -> overall composite is hidden
- * </ol>
- * In addition to the modes, there are these <b>states</b> supported
- * <ol>
- * <li>No changes -> the apply and reset buttons are disabled
- * <li>Changes pending -> the apply and reset buttons are enabled
- * <li>Changes made -> the apply and reset buttons are disabled
- * </ol>
- * There are constants for these modes and states in {@link org.eclipse.rse.ui.widgets.ISystemEditPaneStates}
- * <p>
- * To use this properly, call the following methods at the appropriate times:
- * <ul>
- * <li>{@link #setNewMode()} -> when users selects to create a new thing.
- * <li>{@link #setEditMode()} -> when user selects to edit an existing thing.
- * <li>{@link #setUnsetMode()} -> when user selects nothing or something not editable
- * <li>{@link #setChangesMade()} -> when user changes anything in the pane!
- * <li>{@link #isSaveRequired()} -> if changes are pending, this will prompt the user if they wish to save the
- * changes or discard the changes. Returns true or false.
- * <li>{@link #applyPressed()} -> when user successfully presses apply
- * <li>{@link #resetPressed()} -> when user successfully presses reset
- * </ul>
- */
-public class SystemEditPaneStateMachine
-{
- // state
- private Composite composite;
- private Button applyButton, resetButton;
- private int mode, state;
- private int backupMode, backupState;
- private SystemMessage pendingMsg;
- private String applyLabel_applyMode;
- private String applyLabel_newMode;
- private String applyTip_applyMode;
- private String applyTip_newMode;
- private boolean applyLabelMode;
- private boolean newSetByDelete; //d47125
-
-
- /**
- * Constructor for SystemEditPaneStateMachine.
- * <p>
- * This constructor sets the initial mode to MODE_UNSET.
- * <p>
- * While this class will handle enabling/disabling the apply/reset buttons,
- * it is still your job to add listeners and actually do the applying and resetting!
- * @param composite - overall composite of the edit pane
- * @param applyButton - the Apply pushbutton
- * @param resetButton - the Reset pushbutton. Can be null.
- */
- public SystemEditPaneStateMachine(Composite composite, Button applyButton, Button resetButton)
- {
- super();
- this.composite = composite;
- this.applyButton = applyButton;
- this.resetButton = resetButton;
-
- this.applyLabel_applyMode = applyButton.getText();
- this.applyTip_applyMode = applyButton.getToolTipText();
- this.applyLabelMode = true;
-
- setApplyLabelForNewMode(SystemResources.BUTTON_CREATE_LABEL, SystemResources.BUTTON_CREATE_TOOLTIP);
-
- setUnsetMode();
- //setMode(MODE_UNSET);
- //setState(STATE_INITIAL);
- //enableButtons();
-
- // I have decided it is safer to force the user of this class to call this,
- // since it is possible that Apply will find errors and not actually do the apply
- /*
- applyButton.addSelectionListener(this);
- if (resetButton != null)
- resetButton.addSelectionListener(this);
- */
- }
-
- /**
- * Set the label and tooltip to use for the apply button in "new" mode.
- * By default, generic values are used
- */
- public void setApplyLabelForNewMode(String label, String tooltip)
- {
- this.applyLabel_newMode = label;
- this.applyTip_newMode = tooltip;
- }
-
- /**
- * Set the mode to "New". User has selected "new" and wants to create a new thing.
- * It is your responsibility to call {@link #isSaveRequired()} first.
- * It is assumed that after the object is created by pressing Apply, your UI will
- * select the new object and then call setEditMode
- */
- public void setNewMode()
- {
- setButtonText(mode, ISystemEditPaneStates.MODE_NEW);
- setMode(ISystemEditPaneStates.MODE_NEW);
- setState(ISystemEditPaneStates.STATE_INITIAL);
- enableButtons();
- if (!composite.isVisible())
- composite.setVisible(true);
- }
- /**
- * Set the mode to "Edit". User has selected an existing object and wants to changed/edit it
- * It is your responsibility to call {@link #isSaveRequired()} first.
- */
- public void setEditMode()
- {
- setButtonText(mode, ISystemEditPaneStates.MODE_EDIT);
- setMode(ISystemEditPaneStates.MODE_EDIT);
- setState(ISystemEditPaneStates.STATE_INITIAL);
- enableButtons();
- if (!composite.isVisible())
- composite.setVisible(true);
- }
- /**
- * Set the mode to "Unset". User has selected nothing or something not editable
- * It is your responsibility to call {@link #isSaveRequired()} first.
- */
- public void setUnsetMode()
- {
- setButtonText(mode, ISystemEditPaneStates.MODE_UNSET);
- setMode(ISystemEditPaneStates.MODE_UNSET);
- setState(ISystemEditPaneStates.STATE_INITIAL);
- enableButtons();
- if (composite.isVisible())
- composite.setVisible(false);
- }
- /**
- * User has made changes, such as typing text or selecting a checkbox or radio button.
- * It is VERY important this be called religiously for every possible change the user can make!
- */
- public void setChangesMade()
- {
- setState(ISystemEditPaneStates.STATE_PENDING);
- enableButtons();
- }
- /**
- * Query if it is ok to switch modes.
- * If no changes pending, returns false
- * If changes pending, user is asked to whether to save (true) or discard (false).
- */
- public boolean isSaveRequired()
- {
- boolean changesPending = areChangesPending();
- if (changesPending)
- {
- if (pendingMsg == null)
- {
- pendingMsg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONFIRM_CHANGES);
- }
- SystemMessageDialog pendingMsgDlg = new SystemMessageDialog(composite.getShell(), pendingMsg);
- try {
- changesPending = pendingMsgDlg.openQuestion();
- } catch (Exception exc) {}
- }
- //if (!changesPending) // user has made decision, so clear state
- setState(ISystemEditPaneStates.STATE_INITIAL); // one way or another, decision has been made
- return changesPending;
- }
-
- /**
- * User has successfully pressed Apply (that is, no errors found)
- */
- public void applyPressed()
- {
- setState(ISystemEditPaneStates.STATE_APPLIED);
- enableButtons();
- }
- /**
- * User has successfully pressed Reset (that is, no errors found)
- */
- public void resetPressed()
- {
- setState(ISystemEditPaneStates.STATE_INITIAL);
- enableButtons();
- }
-
- /**
- * Are any changes pending?
- */
- public boolean areChangesPending()
- {
- return (state == ISystemEditPaneStates.STATE_PENDING);
- }
-
- // -----------------------------------
- // GETTERS FOR STUFF PASSED IN CTOR...
- // -----------------------------------
- /**
- * Returns the resetButton.
- * @return Button
- */
- public Button getResetButton()
- {
- return resetButton;
- }
-
- /**
- * Returns the applyButton.
- * @return Button
- */
- public Button getApplyButton()
- {
- return applyButton;
- }
-
- /**
- * Returns the composite.
- * @return Composite
- */
- public Composite getComposite()
- {
- return composite;
- }
-
- // -----------------------------------
- // GETTERS FOR MODE AND STATE
- // -----------------------------------
- /**
- * Returns the mode.
- * @return int
- * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
- */
- public int getMode()
- {
- return mode;
- }
-
- /**
- * Returns the state.
- * @return int
- * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
- */
- public int getState()
- {
- return state;
- }
-
-
- // -------------------
- // INTERNAL METHODS...
- // -------------------
-
- /**
- * enable/disable buttons based on state
- */
- private void enableButtons()
- {
- boolean enableApply = false;
- boolean enableReset = false;
- switch(state)
- {
- case ISystemEditPaneStates.STATE_INITIAL:
- enableApply = false;
- enableReset = false;
- break;
- case ISystemEditPaneStates.STATE_APPLIED:
- enableApply = false;
- enableReset = false; // true; only true if reset returns to pre-applied values. Not usually the case
- break;
- case ISystemEditPaneStates.STATE_PENDING:
- enableApply = true;
- enableReset = true;
- break;
- }
- applyButton.setEnabled(enableApply);
- if (resetButton != null)
- resetButton.setEnabled(enableReset);
- }
-
- /**
- * Change apply button label and tooltiptext when switching
- * to/from new/edit modes.
- */
- private void setButtonText(int oldMode, int newMode)
- {
- if (oldMode != newMode)
- {
- if ((newMode == ISystemEditPaneStates.MODE_NEW) && applyLabelMode)
- {
- applyButton.setText(applyLabel_newMode);
- applyButton.setToolTipText(applyTip_newMode);
- applyLabelMode = false;
- if (resetButton != null)
- {
- //resetButton.setVisible(false);
- //GridData gd = (GridData)applyButton.getLayoutData();
- //if (gd != null)
- //{
- // gd.horizontalSpan = 2;
- // composite.layout(true);
- //}
- }
- }
- else if ((newMode == ISystemEditPaneStates.MODE_EDIT) && !applyLabelMode)
- {
- applyButton.setText(applyLabel_applyMode);
- applyButton.setToolTipText(applyTip_applyMode);
- applyLabelMode = true;
- if (resetButton != null)
- {
- //resetButton.setVisible(true);
- //GridData gd = (GridData)applyButton.getLayoutData();
- //if (gd != null)
- //{
- // gd.horizontalSpan = 1;
- // composite.layout(true);
- //}
- }
- }
- Composite parent = applyButton.getParent();
- parent.layout();
- parent.update();
- }
- }
-
- /**
- * Sets the mode.
- * @param mode The mode to set
- * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
- */
- private void setMode(int mode)
- {
- this.mode = mode;
- }
-
- /**
- * Sets the state.
- * @param state The state to set
- * @see org.eclipse.rse.ui.widgets.ISystemEditPaneStates
- */
- private void setState(int state)
- {
- this.state = state;
- }
-
- /*
- * Keep track of the fact that New is selected by the Delete action and not by user
- * so that user can exit later by using OK without supplying a command //d47125
- */
- public void setNewSetByDelete(boolean newSetByDelete)
- {
- this.newSetByDelete = newSetByDelete;
- }
-
- public boolean getNewSetByDelete()
- {
- return newSetByDelete;
- }
- /*
- * Internal method.
- * From SelectionListener. Called when user presses Apply or Reset buttons
- *
- public void widgetSelected(SelectionEvent event)
- {
- Object source = event.getSource();
- if (source == applyButton)
- {
- setState(STATE_APPLIED);
- enableButtons();
- }
- else if (source == resetButton)
- {
- setState(STATE_INITIAL);
- enableButtons();
- }
- }
- **
- * Internal method.
- * From SelectionListener. Called when user presses Enter?
- *
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
- */
-
- /**
- * Backup state method
- */
- public void backup()
- {
- backupMode = mode;
- backupState = state;
- }
-
- /**
- * Restore state method
- */
- public void restore()
- {
- switch(backupMode)
- {
- case ISystemEditPaneStates.MODE_UNSET:
- setUnsetMode();
- break;
- case ISystemEditPaneStates.MODE_NEW:
- setNewMode();
- break;
- case ISystemEditPaneStates.MODE_EDIT:
- setEditMode();
- break;
- }
- switch(backupState)
- {
- case ISystemEditPaneStates.STATE_PENDING:
- setChangesMade();
- break;
- case ISystemEditPaneStates.STATE_INITIAL:
- break;
- case ISystemEditPaneStates.STATE_APPLIED:
- applyPressed();
- break;
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java
deleted file mode 100644
index 839734679..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java
+++ /dev/null
@@ -1,718 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * David Dykstal (IBM) - [226561] Add API markup for noextend / noimplement where needed
- * David McKnight (IBM) - [240414] NPE in SystemHistoryCombo
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.dialogs.SystemWorkWithHistoryDialog;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.GC;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-
-
-/**
- * This re-usable widget is for a combox box that persists its history and
- * allows the user to manipulate that history.
- * <p>
- * The composite is layed as follows:</p>
- * <pre><code>
- * ______________v...
- * </code></pre>
- * @see #updateHistory()
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class SystemHistoryCombo extends Composite implements ISystemCombo, TraverseListener, KeyListener
-{
- private Combo historyCombo = null;
- private Button historyButton = null;
- private String historyKey = null;
- private String[] defaultHistory; // pc41439
- private boolean readonly = false;
- private boolean autoUppercase = false;
-
- private int maxComboEntries; // DY: Debugger requested we provide support to limit the number of entries
- private static final int DEFAULT_MAX_COMBO_ENTRIES = 20; // in the combo box for transient data like job name / number. Note: this does
- // not affect the edit history portion of this widget. I have guessed at a
- // default limit of 20 entries.
-
- private static final int DEFAULT_COMBO_WIDTH = 100;
- // dwd private static final int DEFAULT_BUTTON_WIDTH = 10;
- private static final int DEFAULT_BUTTON_WIDTH = 13; // dwd: changed from 10 to accomodate focus rectangle
- private static final int DEFAULT_MARGIN = 1;
-
-
- /**
- * Constructor for SystemHistoryCombo
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically it is just SWT.NULL
- * @param key The unique string used as a preferences key to persist the history for this widget
- * @param readonly Set to true for a readonly combo vs user-editable combo box
- */
- public SystemHistoryCombo(Composite parent, int style, String key, boolean readonly)
- {
- this(parent, style, key, DEFAULT_MAX_COMBO_ENTRIES, readonly);
- }
-
- /**
- * Constructor for SystemHistoryCombo
- * @param parent The owning composite
- * @param style The swt style to apply to the overall composite. Typically it is just SWT.NULL
- * @param key The unique string used as a preferences key to persist the history for this widget
- * @param maxComboEntries The number of history entries to show in the combo box. This only restricts the
- * combo box not the full history list
- * @param readonly Set to true for a readonly combo vs user-editable combo box
- */
- public SystemHistoryCombo(Composite parent, int style, String key, int maxComboEntries, boolean readonly)
- {
- super(parent, style);
- historyKey = key;
- this.readonly = readonly;
- prepareComposite(2);
- historyCombo = createCombo(this, readonly);
- //historyCombo.addTraverseListener(this);
- historyCombo.addKeyListener(this);
- //setWidthHint(DEFAULT_COMBO_WIDTH+DEFAULT_BUTTON_WIDTH+DEFAULT_MARGIN);
- this.maxComboEntries = maxComboEntries;
- createHistoryButton();
- String[] history = getHistory();
- if (history != null && history.length > 0)
- setItems(history);
- addOurButtonSelectionListener();
- }
-
- /**
- * Return the combo box widget
- */
- public Combo getCombo()
- {
- return historyCombo;
- }
- /**
- * Set the width hint for the combo box widget (in pixels).
- * Default is only 100, so you may want to set it.
- * A rule of thumb is 10 pixels per character, but allow 15 for the litte button on the right.
- * You must call this versus setting it yourself, else you may see truncation.
- */
- public void setWidthHint(int widthHint)
- {
- // after much research it was decided that it was the wrong thing to do to
- // explicitly set the widthHint of a child widget without our composite, as
- // that could end up being a bigger number than the composites widthHint itself
- // if the caller set its it directly.
- // Rather, we just set the overall composite width and specify the combo child
- // widget is to grab all the space within that which the little button does not use.
- /*((GridData)historyCombo.getLayoutData()).grabExcessHorizontalSpace = true;
- ((GridData)historyCombo.getLayoutData()).horizontalAlignment = GridData.FILL;
- ((GridData)historyCombo.getLayoutData()).widthHint = widthHint;*/
- ((GridData)getLayoutData()).widthHint = widthHint + DEFAULT_BUTTON_WIDTH + DEFAULT_MARGIN;
- }
-
- /**
- * Set auto-uppercase. When enabled, all non-quoted values are uppercases when added to the history.
- */
- public void setAutoUpperCase(boolean enable)
- {
- this.autoUppercase = enable;
- }
-
- /**
- * Return the history button widget
- */
- public Button getHistoryButton()
- {
- return historyButton;
- }
-
- /**
- * Set the combo field's current contents
- */
- public void setText(String text)
- {
- if (!readonly)
- {
- historyCombo.setText(text);
- updateHistory();
- }
- else
- {
- int selIdx = -1;
- String[] currentItems = historyCombo.getItems();
- String[] newItems = new String[currentItems.length + 1];
- newItems[0] = text;
- for (int idx=0; (selIdx==-1) && (idx<currentItems.length); idx++)
- {
- if (text.equals(currentItems[idx]))
- selIdx = idx;
- else
- newItems[idx+1] = currentItems[idx];
- }
- // did not find the given text in the history, so update history...
- if (selIdx == -1)
- {
- setItems(newItems);
- selIdx = currentItems.length;
- SystemPreferencesManager.setWidgetHistory(historyKey, newItems);
- }
- if (selIdx >= 0)
- {
- historyCombo.select(selIdx);
- }
- }
- }
-
- /**
- * Query the history combo field's current contents
- */
- public String getText()
- {
- return historyCombo.getText();
- }
-
- /**
- * Disable/Enable all the child controls.
- */
- public void setEnabled(boolean enabled)
- {
- historyCombo.setEnabled(enabled);
- historyButton.setEnabled(enabled);
- }
- /**
- * Set the tooltip text for the combo field
- */
- public void setToolTipText(String tip)
- {
- historyCombo.setToolTipText(tip);
- }
- /**
- * Set the tooltip text for the history button
- */
- public void setHistoryButtonToolTipText(String tip)
- {
- historyButton.setToolTipText(tip);
- }
- /**
- * Same as #setHistoryButtonToolTipText(String)
- */
- public void setButtonToolTipText(String tip)
- {
- historyButton.setToolTipText(tip);
- }
-
- /**
- * Set the combo field's text limit
- */
- public void setTextLimit(int limit)
- {
- historyCombo.setTextLimit(limit);
- }
- /**
- * Set the focus to the combo field
- */
- public boolean setFocus()
- {
- return historyCombo.setFocus();
- }
-
- /**
- * Set the items in the combo field
- */
- public void setItems(String[] items)
- {
- // DY; Modified to add maxComboSize restriction
- if ((items != null) && (items.length > maxComboEntries))
- {
- String[] historySubSet = new String[maxComboEntries];
- System.arraycopy(items, 0, historySubSet, 0, maxComboEntries);
- historyCombo.setItems(historySubSet);
- }
- else
- {
- historyCombo.setItems(items);
- }
- }
-
- /**
- * Set the items to default the history to, IF the history
- * is currently empty.
- */
- public void setDefaultHistory(String[] items)
- {
- this.defaultHistory = items; // pc41439
- if (historyCombo.getItemCount() == 0)
- {
- setItems(items);
- SystemPreferencesManager.setWidgetHistory(historyKey, items); //d41439
- //updateHistory(); d41439
- }
- }
-
- /**
- * Reset the history key. This changes the contents!
- * You should re-call setDefaultHistory() as well after this, if you had called it before
- */
- public void setHistoryKey(String key)
- {
- this.historyKey = key;
- String[] history = getHistory();
- if (history != null && history.length > 0)
- setItems(history);
- else
- historyCombo.removeAll();
- }
-
- /**
- * Get the items in the combo field
- */
- public String[] getItems()
- {
- return historyCombo.getItems();
- }
-
- /**
- * Select the combo dropdown list entry at the given index
- */
- public void select(int selIdx)
- {
- if (selIdx >= historyCombo.getItemCount())
- return;
- historyCombo.deselectAll();
- historyCombo.select(selIdx);
- historyCombo.clearSelection(); // so text is not selected
- //sendEvent(SWT.Selection);
- // for some reason no event is fired on selection.
- // This overcomes that shortcoming ... uses same solution as jface
- Event e = new Event();
- //e.time = event.time;
- //e.stateMask = event.stateMask;
- //e.doit = event.doit;
- historyCombo.notifyListeners(SWT.Selection, e);
- }
- /**
- * Select the given text. This finds the given string in the list,
- * determines its zero-based offset, and calls select for that index.
- * If the item is not found it does nothing.
- * Returns the index number of the found string, or -1 if not found.
- */
- public int select(String itemText)
- {
- String[] items = historyCombo.getItems();
- int matchIdx = -1;
- if ((items==null) || (items.length==0))
- return matchIdx;
- for (int idx=0; (matchIdx==-1) && (idx<items.length); idx++)
- if (itemText.equals(items[idx]))
- matchIdx = idx;
- if (matchIdx != -1)
- select(matchIdx);
- return matchIdx;
- }
- /**
- * Same as {@link #select(int)}
- */
- public void setSelectionIndex(int selIdx)
- {
- select(selIdx);
- }
-
- /**
- * Clear the selection of the text in the entry field part of the combo.
- * Also deselects the list part.
- */
- public void clearSelection()
- {
- //if (!readonly)
- historyCombo.clearSelection();
- //else
- historyCombo.deselectAll();
- }
- /**
- * Clear the selection of the text in the entry field part of the combo.
- * Does not deselect the list part.
- */
- public void clearTextSelection()
- {
- //historyCombo.clearSelection();
- String text = historyCombo.getText();
- historyCombo.deselectAll();
- historyCombo.setText(text);
- }
-
- /**
- * Get the index number of the currently selected item. Only really
- * reliable in readonly mode.
- */
- public int getSelectionIndex()
- {
- return historyCombo.getSelectionIndex();
- }
-
- /**
- * Register a listener interested in an item is selected in the combo box
- * @see #removeSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener)
- {
- historyCombo.addSelectionListener(listener);
- }
- /**
- * Remove a previously set combo box selection listener.
- * @see #addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener)
- {
- historyCombo.removeSelectionListener(listener);
- }
- /**
- * Register a listener interested in entry field modify events
- * @see #removeModifyListener(ModifyListener)
- */
- public void addModifyListener(ModifyListener listener)
- {
- historyCombo.addModifyListener(listener);
- }
- /**
- * Remove a previously set entry field listener.
- * @see #addModifyListener(ModifyListener)
- */
- public void removeModifyListener(ModifyListener listener)
- {
- historyCombo.removeModifyListener(listener);
- }
-
- /**
- * Return the current history for the directory combo box
- */
- public String[] getHistory()
- {
- return SystemPreferencesManager.getWidgetHistory(historyKey);
- }
- /**
- * Update the history with current entry field setting, but don't refresh contents.
- * <p>
- * This is called automatically for you when setText is called. However, for non-readonly
- * versions, you should still call this yourself when OK is successfully pressed on the
- * dialog box.
- */
- public void updateHistory()
- {
- updateHistory(false);
- }
- /**
- * Update the history with current entry field setting, and optionally refresh the list from the new history
- * <p>
- * This is called automatically for you when setText is called. However, for non-readonly
- * versions, you should still call this yourself when OK is successfully pressed on the
- * dialog box.
- */
- public void updateHistory(boolean refresh)
- {
- String textValue = historyCombo.getText().trim();
- if (autoUppercase)
- if (!(textValue.startsWith("\"")&& textValue.endsWith("\""))) //$NON-NLS-1$ //$NON-NLS-2$
- textValue = textValue.toUpperCase();
- boolean alreadyThere = false;
- String[] newHistory = null;
- if (textValue.length() > 0)
- {
- // d41463 - seletced item should go to the top
- String[] currentHistory = historyCombo.getItems();
- if ( currentHistory.length > 0)
- {
- if (!textValue.equals(currentHistory[0]))
- {
- alreadyThere = false;
- // if string exists
- for (int idx=0; !alreadyThere && (idx<currentHistory.length); idx++)
- {
- if (textValue.equals(currentHistory[idx]))
- alreadyThere = true;
- }
-
- if (alreadyThere)
- newHistory = new String[currentHistory.length];
- else
- {
- newHistory = new String[currentHistory.length >= maxComboEntries ? maxComboEntries : currentHistory.length + 1];
- }
- newHistory[0] = textValue;
- int idx2 = 1;
- // copy the rest
- for (int idx=0; idx< currentHistory.length && idx2 < newHistory.length; idx++)
- {
- if (!textValue.equals(currentHistory[idx]))
- {
- newHistory[idx2] = currentHistory[idx];
- ++idx2;
- }
- }
- SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
- }
- }
- else
- {
- newHistory =new String[1];
- newHistory[0] = textValue;
- SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
- }
- if (refresh && (newHistory != null))
- {
- setItems(newHistory);
- setText(textValue);
- }
- /*
- String[] currentHistory = historyCombo.getItems();
- String[] newHistory = new String[currentHistory.length + 1];
- newHistory[0] = textValue;
- boolean alreadyThere = false;
- for (int idx=0; !alreadyThere && (idx<currentHistory.length); idx++)
- {
- if (textValue.equals(currentHistory[idx]))
- alreadyThere = true;
- else
- newHistory[idx+1] = currentHistory[idx];
- }
- if (!alreadyThere)
- SystemPreferencesManager.getGlobalPreferences().setWidgetHistory(historyKey, newHistory);
- */
- }
- }
- /**
- * Set the history to the given array of strings. Replaces what is there.
- */
- public void setHistory(String[] newHistory)
- {
- SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
- /**
- * Prepares this composite control and sets the default layout data.
- * @param numColumns Number of columns the new group will contain.
- */
- protected Composite prepareComposite(int numColumns)
- {
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- // horizontal data...
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = DEFAULT_COMBO_WIDTH+DEFAULT_BUTTON_WIDTH+DEFAULT_MARGIN;
- // vertical data...
- data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- data.grabExcessVerticalSpace = false;
-
- composite.setLayoutData(data);
- return composite;
- }
- /**
- * Creates a new combobox instance and sets the default
- * layout data.
- * <p>
- * Does NOT set the widthHint as that causes problems. Instead the combo will
- * consume what space is available within this composite.
- * @param parent composite to put the button into.
- */
- public static Combo createCombo(Composite parent, boolean readonly)
- {
- Combo combo = null;
- if (!readonly)
- combo = new Combo(parent, SWT.DROP_DOWN);
- else
- combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- //System.out.println("Default widthHint = " + data.widthHint);
- combo.setLayoutData(data);
- return combo;
- }
-
- protected void addOurButtonSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- historyButtonPressed();
- }
- public void widgetDefaultSelected(SelectionEvent event)
- {
- widgetSelected(event);
- }
-
- };
- historyButton.addSelectionListener(selectionListener);
- }
-
- protected void historyButtonPressed()
- {
- SystemWorkWithHistoryDialog dlg = new SystemWorkWithHistoryDialog(getShell(), getHistory());
- if (defaultHistory != null)
- dlg.setDefaultHistory(defaultHistory);
- dlg.setBlockOnOpen(true);
- dlg.open();
- if (!dlg.wasCancelled())
- {
- String value = historyCombo.getText(); // d41471
- String[] newHistory = dlg.getHistory();
- SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
- setItems(newHistory);
- historyCombo.setText(value); // Restore the value d41471
- }
- }
-
- protected Button createHistoryButton()
- {
- /*
- dwd: modified for defect 57974 - tab enable, provide focus rectangle, and accessibility text for history button. Original
- scheme used an SWT.ARROW button style which was not tab enabled and could not provide a focus rectangle.
- Changes: made the control a push button, programmatically drew the arrow on the button, and provided accessibility information.
- */
- boolean isDrawn = System.getProperty("os.name").toLowerCase().startsWith("win"); //$NON-NLS-1$ //$NON-NLS-2$
- if (isDrawn) {
- historyButton = new Button(this, SWT.PUSH);
- Display display = this.getDisplay();
- final Image upArrow = new Image(display, 5, 6);
- GC gc = new GC(upArrow);
- gc.setBackground(historyButton.getBackground());
- gc.fillRectangle(upArrow.getBounds());
- gc.setForeground(historyButton.getForeground());
- gc.drawLine(0, 5, 4, 5);
- gc.drawLine(0, 4, 4, 4);
- gc.drawLine(1, 3, 3, 3);
- gc.drawLine(1, 2, 3, 2);
- gc.drawLine(2, 1, 2, 1);
- gc.drawLine(2, 0, 2, 0);
- gc.dispose();
- historyButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- upArrow.dispose();
- }
- });
- historyButton.setImage(upArrow);
- } else {
- historyButton = new Button(this, SWT.ARROW);
- historyButton.setAlignment(SWT.UP);
- }
- historyButton.setToolTipText(SystemResources.RESID_WORKWITHHISTORY_BUTTON_TIP);
- historyButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
- e.result = ""; //$NON-NLS-1$
- }
- public void getName(AccessibleEvent e) { // this is the one that apparently does supply the text heard.
- e.result = historyButton.getToolTipText();
- String prefix = null;
- Composite parent = historyButton.getParent();
- while (parent != null && prefix == null) {
- if (parent instanceof Group) {
- Group group = (Group) parent;
- prefix = group.getText();
- }
- parent = parent.getParent();
- }
- if (prefix != null) {
- e.result = prefix + " " + e.result; //$NON-NLS-1$
- }
- }
- });
-
- GridData data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_BEGINNING;
- data.grabExcessHorizontalSpace = false ;
- data.widthHint = DEFAULT_BUTTON_WIDTH;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = true;
- data.heightHint = 20;
- historyButton.setLayoutData(data);
- return historyButton;
- }
-
- public void setHistoryButtonHeight(int height)
- {
- ((GridData)historyButton.getLayoutData()).heightHint = height;
- ((GridData)historyButton.getLayoutData()).grabExcessVerticalSpace = false;
- ((GridData)historyButton.getLayoutData()).verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- }
-
- public void keyTraversed(TraverseEvent e)
- {
- int detail = e.detail;
- String s = "unknown"; //$NON-NLS-1$
- switch (detail)
- {
- case SWT.TRAVERSE_ARROW_NEXT: s="Arrow Next"; break; //$NON-NLS-1$
- case SWT.TRAVERSE_ARROW_PREVIOUS: s="Arrow Previous"; break; //$NON-NLS-1$
- case SWT.TRAVERSE_ESCAPE: s="Escape"; break; //$NON-NLS-1$
- case SWT.TRAVERSE_RETURN: s="Return"; break; //$NON-NLS-1$
- case SWT.TRAVERSE_TAB_NEXT:
- s="Tab Next"; //$NON-NLS-1$
- //historyButton.setFocus();
- historyButton.forceFocus();
- //e.doit=false;
- break;
- case SWT.TRAVERSE_TAB_PREVIOUS: s="Tab Previous"; break; //$NON-NLS-1$
- }
- System.out.println("keyTraversed: "+s); //$NON-NLS-1$
- }
-
- public void keyPressed(KeyEvent e)
- {
-
- }
- public void keyReleased(KeyEvent e)
- {
- if ((e.stateMask == SWT.CTRL) && (e.keyCode == SWT.ARROW_UP))
- {
- historyButtonPressed();
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java
deleted file mode 100644
index c85b5c068..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java
+++ /dev/null
@@ -1,1188 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- * Martin Oberhuber (Wind River) - [196936] Hide disabled system types
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.ISystemResourceChangeListener;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-import org.eclipse.rse.ui.SystemPreferencesManager;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
-import org.eclipse.rse.ui.model.ISystemShellProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Cursor;
-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.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- * This re-usable widget is for selecting a connection from the master list of connections.
- * The list is subsettable by one or more system types.
- * There is also the option of including a "New" button to the right of the connection
- * dropdown, for the purpose of creating a new connection.
- * <p>
- * Without the New button, the composite is layed as follows:</p>
- * <pre><code>
- * Connection: ______________________v
- * </code></pre>
- * <p>
- * With the New button, the composite is layed as follows:</p>
- * <pre><code>
- * Connection: ______________v New...
- * </code></pre>
- * <p>
- * There are numerous ways to subset the connection list:</p>
- * <ul>
- * <li>By system type, either by a single type or an array of types. Only connections of these types are listed.
- * <li>By subsystem factory. Only connections with subsystems owned by the given subsystem factory are listed.
- * <li>By subsystem factory category. Only connections which contain subsystems owned by subsystem factories which
- * are defined in their xml extension point as being of the given category are listed.
- * For a list of pre-defined categories, see {@link org.eclipse.rse.core.model.ISubSystemConfigurationCategories}.
- * </ul>
- */
-public class SystemHostCombo extends Composite implements ISelectionProvider,
- ISystemCombo, ISystemResourceChangeListener, ISystemShellProvider,
- DisposeListener
-{
- protected Label connectionLabel = null;
- protected Combo connectionCombo = null;
- protected Button newButton = null;
- protected boolean showNewButton = true;
- protected boolean showLabel = true;
- protected boolean showQualifiedNames;
- protected boolean listeningForConnectionEvents = false;
- private IHost[] connections = null;
- private SystemNewConnectionAction newConnectionAction = null;
- private IRSESystemType[] restrictSystemTypesTo = null;
- private int gridColumns = 2;
- //private static final int DEFAULT_COMBO_WIDTH = 300;
- //private static final int DEFAULT_BUTTON_WIDTH = 80;
- private String label;
- private IRSESystemType populateSystemType = null; /* used as criteria when refresh is done */
- private IRSESystemType[] populateSystemTypes = null; /* used as criteria when refresh is done */
- private ISubSystemConfiguration populateSSFactory = null; /* used as criteria when refresh is done */
- private String populateSSFactoryId = null; /* used as criteria when refresh is done */
- private String populateSSFactoryCategory = null; /* used as criteria when refresh is done */
- private Cursor waitCursor;
-
- /**
- * Constructor for SystemConnectionCombo when there is only a single system type to restrict the connection list to.
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
- * @param systemType the system type to restrict the connection list to. Can be null or * for all.
- * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
- * @param showNewButton true if a New... button is to be included in this composite
- */
- public SystemHostCombo(Composite parent, int style, IRSESystemType systemType, IHost defaultConnection, boolean showNewButton)
- {
- super(parent, style);
- restrictSystemTypesTo = new IRSESystemType[1];
- restrictSystemTypesTo[0] = systemType;
- init(parent, showNewButton);
- populateSystemType = systemType;
- populateConnectionCombo(connectionCombo, systemType, defaultConnection, true);
- setConnectionToolTipText();
- addOurConnectionSelectionListener();
- }
- /**
- * Constructor for SystemConnectionCombo when there is an array of system types to restrict the connection list to.
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
- * @param systemTypes the system type array to restrict the connection list to.
- * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
- * @param showNewButton true if a New... button is to be included in this composite
- */
- public SystemHostCombo(Composite parent, int style, IRSESystemType[] systemTypes, IHost defaultConnection, boolean showNewButton)
- {
- super(parent, style);
- restrictSystemTypesTo = systemTypes;
- init(parent, showNewButton);
- populateSystemTypes = systemTypes;
- populateConnectionCombo(connectionCombo, systemTypes, defaultConnection);
- setConnectionToolTipText();
- addOurConnectionSelectionListener();
- }
- /**
- * Constructor for SystemConnectionCombo when there is a subsystem factory to restrict the list to.
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
- * @param ssConfig Only connections with subsystems owned by this factory are returned.
- * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
- * @param showNewButton true if a New... button is to be included in this composite
- */
- public SystemHostCombo(Composite parent, int style, ISubSystemConfiguration ssConfig, IHost defaultConnection, boolean showNewButton)
- {
- super(parent, style);
- restrictSystemTypesTo = ssConfig.getSystemTypes();
- init(parent, showNewButton);
- populateSSFactory = ssConfig;
- populateConnectionCombo(connectionCombo, ssConfig, defaultConnection);
- setConnectionToolTipText();
- addOurConnectionSelectionListener();
- }
- /**
- * Constructor for SystemConnectionCombo when there is a subsystem factory id to restrict the list to.
- * To avoid collision with the constructor that takes a string for the system type, this one places the
- * subystem factory Id string parameter after the defaultConnection constructor
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
- * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
- * @param ssConfigId Only connections with subsystems owned by this configuration are returned.
- * @param showNewButton true if a New... button is to be included in this composite
- */
- public SystemHostCombo(Composite parent, int style, IHost defaultConnection, String ssConfigId, boolean showNewButton)
- {
- super(parent, style);
- restrictSystemTypesTo = RSECorePlugin.getTheSystemRegistry().getSubSystemConfiguration(ssConfigId).getSystemTypes();
- init(parent, showNewButton);
- populateSSFactoryId = ssConfigId;
- populateConnectionCombo(connectionCombo, ssConfigId, defaultConnection);
- setConnectionToolTipText();
- addOurConnectionSelectionListener();
- }
-
- /**
- * Constructor for SystemConnectionCombo when there is a subsystem factory category to restrict the list to.
- * To avoid collision with the constructor that takes a string for the system type, this one places the
- * string parameter at the end.
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
- * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
- * @param showNewButton true if a New... button is to be included in this composite
- * @param ssConfigCategory Only connections with subsystems owned by configurations of this category are returned.
- */
- public SystemHostCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton, String ssConfigCategory)
- {
- this(parent, style, defaultConnection, showNewButton, ssConfigCategory, true);
- }
-
- /**
- * Constructor for SystemConnectionCombo when there is a subsystem factory category to restrict the list to.
- * To avoid collision with the constructor that takes a string for the system type, this one places the
- * string parameter at the end.
- * @param parent Parent composite
- * @param style SWT style flags for overall composite widget. Typically just pass SWT.NULL
- * @param defaultConnection the system connection to preselect. Pass null to preselect first connection.
- * @param showNewButton true if a New... button is to be included in this composite
- * @param ssConfigCategory Only connections with subsystems owned by factories of this category are returned.
- * @param showLabel true if a 'Connection' label is to be included in this composite
- */
- public SystemHostCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton, String ssConfigCategory, boolean showLabel) {
- super(parent, style);
- if (showNewButton) // this is expensive, so only need to do this if New is enabled
- {
- ISubSystemConfigurationProxy[] ssfProxies = RSECorePlugin.getTheSystemRegistry().getSubSystemConfigurationProxiesByCategory(ssConfigCategory);
- Vector vTypes = new Vector();
- for (int idx = 0; idx < ssfProxies.length; idx++) {
- // Do not call ISubSystemConfigurationProxy.getSystemTypes() directly. If
- // some one has overriden ISubSystemConfiguration.getSystemTypes(), the
- // proxy cannot return the correct list anymore. This is especially important
- // if the systemType <--> subsystemConfiguration association is dynamic!
-
- // FIXME MOB: This should be reviewed for lazy plugin loading, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=196942
- IRSESystemType[] types = ssfProxies[idx].getSubSystemConfiguration().getSystemTypes();
- for (int jdx = 0; jdx < types.length; jdx++) {
- IRSESystemType systemType = types[jdx];
- if (!vTypes.contains(systemType)) {
- RSESystemTypeAdapter a = (RSESystemTypeAdapter)systemType.getAdapter(RSESystemTypeAdapter.class);
- if (a!=null && a.isEnabled(systemType)) {
- vTypes.addElement(systemType);
- }
- }
- }
- }
- restrictSystemTypesTo = (IRSESystemType[])vTypes.toArray(new IRSESystemType[vTypes.size()]);
- }
- init(parent, showNewButton, showLabel);
- populateSSFactoryCategory = ssConfigCategory;
- populateConnectionCombo(connectionCombo, defaultConnection, ssConfigCategory);
- setConnectionToolTipText();
- addOurConnectionSelectionListener();
- }
-
- /**
- * Set auto-uppercase. When enabled, all non-quoted values are uppercases when added to the
- * history.
- * <p>
- * This method is part of ISystemCombo, so we must support it, but it does not apply this combo
- * widget since the contents are read-only. Hence, it does nothing!
- */
- public void setAutoUpperCase(boolean enable)
- {
-
- }
-
-
- protected void init(Composite parent, boolean showNewButton)
- {
- init(parent, showNewButton, true);
- }
-
-
- protected void init(Composite parent, boolean showNewButton, boolean showLabel)
- {
- this.showNewButton = showNewButton;
- this.showLabel = showLabel;
- showQualifiedNames = SystemPreferencesManager.getQualifyConnectionNames();
- //prepareComposite(showNewButton ? 3 : 2);
- prepareComposite(3);
-
- if ( showLabel )
- //connectionLabel = SystemWidgetHelpers.createLabel(this,rb,ISystemConstants.WIDGET_CONNECTION_ROOT);
- {
- if (label == null)
- connectionLabel = SystemWidgetHelpers.createLabel(this,SystemResources.WIDGET_CONNECTION_LABEL);
- else
- connectionLabel = SystemWidgetHelpers.createLabel(this,label);
- }
- connectionCombo = createConnectionCombo(this);
- if (showNewButton)
- {
- //newConnectionAction = new SystemNewConnectionAction(parent.getShell(), false, this);
- newConnectionAction = getNewConnectionAction(parent.getShell(), this);
- newConnectionAction.restrictSystemTypes(restrictSystemTypesTo);
- newButton = createPushButton(this,SystemResources.WIDGET_BUTTON_NEWCONNECTION_LABEL,SystemResources.WIDGET_BUTTON_NEWCONNECTION_TOOLTIP);
- addOurButtonSelectionListener();
- if ( !showLabel )
- ((GridData)connectionCombo.getLayoutData()).horizontalSpan = 2;
- }
- else
- {
- if( showLabel )
- ((GridData)connectionCombo.getLayoutData()).horizontalSpan = 2;
- else
- ((GridData)connectionCombo.getLayoutData()).horizontalSpan = 3;
- }
- addDisposeListener(this);
- }
- /**
- * Overridable method.
- * Returns action to be called when New... pressed.
- */
- protected SystemNewConnectionAction getNewConnectionAction(Shell shell, ISelectionProvider selectionProvider)
- {
- return new SystemNewConnectionAction(shell, false, selectionProvider);
- }
-
- /**
- * Get the user selected SystemConnection object.
- * Might be null if the list is empty.
- */
- public IHost getHost()
- {
- IHost connection = null;
- int idx = connectionCombo.getSelectionIndex();
- if ((idx >= 0) && (connections!=null) && (idx<connections.length))
- connection = connections[idx];
- return connection;
- }
-
- /**
- * Return the combo box widget
- */
- public Combo getCombo()
- {
- return connectionCombo;
- }
- /**
- * Set the width hint for this whole composite
- * Default is 180.
- */
- public void setWidthHint(int widthHint)
- {
- // after much research it was decided that it was the wrong thing to do to
- // explicitly set the widthHint of a child widget without our composite, as
- // that could end up being a bigger number than the composites widthHint itself
- // if the caller set its it directly.
- // Rather, we just set the overall composite width and specify the combo child
- // widget is to grab all the space within that which the little button does not use.
- ((GridData)getLayoutData()).widthHint = widthHint;
- }
- /**
- * Set button width hint
- */
- public void setButtonWidthHint(int widthHint)
- {
- if (newButton != null)
- {
- ((GridData)newButton.getLayoutData()).widthHint = widthHint;
- }
- }
- /**
- * Set button width hint, based on the width of another widget
- */
- public void setButtonWidthHint(Control otherWidget)
- {
- if (newButton != null)
- {
- //System.out.println("Curr button width = " + newButton.getSize().x);
- //System.out.println("Setting button width to = " + otherWidget.getSize().x);
- ((GridData)newButton.getLayoutData()).widthHint = otherWidget.getSize().x;
- //System.out.println("New button width = " + newButton.getSize().x);
- }
- //else
- // System.out.println("New button is null");
- }
-
- /**
- * Return the number of grid data columns within this composite.
- * Will vary depending if there is a New button or not.
- */
- public int getGridColumns()
- {
- return gridColumns;
- }
- /**
- * Return the New... button widget
- */
- public Button getNewButton()
- {
- return newButton;
- }
- /**
- * Get the prompt Label widget
- */
- public Label getPromptLabel()
- {
- return connectionLabel;
- }
- /**
- * Set the items in the combo field
- */
- public void setItems(String[] items)
- {
- connectionCombo.setItems(items);
- }
- /**
- * Get the items in the combo field
- */
- public String[] getItems()
- {
- return connectionCombo.getItems();
- }
- /**
- * Return the text in the connection combo entry field.
- * This is only of limited value. You should call getSystemConnection() instead.
- */
- public String getText()
- {
- return connectionCombo.getText();
- }
- /**
- * Disable/Enable all the child controls.
- */
- public void setEnabled(boolean enabled)
- {
- connectionCombo.setEnabled(enabled);
- if (newButton != null)
- newButton.setEnabled(enabled);
- }
- /**
- * Set the tooltip text for the directory combo field
- */
- public void setToolTipText(String tip)
- {
- if ( connectionLabel != null )
- connectionLabel.setToolTipText(tip);
- //connectionCombo.setToolTipText(tip);
- }
- /**
- * Set the tooltip text for the new button
- */
- public void setNewButtonToolTipText(String tip)
- {
- if (newButton != null)
- newButton.setToolTipText(tip);
- }
- /**
- * Same as {@link #setNewButtonToolTipText(String)}
- */
- public void setButtonToolTipText(String tip)
- {
- setNewButtonToolTipText(tip);
- }
-
- /**
- * Set the label to use for the prompt.
- */
- public void setLabel(String label)
- {
- this.label = label;
- if (connectionLabel != null)
- connectionLabel.setText(label);
- }
-
- /**
- * Set the focus to the directory combo field
- */
- public boolean setFocus()
- {
- return connectionCombo.setFocus();
- }
- /**
- * Set the focus to the new button
- */
- public void setNewButtonFocus()
- {
- if (newButton != null)
- newButton.setFocus();
- }
-
- /**
- * Select the combo dropdown list entry at the given index.
- */
- public void select(int selIdx)
- {
- connectionCombo.select(selIdx);
- //if (fireEvent)
- {
- Event e = new Event();
- //e.time = event.time;
- //e.stateMask = event.stateMask;
- //e.doit = event.doit;
- connectionCombo.notifyListeners(SWT.Selection, e);
- }
- }
- /**
- * Same as {@link #select(int)}
- */
- public void setSelectionIndex(int selIdx)
- {
- select(selIdx);
- }
- /**
- * Select a connection from the dropdown
- */
- public void select(IHost connection)
- {
- if (connections != null)
- {
- int matchIdx = -1;
- for (int idx=0; (matchIdx==-1) && (idx<connections.length); idx++)
- if (connection == connections[idx])
- matchIdx = idx;
- if (matchIdx != -1)
- select(matchIdx);
- }
- }
-
-
- /**
- * Deselect
- */
- public void clearSelection()
- {
- connectionCombo.clearSelection();
- connectionCombo.deselectAll();
- Event e = new Event();
- //e.time = event.time;
- //e.stateMask = event.stateMask;
- //e.doit = event.doit;
- connectionCombo.notifyListeners(SWT.Selection, e);
- }
- /**
- * Clear the entered/selected contents of the combo box. Clears only the text selection, not the list selection
- */
- public void clearTextSelection()
- {
- connectionCombo.clearSelection();
- }
-
- /**
- * Get the index number of the currently selected item.
- */
- public int getSelectionIndex()
- {
- return connectionCombo.getSelectionIndex();
- }
-
- /**
- * Register a listener interested in an item is selected in the combo box
- * @see #removeSelectionListener(SelectionListener)
- */
- public void addSelectionListener(SelectionListener listener)
- {
- connectionCombo.addSelectionListener(listener);
- }
- /**
- * Remove a previously set combo box selection listener.
- * @see #addSelectionListener(SelectionListener)
- */
- public void removeSelectionListener(SelectionListener listener)
- {
- connectionCombo.removeSelectionListener(listener);
- }
-
- /**
- * Register a listener interested in when the new button is selected
- * @see #removeNewButtonSelectionListener(SelectionListener)
- */
- public void addNewButtonSelectionListener(SelectionListener listener)
- {
- if (newButton != null)
- newButton.addSelectionListener(listener);
- }
- /**
- * Remove a previously set new button selection listener.
- * @see #addNewButtonSelectionListener(SelectionListener)
- */
- public void removeNewButtonSelectionListener(SelectionListener listener)
- {
- if (newButton != null)
- newButton.removeSelectionListener(listener);
- }
-
- /**
- * Register a listener interested in entry field modify events
- * @see #removeModifyListener(ModifyListener)
- */
- public void addModifyListener(ModifyListener listener)
- {
- connectionCombo.addModifyListener(listener);
- }
- /**
- * Remove a previously set entry field listener.
- * @see #addModifyListener(ModifyListener)
- */
- public void removeModifyListener(ModifyListener listener)
- {
- connectionCombo.removeModifyListener(listener);
- }
-
- // -----------------------
- // INTERNAL-USE METHODS...
- // -----------------------
- /**
- * Prepares this composite control and sets the default layout data.
- * @param numColumns Number of columns the new group will contain.
- */
- protected Composite prepareComposite(int numColumns)
- {
- gridColumns = numColumns;
- Composite composite = this;
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- //layout.horizontalSpacing = 0;
- //layout.verticalSpacing = 0;
- composite.setLayout(layout);
- //GridData
- GridData data = new GridData();
- // horizontal clues
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = showNewButton ? 250 : 200;
- // vertical clues
- data.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING; //GridData.CENTER;
- data.grabExcessVerticalSpace = false; // true;
-
- composite.setLayoutData(data);
- return composite;
- }
- /**
- * Creates a new read-only connection combobox instance and sets the default
- * layout data, with tooltip text.
- * Assign the listener to the passed in implementer of Listener.
- * <p>
- * This fills the combination with the names of all the active connections of the given
- * system type.
- * @param parent composite to put the button into.
- */
- protected Combo createConnectionCombo(Composite parent)
- {
- Combo combo = createCombo(parent,true);
- setToolTipText(SystemResources.WIDGET_CONNECTION_TOOLTIP);
- return combo;
- }
-
- /**
- * Creates a new combobox instance and sets the default
- * layout data.
- * <p>
- * Does NOT set the widthHint as that causes problems. Instead the combo will
- * consume what space is available within this composite.
- * @param parent composite to put the button into.
- */
- public static Combo createCombo(Composite parent, boolean readonly)
- {
- Combo combo = null;
- if (!readonly)
- combo = new Combo(parent, SWT.DROP_DOWN);
- else
- combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- combo.setLayoutData(data);
- return combo;
- }
-
- /**
- * Populates a read-only connection combobox instance with system connections for the given
- * system type.
- * <p>
- * This fills the combination with the names of all the active connections of the given
- * system type.
- * @param combo composite to populate
- * @param systemType the system type to restrict the connection list to. Pass null or * for all system types
- * @param defaultConnection the default system connection to preselect.
- * @param preSelectIfNoMatch true if we should preselect the first item if the given connection is not found
- * @return true if given default connection was found and selected
- */
- protected boolean populateConnectionCombo(Combo combo, IRSESystemType systemType,
- IHost defaultConnection, boolean preSelectIfNoMatch)
- {
- return populateConnectionCombo(combo, systemType, defaultConnection, preSelectIfNoMatch, false);
- }
-
- /**
- * Populates a read-only connection combobox instance with system connections for the given
- * system type.
- * <p>
- * This fills the combination with the names of all the active connections of the given
- * system type.
- * @param combo composite to populate
- * @param systemType the system type to restrict the connection list to. Pass null for all system types
- * @param defaultConnection the default system connection to preselect.
- * @param preSelectIfNoMatch true if we should preselect the first item if the given connection is not found
- * @param appendToCombo indicates whether or not to append to combo with population or replace
- * @return true if given default connection was found and selected
- */
- protected boolean populateConnectionCombo(Combo combo, IRSESystemType systemType, IHost defaultConnection,
- boolean preSelectIfNoMatch, boolean appendToCombo)
- {
- boolean matchFound = false;
- IHost[] additionalConnections = null;
- if (systemType == null) {
- additionalConnections = RSECorePlugin.getTheSystemRegistry().getHosts();
- if (additionalConnections!=null) {
- boolean filtered = false;
- List validHosts = new ArrayList(additionalConnections.length);
- for (int i=0; i<additionalConnections.length; i++) {
- IRSESystemType curSysType = additionalConnections[i].getSystemType();
- RSESystemTypeAdapter a = (RSESystemTypeAdapter)curSysType.getAdapter(RSESystemTypeAdapter.class);
- if (a.isEnabled(curSysType)) {
- validHosts.add(additionalConnections[i]);
- } else {
- filtered = true;
- }
- }
- if (filtered) {
- if (validHosts.size()==0) {
- additionalConnections = null;
- } else {
- additionalConnections = (IHost[])validHosts.toArray(new IHost[validHosts.size()]);
- }
- }
- }
- }
- else {
- RSESystemTypeAdapter a = (RSESystemTypeAdapter)systemType.getAdapter(RSESystemTypeAdapter.class);
- if (a.isEnabled(systemType)) {
- additionalConnections = RSECorePlugin.getTheSystemRegistry().getHostsBySystemType(systemType);
- }
- }
- if (additionalConnections != null)
- {
- String[] connectionNames = new String[additionalConnections.length];
- int selectionIndex = -1;
- for (int idx=0; idx<connectionNames.length; idx++)
- {
- connectionNames[idx] = getConnectionName(additionalConnections[idx]);
- if ((defaultConnection != null) && (additionalConnections[idx] == defaultConnection))
- {
- if (connections == null)
- selectionIndex = idx;
- else
- selectionIndex = connections.length+idx;
- }
- }
- // DKM - fix for 55830
- if (appendToCombo)
- {
- for (int i = 0; i < connectionNames.length; i++)
- combo.add(connectionNames[i]);
- }
- else
- {
- combo.setItems(connectionNames);
- }
- if (selectionIndex >=0)
- {
- //combo.select(selectionIndex);
- select(selectionIndex);
- matchFound = true;
- }
- else if (preSelectIfNoMatch && (combo.getItemCount()>0))
- //combo.select(0);
- select(0);
- }
- if (connections == null)
- connections = additionalConnections;
- else if ((additionalConnections != null) && (additionalConnections.length>0))
- {
- IHost[] totalConnections = new IHost[connections.length+additionalConnections.length];
- int totalIdx = 0;
- for (int idx=0; idx<connections.length; idx++)
- totalConnections[totalIdx++] = connections[idx];
- for (int idx=0; idx<additionalConnections.length; idx++)
- totalConnections[totalIdx++] = additionalConnections[idx];
- connections = totalConnections;
- }
- return matchFound;
- }
- /**
- * Populates a read-only connection combobox instance with system connections for the given
- * array of system types.
- * @param combo composite to populate
- * @param systemTypes the system types to restrict the connection list to. Pass null or * for all system types
- * @param defaultConnection the default system connection to preselect.
- */
- protected void populateConnectionCombo(Combo combo, IRSESystemType[] systemTypes, IHost defaultConnection)
- {
- boolean match = false;
- boolean anyMatch = false;
- for (int idx=0; idx<systemTypes.length; idx++)
- {
- IRSESystemType systemType = systemTypes[idx];
- RSESystemTypeAdapter a = (RSESystemTypeAdapter)systemType.getAdapter(RSESystemTypeAdapter.class);
- if (a.isEnabled(systemType)) {
- match = populateConnectionCombo(combo, systemType, defaultConnection, false, true);
- if (match)
- anyMatch = true;
- }
- }
- if (!anyMatch && (combo.getItemCount()>0))
- //combo.select(0);
- select(0);
- }
- /**
- * Populates a read-only connection combobox instance with system connections which have subsystems
- * owned by the given subsystem factory.
- * <p>
- * @param combo composite to populate
- * @param ssConfig the subsystem factory to restrict the connection list to.
- * @param defaultConnection the default system connection to preselect.
- * @return true if given default connection was found and selected
- */
- protected boolean populateConnectionCombo(Combo combo, ISubSystemConfiguration ssConfig, IHost defaultConnection)
- {
- connections = RSECorePlugin.getTheSystemRegistry().getHostsBySubSystemConfiguration(ssConfig);
- return addConnections(combo, connections, defaultConnection);
- }
- /**
- * Populates a read-only connection combobox instance with system connections which have subsystems
- * owned by a subsystem factory of the given subsystem factory id.
- * <p>
- * @param combo composite to populate
- * @param defaultConnection the default system connection to preselect.
- * @param ssConfigId the subsystem factory id to restrict the connection list by.
- * @return true if given default connection was found and selected
- */
- protected boolean populateConnectionCombo(Combo combo, String ssConfigId, IHost defaultConnection)
- {
- org.eclipse.rse.core.model.ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISubSystemConfiguration config = sr.getSubSystemConfiguration(ssConfigId);
- connections = sr.getHostsBySubSystemConfiguration(config);
- return addConnections(combo, connections, defaultConnection);
- }
-
- /**
- * Populates a read-only connection combobox instance with system connections which have subsystems
- * owned by a subsystem factory of the given subsystem factory category.
- * <p>
- * @param combo composite to populate
- * @param defaultConnection the default system connection to preselect.
- * @param ssConfigCategory the subsystem factory category to restrict the connection list by.
- * @return true if given default connection was found and selected
- */
- protected boolean populateConnectionCombo(Combo combo, IHost defaultConnection, String ssConfigCategory)
- {
- connections = RSECorePlugin.getTheSystemRegistry().getHostsBySubSystemConfigurationCategory(ssConfigCategory);
- return addConnections(combo, connections, defaultConnection);
- }
-
- /**
- * An attempt to get some abstraction
- */
- private boolean addConnections(Combo combo, IHost[] connections, IHost defaultConnection)
- {
- //bug 196936: filter connections for valid system types only
- boolean filtered = false;
- List filteredConnections = new ArrayList(connections.length);
- for (int i=0; i<connections.length; i++) {
- IRSESystemType systemType = connections[i].getSystemType();
- RSESystemTypeAdapter a = (RSESystemTypeAdapter)systemType.getAdapter(RSESystemTypeAdapter.class);
- if (a!=null && a.isEnabled(systemType)) {
- filteredConnections.add(connections[i]);
- } else {
- filtered = true;
- }
-
- }
- if (filtered) {
- connections = (IHost[])filteredConnections.toArray(new IHost[filteredConnections.size()]);
- this.connections = connections;
- }
- boolean matchFound = false;
- if (connections != null)
- {
- String[] connectionNames = new String[connections.length];
- int selectionIndex = -1;
- for (int idx=0; idx<connectionNames.length; idx++)
- {
- connectionNames[idx] = getConnectionName(connections[idx]);
- if ((defaultConnection!=null) && (connections[idx] == defaultConnection))
- selectionIndex = idx;
- }
- combo.setItems(connectionNames);
- if (selectionIndex >=0)
- {
- //combo.select(selectionIndex);
- select(selectionIndex);
- matchFound = true;
- }
- else if (combo.getItemCount()>0)
- //combo.select(0);
- select(0);
- }
- return matchFound;
- }
-
- /**
- * Do string variable substitution. Using you are replacing %1 (say) with a string
- * @param msg message containing substitution variable. Eg "Connect failed with return code &1"
- * @param subOld substitution variable. Eg "%1"
- * @param subNew substitution data. Eg "001"
- * @return message with all occurrences of variable substituted with data.
- */
- protected static String sub(String msg, String subOld, String subNew)
- {
- StringBuffer temp = new StringBuffer();
- int lastHit = 0;
- int newHit = 0;
- for (newHit = msg.indexOf(subOld,lastHit); newHit != -1;
- lastHit = newHit, newHit = msg.indexOf(subOld,lastHit))
- {
- if (newHit >= 0)
- temp.append(msg.substring(lastHit,newHit));
- temp.append(subNew);
- newHit += subOld.length();
- }
- if (lastHit >= 0)
- temp.append(msg.substring(lastHit));
- return temp.toString();
- }
-
- /**
- * Return the connection name to display in the combo, given the connection
- */
- private String getConnectionName(IHost conn)
- {
- //String connectionName = sub(nameString,"%1",conn.getAliasName());
- //connectionName = sub(connectionName,"%2",conn.getSystemProfileName());
- //return connectionName;
- if (showQualifiedNames)
- return conn.getSystemProfileName() + "." + conn.getAliasName(); //$NON-NLS-1$
- else
- return conn.getAliasName();
- }
-
-
- /**
- * Refresh the list of connections
- */
- public void refreshConnections()
- {
- connections = null;
- connectionCombo.removeAll();
-
- if ( populateSystemType != null )
- {
- populateConnectionCombo(connectionCombo, populateSystemType, null, false);
- }
- else if ( populateSystemTypes != null )
- {
- populateConnectionCombo(connectionCombo, populateSystemTypes, null);
- }
- else if ( populateSSFactory != null )
- {
- populateConnectionCombo(connectionCombo, populateSSFactory, null);
- }
- else if ( populateSSFactoryId != null )
- {
- populateConnectionCombo(connectionCombo, populateSSFactoryId, null);
- }
- else if ( populateSSFactoryCategory != null )
- {
- populateConnectionCombo(connectionCombo, null, populateSSFactoryCategory);
- }
- }
-
- /**
- * This is the method in your class that will be called when a
- * system resource changes. We want to listen to connection changes.
- * @see ISystemResourceChangeEvent
- */
- public void systemResourceChanged(ISystemResourceChangeEvent event)
- {
- int type = event.getType();
- Object src = event.getSource();
- //Object parent = event.getParent();
- switch ( type )
- {
- case ISystemResourceChangeEvents.EVENT_ADD:
- case ISystemResourceChangeEvents.EVENT_ADD_RELATIVE:
- case ISystemResourceChangeEvents.EVENT_DELETE_MANY:
- case ISystemResourceChangeEvents.EVENT_RENAME:
- if ( src instanceof IHost )
- {
- // if RENAME, update showQualifiedNames in case it changed
- if ( type == ISystemResourceChangeEvents.EVENT_RENAME )
- showQualifiedNames = SystemPreferencesManager.getQualifyConnectionNames();
-
- refreshConnections();
- }
- break;
- }
- }
-
- /**
- * Have the SystemConnectionCombo listen to add/delete/rename events on connections
- * and automatically update it's list of connections
- */
- public void listenToConnectionEvents(boolean start)
- {
- if ( start )
- {
- // ----------------------------------------
- // register with system registry for events
- // ----------------------------------------
- listeningForConnectionEvents = true;
- RSECorePlugin.getTheSystemRegistry().addSystemResourceChangeListener(this);
- }
- else
- {
- // ----------------------------------------
- // remove register with system registry for events
- // ----------------------------------------
- listeningForConnectionEvents = false;
- RSECorePlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
- }
- }
- /**
- * We are going away. De-Register ourselves as a listener for system resource change events
- */
- public void widgetDisposed(DisposeEvent e)
- {
- if (listeningForConnectionEvents)
- {
- listeningForConnectionEvents = false;
- RSECorePlugin.getTheSystemRegistry().removeSystemResourceChangeListener(this);
- }
- }
-
- protected void addOurButtonSelectionListener()
- {
- // Add the button listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- setBusyCursor(true);
- newConnectionAction.run();
- setBusyCursor(false);
- IHost newConnection = (IHost)newConnectionAction.getValue();
- //System.out.println("newConnection == " + newConnection);
- if (newConnection != null )
- {
-
- // if listening for events, combo box will be updated automatically
- if ( listeningForConnectionEvents )
- {
- select(newConnection); // it should be added by now
- }
- // if not listening for events, add new connection
- else
- {
- if (connections == null)
- {
- connections = new IHost[1];
- connections[0] = newConnection;
- addConnections(connectionCombo,connections,newConnection);
- //connectionCombo.select(0);
- }
- else
- {
- IHost[] totalConnections = new IHost[connections.length+1];
- int totalIdx = 0;
- for (int idx=0; idx<connections.length; idx++)
- totalConnections[totalIdx++] = connections[idx];
- totalConnections[totalIdx] = newConnection;
- connections = totalConnections;
- addConnections(connectionCombo,connections,newConnection);
- //connectionCombo.select(totalIdx);
- }
- }
- }
- }
- };
- newButton.addSelectionListener(selectionListener);
- }
-
- protected void addOurConnectionSelectionListener()
- {
- // Add the combo listener
- SelectionListener selectionListener = new SelectionAdapter()
- {
- public void widgetSelected(SelectionEvent event)
- {
- setConnectionToolTipText();
- }
- };
- connectionCombo.addSelectionListener(selectionListener);
- }
-
- protected void setConnectionToolTipText()
- {
- String tooltipText = ""; //$NON-NLS-1$
- IHost currConn = getHost();
- if (currConn != null)
- tooltipText = currConn.getHostName();
- connectionCombo.setToolTipText(tooltipText);
- }
-
- protected static Button createPushButton(Composite group, String label)
- {
- Button button = new Button(group, SWT.PUSH);
- button.setText(label);
- GridData data = new GridData();
- //data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = false;
- button.setLayoutData(data);
- return button;
- }
-
- protected static Button createPushButton(Composite group, String label, String tooltip)
- {
- Button button = createPushButton(group,label);
- button.setToolTipText(tooltip);
- return button;
- }
-
- // -----------------------------
- // ISelectionProvider methods...
- // -----------------------------
- /**
- * Register a listener interested in an item is selected in the combo box
- * @see #removeSelectionChangedListener(ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- //connectionCombo.addSelectionChangedListener(listener);
- }
- /**
- * Remove a previously set combo box selection listener.
- * @see #addSelectionChangedListener(ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- //connectionCombo.removeSelectionChangedListener(listener);
- }
-
- public ISelection getSelection()
- {
- ISelection selection = StructuredSelection.EMPTY;
- IHost connection = getHost();
- if (connection != null)
- selection = new StructuredSelection(connection);
- return selection;
- }
- public void setSelection(ISelection selection)
- {
- }
-
- public IHost[] getConnections()
- {
- return connections;
- }
-
- public void setConnections(IHost[] input)
- {
- connections = input;
- }
-
- /**
- * <i>Helper method.</i><br>
- * Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
- */
- protected void setBusyCursor(boolean setBusy)
- {
- if (setBusy)
- {
- // Set the busy cursor to all shells.
- Display d = getShell().getDisplay();
- waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
- org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), waitCursor);
- }
- else
- {
- org.eclipse.rse.ui.dialogs.SystemPromptDialog.setDisplayCursor(getShell(), null);
- if (waitCursor != null)
- waitCursor.dispose();
- waitCursor = null;
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java
deleted file mode 100644
index e07ab5961..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemPortPrompt.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [195399] Improve String display for default port 0
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.internal.ui.SystemPropertyResources;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.SystemNumericVerifyListener;
-import org.eclipse.rse.ui.validators.ValidatorPortInput;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.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;
-
-
-/**
- * A composite encapsulating the GUI widgets for prompting for a port. Used in the core SubSystem property
- * page but also be instantiated and used anywhere.
- */
-public class SystemPortPrompt
- //extends Composite
- implements SelectionListener
-{
-
- private Composite composite_prompts;
- //private Label labelPortPrompt;
- private Label labelPort;
- private InheritableEntryField textPort;
- protected SystemMessage errorMessage;
-
- protected boolean portEditable=true;
- protected boolean portApplicable=true;
- protected int existingPortValue;
- // validators
- protected ISystemValidator portValidator;
- // Inputs from caller
- protected ISystemMessageLine msgLine;
-
- /**
- * A listener for state changes to the port entry inheritable field.
- */
- private class PortFieldStateChangeListener implements IInheritableEntryFieldStateChangeListener {
-
- private SystemNumericVerifyListener verifyListener;
-
- /**
- * Constructor.
- * @param verifyListener the verify listener for the port field.
- */
- private PortFieldStateChangeListener(SystemNumericVerifyListener verifyListener) {
- this.verifyListener = verifyListener;
- }
-
- /**
- * Turns the verifier off if the state of the inheritable entry field is not local, turns it on otherwise.
- * @see org.eclipse.rse.ui.widgets.IInheritableEntryFieldStateChangeListener#stateChanged(org.eclipse.rse.ui.widgets.InheritableEntryField)
- */
- public void stateChanged(InheritableEntryField field) {
-
- if (field.isLocal()) {
- verifyListener.setOff(false);
- }
- else {
- verifyListener.setOff(true);
- }
- }
- }
-
- /**
- * Constructor when you want a new composite to hold the child controls
- */
- public SystemPortPrompt(Composite parent, int style, ISystemMessageLine msgLine,
- boolean wantLabel, boolean isPortEditable,
- int existingPortValue, ISystemValidator portValidator)
- {
- //super(parent, style);
- //composite_prompts = this;
- composite_prompts = new Composite(parent, style);
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = wantLabel ? 2 : 1;
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- composite_prompts.setLayout(gridLayout);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = false;
- composite_prompts.setLayoutData(gridData);
-
- init(composite_prompts, msgLine, wantLabel, isPortEditable, existingPortValue, portValidator);
-
- composite_prompts.pack();
- }
- /**
- * Constructor when you have an existing composite to hold the child controls
- */
- public SystemPortPrompt(Composite composite_prompts, ISystemMessageLine msgLine,
- boolean wantLabel, boolean isPortEditable,
- int existingPortValue, ISystemValidator portValidator)
- {
- this.composite_prompts = composite_prompts;
-
- init(composite_prompts, msgLine, wantLabel, isPortEditable, existingPortValue, portValidator);
- }
-
- /**
- * Get user-entered Port number.
- */
- public int getPort()
- {
- if (isEditable())
- {
- String port = textPort.getLocalText(); // will be "" if !textPort.getIsLocal(), which results in wiping out local override
- Integer portInteger = null;
- if (textPort.isLocal() && (port.length()>0))
- portInteger = new Integer(port);
- else
- portInteger = new Integer(0);
- return portInteger.intValue();
- }
- else
- return existingPortValue;
- }
- /**
- * Return user-enter Port number as a string
- */
- public String getPortString()
- {
- return internalGetPort();
- }
-
- /**
- * Return true if port is user-editable
- */
- public boolean isEditable()
- {
- return (portEditable && portApplicable);
- }
-
- /**
- * Return true if current port value is without error
- */
- public boolean isComplete()
- {
- if (!isEditable())
- return true;
- else
- return ((errorMessage==null) && (internalGetPort().length()>0));
- }
-
- /**
- * Set the initial port value
- */
- public void setPort(int port)
- {
- // port
- if (portEditable || portApplicable)
- {
- String localPort = null;
-
- localPort = "" + port; //$NON-NLS-1$
- int iPort = port;
- if (!portEditable) // applicable but not editable
- labelPort.setText(localPort);
- else // editable
- {
- textPort.setLocalText(localPort);
- textPort.setInheritedText(NLS.bind(SystemPropertyResources.RESID_PORT_DYNAMICSELECT, new Integer(0)));
- textPort.setLocal(iPort != 0);
- }
- }
- }
-
- /**
- * Set the focus
- */
- public boolean setFocus()
- {
- if (textPort != null)
- {
- textPort.getTextField().setFocus();
- return true;
- }
- else
- return composite_prompts.setFocus();
- }
-
- /**
- * Reset to original value
- */
- public void setDefault()
- {
- setPort(existingPortValue);
- }
-
- /**
- * Return the entry field or label for the port prompt
- */
- public Control getPortField()
- {
- if (textPort != null)
- return textPort.getTextField();
- else
- return labelPort;
- }
-
- /**
- * Validate port value per keystroke
- */
- public SystemMessage validatePortInput()
- {
- boolean wasInError = (errorMessage != null);
- errorMessage= null;
- if (textPort!=null)
- {
- if (!textPort.isLocal())
- {
- if (wasInError)
- clearErrorMessage();
- return null;
- }
- if (portValidator != null)
- errorMessage= portValidator.validate(textPort.getText().trim());
- else if (internalGetPort().equals("")) //$NON-NLS-1$
- errorMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_USERID_EMPTY);
- }
- if (errorMessage == null)
- {
- if (wasInError)
- clearErrorMessage();
- }
- else
- setErrorMessage(errorMessage);
- //setPageComplete();
- return errorMessage;
- }
-
- // -------------------
- // INTERNAL METHODS...
- // -------------------
- /**
- * Initialize vars, create and init prompts
- */
- protected void init(Composite composite_prompts, ISystemMessageLine msgLine,
- boolean wantLabel, boolean isPortEditable,
- int existingPortValue, ISystemValidator portValidator)
- {
- this.msgLine = msgLine;
- this.portEditable = isPortEditable;
- this.existingPortValue = existingPortValue;
- if (portValidator == null)
- portValidator = new ValidatorPortInput();
- this.portValidator = portValidator;
-
- createPortPrompt(composite_prompts, wantLabel);
- setPort(existingPortValue);
-
- if (textPort != null)
- {
- textPort.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- //System.out.println("in modify text '"+internalGetPort()+"'");
- validatePortInput();
- }
- });
-
- SystemNumericVerifyListener verifyListener = new SystemNumericVerifyListener();
- textPort.getTextField().addVerifyListener(verifyListener);
- textPort.addStateChangeListener(new PortFieldStateChangeListener(verifyListener));
- }
- }
-
- /**
- * Return user-entered Port number.
- */
- protected String internalGetPort()
- {
- if (textPort != null)
- return textPort.getText().trim();
- else
- return labelPort.getText();
- }
-
- /**
- * Create GUI widgets
- */
- protected void createPortPrompt(Composite composite_prompts, boolean wantLabel)
- {
- // Port prompt
- String portRange = " (1-" + ValidatorPortInput.MAXIMUM_PORT_NUMBER + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- if (wantLabel) {
- String labelText = SystemWidgetHelpers.appendColon(SystemResources.RESID_SUBSYSTEM_PORT_LABEL + portRange);
- /*labelPortPrompt =*/ SystemWidgetHelpers.createLabel(composite_prompts, labelText);
- }
- portApplicable = isPortApplicable();
- portEditable = isPortEditable();
- if (isEditable())
- {
- textPort = SystemWidgetHelpers.createInheritableTextField(
- composite_prompts,SystemResources.RESID_SUBSYSTEM_PORT_INHERITBUTTON_TIP,SystemResources.RESID_SUBSYSTEM_PORT_TIP);
- textPort.setFocus();
- }
- else
- {
- String labelValue = " "; //$NON-NLS-1$
- if (!portApplicable)
- labelValue = getTranslatedNotApplicable();
- labelPort = SystemWidgetHelpers.createLabel(composite_prompts, labelValue);
- }
- }
-
- /**
- * Return true if the port is applicable.
- * For this to be false, the caller must state the port is not editable,
- * and the port value must be null or Integer(-1).
- */
- protected boolean isPortApplicable()
- {
- if (!isPortEditable() && (existingPortValue==-1))
- return false;
- else
- return true;
- }
- /**
- * Return true if the port is editable for this subsystem
- */
- protected boolean isPortEditable()
- {
- return portEditable;
- }
-
- /**
- * Return "Not applicable" translated
- */
- private String getTranslatedNotApplicable()
- {
- return SystemPropertyResources.RESID_TERM_NOTAPPLICABLE;
- }
-
- protected void setErrorMessage(SystemMessage msg)
- {
- if (msgLine != null)
- msgLine.setErrorMessage(msg);
- }
- protected void clearErrorMessage()
- {
- if (msgLine != null)
- msgLine.clearErrorMessage();
- }
-
-
- // SELECTIONLISTENER...
- public void widgetDefaultSelected(SelectionEvent event)
- {
- }
- public void widgetSelected(SelectionEvent event)
- {
- //System.out.println("Inside widgetSelected. textPort.isLocal(): " + textPort.isLocal());
- if (textPort.isLocal()) // from local to non-local
- {
- /* I don't know why I did this! Phil. Removed for defect 44132
- if (errorMessage != null)
- {
- errorMessage = null;
- clearErrorMessage();
- } */
- }
- else
- {
- //validatePortInput(); doesn't work because it is called before the toggle
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServiceElement.java
deleted file mode 100644
index d6acc6b36..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServiceElement.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.graphics.Image;
-
-
-
-
-public class ConnectorServiceElement extends RSEModelServiceElement
-{
-
- private IConnectorService _connectorService;
- private ImageDescriptor _imageDescriptor;
- private ServiceElement[] _children;
-
- public ConnectorServiceElement(IHost host, ServiceElement parent, IConnectorService connectorService)
- {
- super(host, parent, connectorService);
- _connectorService = connectorService;
-
- }
-
- public IConnectorService getConnectorService()
- {
- return _connectorService;
- }
-
- public Image getImage()
- {
- if (_imageDescriptor == null)
- {
- _imageDescriptor= RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_CONNECTOR_SERVICE_ID);
- }
- return _imageDescriptor.createImage();
- }
-
- public String getName()
- {
- return _connectorService.getName();
- }
-
- public boolean internalHasChildren()
- {
- return _connectorService.hasRemoteServerLauncherProperties();
- }
-
- public ServiceElement[] internalGetChildren()
- {
- if (_children == null)
- {
- IServerLauncherProperties properties = _connectorService.getRemoteServerLauncherProperties();
- ServiceElement child = new ServerLauncherPropertiesServiceElement(getHost(), this, properties);
- return new ServiceElement[] { child};
- }
- return _children;
- }
-
- public void commit()
- {
- super.commit();
- ServiceElement[] children = getChildren();
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- ServiceElement child = children[i];
- child.commit();
- }
- }
- _connectorService.commit();
- }
-
- public void revert()
- {
- super.revert();
- ServiceElement[] children = getChildren();
- if (children != null)
- {
- for (int i = 0; i < children.length; i++)
- {
- ServiceElement child = children[i];
- child.revert();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServicesForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServicesForm.java
deleted file mode 100644
index 0e5469c11..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ConnectorServicesForm.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.layout.FillLayout;
-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.Text;
-import org.eclipse.swt.widgets.Tree;
-
-
-
-public class ConnectorServicesForm extends SystemBaseForm
-{
- private TreeViewer _serviceViewer;
- private SystemPropertySheetForm _propertiesViewer;
- private Text _descriptionVerbiage;
-
- private String _serviceTooltip = SystemResources.RESID_SERVICESFORM_CONNECTORSERVICES_TOOLTIP;
- private String _propertiesTooltip = SystemResources.RESID_SERVICESFORM_PROPERTIES_TOOLTIP;
-
-
- public ConnectorServicesForm(ISystemMessageLine msgLine)
- {
- super(null, msgLine);
- }
-
- public Control createContents(Composite parent)
- {
-
- SashForm sashComposite = new SashForm(parent, SWT.VERTICAL);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- sashComposite.setLayoutData(data);
-
-
- // connector service composite
- Composite serviceViewerComposite = new Composite(sashComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- serviceViewerComposite.setLayout(layout);
- serviceViewerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- //serviceViewerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Label servicesLabel = new Label(serviceViewerComposite, SWT.NONE);
- servicesLabel.setText(SystemResources.RESID_PROPERTIES_SERVICES_LABEL);
- createServiceViewer(serviceViewerComposite);
-
- // properties composite
- Composite servicePropertiesComposite = new Composite(sashComposite, SWT.NONE);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- servicePropertiesComposite.setLayout(layout);
- servicePropertiesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- //setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- Label propertiesLabel = new Label(servicePropertiesComposite, SWT.NONE);
- propertiesLabel.setText(SystemResources.RESID_PROPERTIES_PROPERTIES_LABEL);
- propertiesLabel.setToolTipText(SystemResources.RESID_PROPERTIES_PROPERTIES_TOOLTIP);
- createPropertiesViewer(servicePropertiesComposite);
-
- // description composite
- Composite descriptionComposite = new Composite(sashComposite, SWT.NONE);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- descriptionComposite.setLayout(layout);
- descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- Label descriptionLabel = new Label(descriptionComposite, SWT.NONE);
- descriptionLabel.setText(SystemResources.RESID_PROPERTIES_DESCRIPTION_LABEL);
- _descriptionVerbiage = new Text(descriptionComposite, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
- _descriptionVerbiage.setText(getCurrentVerbiage());
- _descriptionVerbiage.setEditable(false);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.widthHint = 150;
- gridData.verticalAlignment = GridData.BEGINNING;
- _descriptionVerbiage.setLayoutData(data);
-
- sashComposite.setWeights(new int[] { 20, 30, 10 });
-
-
- _serviceViewer.addSelectionChangedListener(new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection selection = event.getSelection();
- _propertiesViewer.selectionChanged(selection);
- _descriptionVerbiage.setText(getCurrentVerbiage());
- }
- });
-
- return _serviceViewer.getControl();
- }
-
-
- private void createServiceViewer(Composite parent)
- {
- // Create the table viewer.
- _serviceViewer = new TreeViewer(parent, SWT.BORDER);
- // Create the table control.
- Tree tableTree = _serviceViewer.getTree();
-
- tableTree.setLayout(new FillLayout());
- tableTree.setToolTipText(_serviceTooltip);
- _serviceViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
- _serviceViewer.setContentProvider(new ServiceTableContentProvider());
- _serviceViewer.setLabelProvider(new ServiceTableLabelProvider());
-
- }
-
- private void createPropertiesViewer(Composite parent)
- {
- _propertiesViewer = new SystemPropertySheetForm(getShell(),parent, SWT.BORDER, getMessageLine(), 1, 1);
- _propertiesViewer.setToolTipText(_propertiesTooltip);
- }
-
- public void init(ServiceElement root)
- {
- _serviceViewer.setInput(root);
- }
-
- public boolean performOk()
- {
- return true;
- }
-
- protected String getCurrentVerbiage()
- {
- if (_serviceViewer == null)
- return ""; //$NON-NLS-1$
- else
- {
- IStructuredSelection serviceSelection = (IStructuredSelection)_serviceViewer.getSelection();
- if (serviceSelection == null || serviceSelection.isEmpty())
- {
- return ""; //$NON-NLS-1$
- }
- else
- {
- String description = ((ServiceElement)serviceSelection.getFirstElement()).getDescription();
- return description!=null ? description : ""; //$NON-NLS-1$
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/FactoryServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/FactoryServiceElement.java
deleted file mode 100644
index 00c520dfa..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/FactoryServiceElement.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David Dykstal (IBM) - [217556] remove service subsystem types
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import org.eclipse.rse.core.model.DummyHost;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.IDelegatingConnectorService;
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.services.IService;
-
-
-
-
-public class FactoryServiceElement extends ServiceElement
-{
-
- private ISubSystemConfiguration _factory;
- private ServiceElement[] _children;
-
-
- /**
- * Constructor. Used to accept an IServiceSubSystemConfiguration before RSE
- * 3.0
- *
- * @since 3.0
- */
- public FactoryServiceElement(IHost host, ISubSystemConfiguration factory)
- {
- super(host, null);
- _factory = factory;
- }
-
- public String getName()
- {
- return _factory.getId();
- }
-
- public String getDescription()
- {
- return _factory.getDescription();
- }
-
- /**
- * Return the subsystem configuration related to this service element. Used
- * to return an IServiceSubSystemConfiguration before RSE 3.0.
- *
- * @since 3.0
- */
- public ISubSystemConfiguration getFactory()
- {
- return _factory;
- }
-
- public IConnectorService getConnectorService()
- {
- IHost host = getHost();
- IConnectorService connectorService = _factory.getConnectorService(host);
- return connectorService;
- }
-
- public IService getService()
- {
- IHost host = getHost();
- IService service = _factory.getService(host);
- return service;
- }
-
- public ServiceElement[] getChildren()
- {
- if (_children == null)
- {
- IHost host = getHost();
-
- ServiceServiceElement serviceElement = new ServiceServiceElement(host, this, getService());
-
- IConnectorService connectorService = getConnectorService();
- if (connectorService != null && !(connectorService instanceof IDelegatingConnectorService))
- {
- _children = new ServiceElement[2];
- _children[0] = serviceElement;
- _children[1] = new ConnectorServiceElement(host, this, connectorService);
- if (host instanceof DummyHost)
- {
- IServerLauncherProperties sl = connectorService.getRemoteServerLauncherProperties();
- if (sl == null)
- {
- sl = _factory.createServerLauncher(connectorService);
- connectorService.setRemoteServerLauncherProperties(sl);
- }
- }
- }
- else
- {
- _children = new ServiceElement[1];
- _children[0] = serviceElement;
- }
- }
- return _children;
-
- }
-
- public boolean hasChildren()
- {
- return true;
- }
-
- public boolean hasPropertySets()
- {
- return false;
- }
-
- public PropertySetServiceElement[] getPropertySets()
- {
- return null;
- }
-
- public boolean hasProperties()
- {
- return false;
- }
-
- public PropertyElement[] getProperties()
- {
- return null;
- }
-
- public void commit()
- {
- if (_isSelected)
- {
- ServiceElement[] children = getChildren();
- for (int i = 0; i < children.length; i++)
- {
- //if (children[i].isSelected())
- children[i].commit();
- }
- }
- }
-
- public void revert()
- {
- ServiceElement[] children = getChildren();
- for (int i = 0; i < children.length; i++)
- {
- children[i].revert();
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertyElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertyElement.java
deleted file mode 100644
index 66f3b3396..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertyElement.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import org.eclipse.rse.core.model.IProperty;
-import org.eclipse.rse.core.model.IPropertyType;
-import org.eclipse.rse.core.model.Property;
-import org.eclipse.rse.internal.ui.view.SystemComboBoxPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-
-
-
-public class PropertyElement
-{
- private IPropertyDescriptor _propertyDescriptor;
- private IProperty _property;
- private IProperty _originalProperty;
- private String _value;
-
- public PropertyElement(ServiceElement parent, IProperty property)
- {
- _property = property;
- _originalProperty = new Property(_property);
- _value = _property.getValue();
- }
-
- public IPropertyType getType()
- {
- return _property.getType();
- }
-
- public String getKey()
- {
- return _property.getKey();
- }
-
- public String getName()
- {
- return getLabel();
- }
-
- public String getLabel()
- {
- return _property.getLabel();
- }
-
- public String getValue()
- {
- return _value;
- }
-
-
- public void setValue(String value)
- {
- _value = value;
- _property.setValue(_value);
- }
-
- public IPropertyDescriptor getPropertyDescriptor()
- {
- if (_propertyDescriptor == null)
- {
- switch (_property.getType().getType())
- {
- case IPropertyType.TYPE_INTEGER:
- _propertyDescriptor = new TextPropertyDescriptor(getKey(), getLabel());
- break;
- case IPropertyType.TYPE_ENUM:
- SystemComboBoxPropertyDescriptor comboDescriptor = new SystemComboBoxPropertyDescriptor(getKey(), getLabel(), _property.getType().getEnumValues());
- _propertyDescriptor = comboDescriptor;
- break;
- case IPropertyType.TYPE_STRING:
- default:
- _propertyDescriptor = new TextPropertyDescriptor(getKey(), getLabel());
- break;
- }
- }
- return _propertyDescriptor;
- }
-
- public void commit()
- {
- /* already committed
- if (_value != _property.getValue())
- {
- _property.setValue(_value);
- }
- */
-
- }
-
- public void revert()
- {
- if (_originalProperty.getValue() != _property.getValue())
- {
- _property.setValue(_originalProperty.getValue());
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java
deleted file mode 100644
index f38643fd6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/PropertySetServiceElement.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ILabeledObject;
-import org.eclipse.rse.core.model.IProperty;
-import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.core.model.IPropertyType;
-import org.eclipse.rse.core.model.PropertySet;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-
-public class PropertySetServiceElement extends ServiceElement
-implements IPropertySource
-{
- protected PropertyElement[] _properties;
- protected IPropertySet _propertySet;
- protected IPropertySet _originalPropertySet;
-
- public PropertySetServiceElement(IHost host, ServiceElement parent, IPropertySet propertySet)
- {
- super(host, parent);
- _propertySet = propertySet;
- _originalPropertySet = new PropertySet(_propertySet);
- }
-
- public IPropertySet getOriginalProperySet()
- {
- return _originalPropertySet;
- }
-
- public IPropertySet getPropertySet()
- {
- return _propertySet;
- }
-
- public Image getImage()
- {
- return RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_PROPERTIES_ID);
- }
-
- public String getName()
- {
- if (_propertySet instanceof ILabeledObject) {
- ILabeledObject ps = (ILabeledObject) _propertySet;
- return ps.getLabel();
- }
- return _propertySet.getName();
- }
-
- public String getDescription()
- {
- return _propertySet.getDescription();
- }
-
- public boolean hasChildren()
- {
- return false;
- }
-
- public ServiceElement[] getChildren()
- {
- return null;
- }
-
- public void refreshProperties()
- {
- _properties = null;
-
- }
-
- public boolean hasProperties()
- {
- return _propertySet.getPropertyKeys().length > 0;
- }
-
- public PropertyElement[] getProperties()
- {
- if (_properties == null)
- {
- String[] keys = _propertySet.getPropertyKeys();
- List enabledProperties = new ArrayList();
-
- for (int i = 0; i < keys.length; i++)
- {
- String key = keys[i];
- IProperty property = _propertySet.getProperty(key);
- if (property.isEnabled())
- {
- enabledProperties.add(new PropertyElement(this, property));
- }
- }
- _properties =(PropertyElement[])enabledProperties.toArray(new PropertyElement[enabledProperties.size()]);
- }
- return _properties;
- }
-
-
- public IPropertyDescriptor[] getPropertyDescriptors()
- {
- PropertyElement[] properties = getProperties();
- IPropertyDescriptor[] descriptors = new IPropertyDescriptor[properties.length];
- for (int i = 0; i < properties.length; i++)
- {
- descriptors[i] = properties[i].getPropertyDescriptor();
- }
- return descriptors;
- }
-
- private PropertyElement getPropertyElement(String id)
- {
- PropertyElement[] elements = getProperties();
- for (int i = 0; i < elements.length; i++)
- {
- PropertyElement element = elements[i];
- if (element.getKey().equals(id))
- {
- return element;
- }
- }
- return null;
- }
-
- public Object getPropertyValue(Object id)
- {
- return getPropertyElement((String)id).getValue();
- }
-
- public boolean isPropertySet(Object id)
- {
- return getPropertyElement((String)id) != null;
- }
-
- public void resetPropertyValue(Object id)
- {
- // update ui object
- PropertyElement element = getPropertyElement((String)id);
- if (element.getKey().equals(id))
- {
- element.setValue(_propertySet.getPropertyValue((String)id));
- }
- }
-
- public void setPropertyValue(Object id, Object value)
- {
- PropertyElement element = getPropertyElement((String)id);
- String strValue = null;
- if (value instanceof Integer)
- {
- Integer intValue = (Integer)value;
-
- IPropertyType type = element.getType();
- if (type.isEnum())
- {
- strValue = type.getEnumValues()[intValue.intValue()];
- }
- else if (type.isInteger())
- {
- strValue = intValue.toString();
- }
- }
- else
- {
- strValue = (String)value;
- }
-
-
-
- if (element.getKey().equals(id))
- {
- element.setValue(strValue);
- }
-
- refreshProperties();
- childChanged(this);
- }
-
- public Object getEditableValue()
- {
- return this;
- }
-
- public void commit()
- {
- PropertyElement[] properties = getProperties();
- for (int i = 0; i < properties.length; i++)
- {
- properties[i].commit();
- }
- }
-
- public void revert()
- {
- PropertyElement[] properties = getProperties();
- for (int i = 0; i < properties.length; i++)
- {
- properties[i].revert();
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RSEModelServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RSEModelServiceElement.java
deleted file mode 100644
index 4562ff20b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RSEModelServiceElement.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.core.model.IRSEModelObject;
-
-
-public abstract class RSEModelServiceElement extends ServiceElement
-{
- protected IRSEModelObject _modelObject;
- protected IPropertySet[] _propertySets;
- protected PropertySetServiceElement[] _propertySetElements;
- protected ServiceElement[] _allChildren;
-
- public RSEModelServiceElement(IHost host, ServiceElement parent, IRSEModelObject modelObject)
- {
- super(host, parent);
- _modelObject = modelObject;
- _propertySets = _modelObject.getPropertySets();
- }
-
-
-
- public boolean hasPropertySets()
- {
- return _propertySets != null && _propertySets.length > 0;
- }
-
- public PropertySetServiceElement[] getPropertySets()
- {
- if (_propertySetElements == null)
- {
- _propertySetElements = new PropertySetServiceElement[_propertySets.length];
- for (int i = 0; i < _propertySets.length; i++)
- {
- _propertySetElements[i] = new PropertySetServiceElement(getHost(), this, _propertySets[i]);
- }
- }
- return _propertySetElements;
- }
-
- public String getName()
- {
- return _modelObject.getName();
- }
-
- public String getDescription()
- {
- return _modelObject.getDescription();
- }
-
- public final boolean hasChildren()
- {
- return internalHasChildren() || hasPropertySets();
- }
-
- public final ServiceElement[] getChildren()
- {
- if (_allChildren == null)
- {
- List all = new ArrayList();
-
- if (internalHasChildren())
- {
- ServiceElement[] children = internalGetChildren();
- for (int i = 0; i < children.length; i++)
- {
- all.add(children[i]);
- }
- }
-
- if (hasPropertySets())
- {
- PropertySetServiceElement[] properties = getPropertySets();
- for (int p = 0; p < properties.length; p++)
- {
- all.add(properties[p]);
- }
- }
- _allChildren = (ServiceElement[])all.toArray(new ServiceElement[all.size()]);
- }
- return _allChildren;
- }
-
- public boolean hasProperties()
- {
- return false;
- }
-
-
- public PropertyElement[] getProperties()
- {
- return null;
- }
-
- public void commit()
- {
- PropertySetServiceElement[] sets = getPropertySets();
- for (int i = 0; i < sets.length; i++)
- {
- sets[i].commit();
- }
- }
-
- public void revert()
- {
- PropertySetServiceElement[] sets = getPropertySets();
- for (int i = 0; i < sets.length; i++)
- {
- IPropertySet newSet = sets[i].getPropertySet();
- IPropertySet originalSet = sets[i].getOriginalProperySet();
- _modelObject.removePropertySet(newSet.getName());
- _modelObject.addPropertySet(originalSet);
- }
- }
-
- public void refreshProperties()
- {
- PropertySetServiceElement[] propertySets = getPropertySets();
- for (int i = 0; i < propertySets.length; i++)
- {
- propertySets[i].refreshProperties();
- }
- }
-
- protected abstract ServiceElement[] internalGetChildren();
- protected abstract boolean internalHasChildren();
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RootServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RootServiceElement.java
deleted file mode 100644
index 30930516f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/RootServiceElement.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import org.eclipse.rse.internal.ui.SystemResources;
-
-
-public class RootServiceElement extends ServiceElement
-{
- private ServiceElement[] _children;
-
- public RootServiceElement()
- {
- super(null, null);
- }
-
- public RootServiceElement(ServiceElement[] children)
- {
- super(null, null);
- _children = children;
- for (int i = 0; i < _children.length; i++)
- {
- _children[i].setParent(this);
- }
- }
-
- public void setChildren(ServiceElement[] children)
- {
- _children = children;
- }
-
- public String getName()
- {
- return SystemResources.RESID_PROPERTIES_SERVICES_NAME;
- }
-
- public String getDescription()
- {
- return SystemResources.RESID_PROPERTIES_SERVICES_TOOLTIP;
- }
-
- public boolean hasChildren()
- {
- return true;
- }
-
- public ServiceElement[] getChildren()
- {
- return _children;
- }
-
- public boolean hasPropertySets()
- {
- return false;
- }
-
- public PropertySetServiceElement[] getPropertySets()
- {
- return null;
- }
-
- public boolean hasProperties()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public PropertyElement[] getProperties()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void commit()
- {
- ServiceElement[] children = getChildren();
- for (int i = 0; i < children.length; i++)
- {
- children[i].commit();
- }
- }
-
- public void revert()
- {
- ServiceElement[] children = getChildren();
- for (int i = 0; i < children.length; i++)
- {
- children[i].revert();
- }
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java
deleted file mode 100644
index c91653d7e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServerLauncherPropertiesServiceElement.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ILabeledObject;
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.graphics.Image;
-
-
-public class ServerLauncherPropertiesServiceElement extends RSEModelServiceElement
-{
- protected IServerLauncherProperties _launcherProperties;
- private boolean _userModified = false;
-
- public ServerLauncherPropertiesServiceElement(IHost host, ServiceElement parent, IServerLauncherProperties launcherProperties)
- {
- super(host, parent, launcherProperties);
- _launcherProperties = launcherProperties;
- }
-
- public String getName()
- {
- if (_launcherProperties instanceof ILabeledObject) {
- ILabeledObject lp = (ILabeledObject) _launcherProperties;
- return lp.getLabel();
- }
- return _launcherProperties.getName();
- }
-
- public Image getImage()
- {
- return RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_LAUNCHER_CONFIGURATION_ID);
- }
-
- protected ServiceElement[] internalGetChildren()
- {
- return null;
- }
-
-
- protected boolean internalHasChildren()
- {
- return false;
- }
-
- public void childChanged(ServiceElement element)
- {
- _userModified = true;
- _launcherProperties.restoreFromProperties();
- _launcherProperties.commit();
- getParent().childChanged(element);
- }
-
- public boolean userModified()
- {
- return _userModified;
- }
-
- public void commit()
- {
- super.commit();
-
- }
-
- public void revert()
- {
- super.revert();
- }
-
- public IServerLauncherProperties getServerLauncherProperties()
- {
- return _launcherProperties;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceElement.java
deleted file mode 100644
index b768166be..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceElement.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.swt.graphics.Image;
-
-
-
-
-public abstract class ServiceElement
-{
- protected IHost _host;
- protected ServiceElement _parent;
- protected boolean _isSelected = false;
-
- public ServiceElement(IHost host, ServiceElement parent)
- {
- _host = host;
- _parent = parent;
- }
-
- public Image getImage()
- {
- return null;
- }
-
- public IHost getHost()
- {
- if (_host == null)
- {
- ServiceElement[] elements = getChildren();
- if (elements != null)
- {
- for (int i = 0; i < elements.length; i++)
- {
- ServiceElement el = elements[i];
- if (el.isSelected())
- {
- return el.getHost();
- }
- }
- }
- }
- return _host;
- }
-
- public void childChanged(ServiceElement element)
- {
- if (_parent != null)
- {
- _parent.childChanged(element);
- }
- }
-
- public void setParent(ServiceElement parent)
- {
- _parent = parent;
- }
-
- public ServiceElement getParent()
- {
- return _parent;
- }
-
- public void setSelected(boolean flag)
- {
- _isSelected = flag;
- }
-
- public boolean isSelected()
- {
- return _isSelected;
- }
-
- public String toString()
- {
- return getName();
- }
-
- public abstract boolean hasProperties();
- public abstract PropertyElement[] getProperties();
- public abstract String getName();
- public abstract String getDescription();
- public abstract boolean hasChildren();
- public abstract ServiceElement[] getChildren();
- public abstract void commit();
- public abstract void revert();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceServiceElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceServiceElement.java
deleted file mode 100644
index 334a2b552..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceServiceElement.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.services.IService;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.graphics.Image;
-
-
-
-
-public class ServiceServiceElement extends ServiceElement
-{
- private IService _service;
- private ImageDescriptor _imageDescriptor;
-
- public ServiceServiceElement(IHost host, ServiceElement parent, IService service)
- {
- super(host, parent);
- _service = service;
- }
-
- public Image getImage()
- {
- if (_imageDescriptor == null)
- {
- _imageDescriptor= RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_SERVICE_ID);
- }
- return _imageDescriptor.createImage();
- }
-
- public IService getService()
- {
- return _service;
- }
-
- public String getName()
- {
- return _service.getName();
- }
-
- public String getDescription()
- {
- return _service.getDescription();
- }
-
- public boolean hasChildren()
- {
- return false;
- }
-
- public ServiceElement[] getChildren()
- {
- return null;
- }
-
- public boolean hasPropertySets()
- {
- return false;
- }
-
- public PropertySetServiceElement[] getPropertySets()
- {
- return null;
- }
-
- public boolean hasProperties()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- public PropertyElement[] getProperties()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void commit()
- {
- }
-
- public void revert()
- {
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableContentProvider.java
deleted file mode 100644
index b39a6481d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableContentProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class ServiceTableContentProvider implements ITreeContentProvider
-{
- /**
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object element) {
- if (element instanceof ArrayList)
- return ((ArrayList)element).toArray();
-
- return getChildren(element);
- }
- /**
- * @see IContentProvider#dispose()
- */
- public void dispose() {
- }
- /**
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- }
-
- public Object[] getChildren(Object element)
- {
- return getServiceElement(element).getChildren();
- }
-
- public Object getParent(Object element)
- {
- return getServiceElement(element).getParent();
- }
-
- public boolean hasChildren(Object element)
- {
- return getServiceElement(element).hasChildren();
- }
-
- protected ServiceElement getServiceElement(Object element)
- {
- return (ServiceElement)element;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableLabelProvider.java
deleted file mode 100644
index 64e0e378d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServiceTableLabelProvider.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-
-
-
-public class ServiceTableLabelProvider
- extends LabelProvider
- implements ITableLabelProvider
- {
-
- public Image getColumnImage(Object element, int columnIndex)
- {
- if (columnIndex == 0)
- {
- return getImage(element);
- }
- return null;
- }
-
-
-
- public Image getImage(Object element)
- {
- ServiceElement serviceElement = getServiceElement(element);
- return serviceElement.getImage();
- }
-
-
-
- public String getText(Object element)
- {
- return getColumnText(element, 0);
- }
-
- public ServiceElement getServiceElement(Object element)
- {
- return (ServiceElement)element;
- }
-
-
- /**
- * @see ITableLabelProvider#getColumnText(Object, int)
- */
- public String getColumnText(Object element, int columnIndex)
- {
- if (element instanceof ServiceElement)
- {
- ServiceElement serviceElement = (ServiceElement)element;
-
- switch (columnIndex)
- {
- case 0: // name
- {
- return serviceElement.getName();
- }
-
- default:
- {
- return ""; //$NON-NLS-1$
- }
- }
- }
- return ""; //$NON-NLS-1$
- }
-
-
-
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java
deleted file mode 100644
index 5a0357e8c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/services/ServicesForm.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * David McKnight (IBM) [196632] make sure selected element is marked selected
- * David McKnight (IBM) - [223103] [cleanup] fix broken externalized strings
- *******************************************************************************/
-
-package org.eclipse.rse.ui.widgets.services;
-
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm;
-import org.eclipse.rse.ui.SystemBaseForm;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.widgets.GridUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-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.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-
-
-
-public class ServicesForm extends SystemBaseForm implements ICheckStateListener
-{
- private CheckboxTableViewer _factoryViewer;
- private TreeViewer _serviceViewer;
- private SystemPropertySheetForm _propertiesViewer;
-
- private String _configurationTooltip = SystemResources.RESID_SERVICESFORM_CONFIGURATION_TOOLTIP;
- private String _serviceTooltip = SystemResources.RESID_SERVICESFORM_SERVICES_TOOLTIP;
- private String _propertiesTooltip = SystemResources.RESID_SERVICESFORM_PROPERTIES_TOOLTIP;
-
- private Text _descriptionVerbiage;
-
- public ServicesForm(Shell shell, ISystemMessageLine msgLine)
- {
- super(shell, msgLine);
- //_factoryTooltip =
- }
-
- public Control createContents(Composite parent)
- {
-
- SashForm sashCompositeParent = new SashForm(parent, SWT.HORIZONTAL);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
- sashCompositeParent.setLayoutData(data);
-
- SashForm sashCompositeLeft = new SashForm(sashCompositeParent, SWT.VERTICAL);
- data = new GridData(SWT.FILL, SWT.FILL, true, true);
- sashCompositeLeft.setLayoutData(data);
-
- // factory composite
- Composite factoryViewerComposite = new Composite(sashCompositeLeft, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- factoryViewerComposite.setLayout(layout);
- factoryViewerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- Label factoryLabel = new Label(factoryViewerComposite, SWT.NONE);
- factoryLabel.setText(SystemResources.RESID_PROPERTIES_FACTORIES_LABEL);
- factoryLabel.setToolTipText(SystemResources.RESID_PROPERTIES_FACTORIES_TOOLTIP);
- createFactoryViewer(factoryViewerComposite);
-
-
- // service composite
- Composite serviceViewerComposite = new Composite(sashCompositeLeft, SWT.NONE);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- serviceViewerComposite.setLayout(layout);
- serviceViewerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- Label servicesLabel = new Label(serviceViewerComposite, SWT.NONE);
- servicesLabel.setText(SystemResources.RESID_PROPERTIES_SERVICES_LABEL);
- createServiceViewer(serviceViewerComposite);
-
- sashCompositeLeft.setWeights(new int[] { 50, 50 });
-
- // properties composite
- Composite servicePropertiesComposite = new Composite(sashCompositeParent, SWT.NONE);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- servicePropertiesComposite.setLayout(layout);
- servicePropertiesComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- Label propertiesLabel = new Label(servicePropertiesComposite, SWT.NONE);
- propertiesLabel.setText(SystemResources.RESID_PROPERTIES_PROPERTIES_LABEL);
- createPropertiesViewer(servicePropertiesComposite);
-
- sashCompositeParent.setWeights(new int[] { 40, 60 });
-
- // description composite
- Composite descriptionComposite = new Composite(parent, SWT.NONE);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- descriptionComposite.setLayout(layout);
- descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- Label descriptionLabel = new Label(descriptionComposite, SWT.NONE);
- descriptionLabel.setText(SystemResources.RESID_PROPERTIES_DESCRIPTION_LABEL);
- _descriptionVerbiage = new Text(parent, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
- _descriptionVerbiage.setText(getCurrentVerbiage());
- _descriptionVerbiage.setEditable(false);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.widthHint = 150;
- _descriptionVerbiage.setLayoutData(gridData);
-
- _factoryViewer.addSelectionChangedListener(new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection selection = event.getSelection();
- if (selection instanceof StructuredSelection)
- {
- StructuredSelection ss = (StructuredSelection)selection;
-
- ServiceElement firstElement = (ServiceElement)ss.getFirstElement();
- if (firstElement != null)
- {
- _factoryViewer.setChecked(firstElement, true);
- unCheckOthers(firstElement);
- if (!firstElement.isSelected())
- firstElement.setSelected(true);
- _serviceViewer.setInput(firstElement);
- _descriptionVerbiage.setText(getCurrentVerbiage());
- }
- }
- }
- });
-
- _serviceViewer.addSelectionChangedListener(new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection selection = event.getSelection();
- _propertiesViewer.selectionChanged(selection);
- _descriptionVerbiage.setText(getCurrentVerbiage());
- }
- });
-
- return _factoryViewer.getControl();
- }
-
-
-
- private void createFactoryViewer(Composite parent)
- {
- // Create the table viewer.
- _factoryViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.READ_ONLY);
- _factoryViewer.addCheckStateListener(this);
-
- // Create the table control.
- Table table = _factoryViewer.getTable();
- table.setHeaderVisible(false);
- table.setLinesVisible(false);
- GridData data = GridUtil.createFill();
- data.heightHint = 20;
- data.widthHint = 30;
- table.setLayoutData(data);
- table.setToolTipText(_configurationTooltip);
-
-
-
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
-
-
- _factoryViewer.setContentProvider(new ServiceTableContentProvider());
- _factoryViewer.setLabelProvider(new ServiceTableLabelProvider());
- }
-
- private void createServiceViewer(Composite parent)
- {
- // Create the table viewer.
- _serviceViewer = new TreeViewer(parent, SWT.BORDER);
-
-
- // Create the table control.
- Tree tableTree = _serviceViewer.getTree();
- GridData data = GridUtil.createFill();
- data.heightHint = 20;
- data.widthHint = 30;
- tableTree.setLayoutData(data);
- tableTree.setLayout(new GridLayout());
- tableTree.setToolTipText(_serviceTooltip);
-
-
- _serviceViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
-
-
-
- _serviceViewer.setContentProvider(new ServiceTableContentProvider());
- _serviceViewer.setLabelProvider(new ServiceTableLabelProvider());
-
- }
-
- private void createPropertiesViewer(Composite parent)
- {
-
- _propertiesViewer = new SystemPropertySheetForm(getShell(),parent, SWT.BORDER, getMessageLine());
- _propertiesViewer.setToolTipText(_propertiesTooltip);
-
-
- }
-
- public void init(ServiceElement root)
- {
- _factoryViewer.setInput(root);
- TableItem[] items = _factoryViewer.getTable().getItems();
- for (int i = 0; i < items.length; i++)
- {
- TableItem item = items[i];
- ServiceElement element = (ServiceElement)item.getData();
- if (element.isSelected())
- {
- item.setChecked(true);
- _factoryViewer.setSelection(new StructuredSelection(element));
- }
- }
- }
-
-
- public void checkStateChanged(CheckStateChangedEvent event)
- {
- ServiceElement element = (ServiceElement)event.getElement();
- element.setSelected(event.getChecked());
- _factoryViewer.setSelection(new StructuredSelection(element));
-
- unCheckOthers(element);
- _descriptionVerbiage.setText(getCurrentVerbiage());
- }
-
- protected void unCheckOthers(ServiceElement checkedElement)
- {
- // uncheck the others now
- Object[] checked = _factoryViewer.getCheckedElements();
- for (int i = 0; i < checked.length; i++)
- {
- ServiceElement oldChecked = (ServiceElement)checked[i];
- if (oldChecked != checkedElement)
- {
- oldChecked.setSelected(false);
- _factoryViewer.setChecked(oldChecked, false);
- }
- }
- }
-
- public ServiceElement getSelectedService()
- {
- return (ServiceElement)_factoryViewer.getCheckedElements()[0];
- }
-
- public boolean verify()
- {
- return _factoryViewer.getCheckedElements().length > 0;
- }
-
- protected String getCurrentVerbiage()
- {
- String description = null;
- if (_serviceViewer != null)
- {
- IStructuredSelection serviceSelection = (IStructuredSelection)_serviceViewer.getSelection();
- if (serviceSelection != null && !serviceSelection.isEmpty())
- {
- description = ((ServiceElement)serviceSelection.getFirstElement()).getDescription();
- }
- else if (_factoryViewer != null)
- {
- IStructuredSelection factorySelection = (IStructuredSelection) _factoryViewer.getSelection();
- if (factorySelection != null && !factorySelection.isEmpty())
- {
- description = ((ServiceElement)factorySelection.getFirstElement()).getDescription();
- }
- }
- }
- return description != null ? description : ""; //$NON-NLS-1$
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemNewConnectionWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemNewConnectionWizardPage.java
deleted file mode 100644
index d5550f30d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemNewConnectionWizardPage.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.SystemConnectionForm;
-import org.eclipse.rse.ui.wizards.newconnection.ISystemNewConnectionWizardPage;
-import org.eclipse.rse.ui.wizards.newconnection.RSEAbstractNewConnectionWizard;
-import org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizardMainPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-/**
- * A base class for additional pages that are to be appended to the New Connection wizard.
- * @see org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter#getNewConnectionWizardPages(ISubSystemConfiguration, org.eclipse.jface.wizard.IWizard)
- */
-public abstract class AbstractSystemNewConnectionWizardPage extends AbstractSystemWizardPage
- implements ISystemNewConnectionWizardPage, IWizardPage
-{
- protected ISubSystemConfiguration parentFactory;
-
- /**
- * Constructor that takes everything
- */
- public AbstractSystemNewConnectionWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageName, String pageTitle, String pageDescription)
- {
- super(wizard, pageName, pageTitle, pageDescription);
- this.parentFactory = parentFactory;
- }
- /**
- * Constructor that defaults:
- * <ul>
- * <li>the page name to the parent factory's id
- * <li>the page title to the parent factory's name
- * </ul>
- */
- public AbstractSystemNewConnectionWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageDescription)
- {
- super(wizard, parentFactory.getId(), parentFactory.getName(), pageDescription);
- this.parentFactory = parentFactory;
- }
- /**
- * Constructor that defaults:
- * <ul>
- * <li>the page name to the parent factory's id
- * <li>the page title to the parent factory's name
- * <li>the page description to RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION
- * </ul>
- */
- public AbstractSystemNewConnectionWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory)
- {
- super(wizard, parentFactory.getId(), parentFactory.getName(), SystemResources.RESID_NEWCONN_SUBSYSTEMPAGE_DESCRIPTION);
- this.parentFactory = parentFactory;
- }
-
- /**
- * Return the subsystem factory that supplied this page
- */
- public ISubSystemConfiguration getSubSystemConfiguration()
- {
- return parentFactory;
- }
-
- /**
- * @see AbstractSystemWizardPage#getInitialFocusControl()
- */
- protected Control getInitialFocusControl()
- {
- return null;
- }
-
- /**
- * @see AbstractSystemWizardPage#createContents(Composite)
- */
- public abstract Control createContents(Composite parent);
-
- /**
- * @see ISystemWizardPage#performFinish()
- */
- public boolean performFinish()
- {
- return true;
- }
-
- /**
- * Get the parent wizard typed as the RSEAbstractNewConnectionWizard
- */
- public RSEAbstractNewConnectionWizard getNewConnectionWizard()
- {
- if (getWizard() instanceof RSEAbstractNewConnectionWizard)
- return (RSEAbstractNewConnectionWizard)getWizard();
-
- return null;
- }
-
- /**
- * Get the main page of RSEDefaultNewConnectionWizard, which contains all user enter connection attributes
- */
- public RSEDefaultNewConnectionWizardMainPage getMainPage() {
- RSEAbstractNewConnectionWizard ourWizard = getNewConnectionWizard();
- if (ourWizard != null) {
- IWizardPage wizardPage = ourWizard.getStartingPage();
- if (wizardPage instanceof RSEDefaultNewConnectionWizardMainPage) {
- return (RSEDefaultNewConnectionWizardMainPage)wizardPage;
- }
- }
- return null;
- }
-
- /**
- * Get the SystemConnectionForm of the main page of SystemNewConnectionWizard, which contains all user enter
- * connection attributes
- */
- public SystemConnectionForm getMainPageForm()
- {
- RSEAbstractNewConnectionWizard ourWizard = getNewConnectionWizard();
- if (ourWizard != null) {
- //String[] systemTypes = parentFactory.getSystemTypes();
- //IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemType(systemTypes[0]);
- IWizardPage wizardPage = ourWizard.getStartingPage();
-
- if (wizardPage instanceof RSEDefaultNewConnectionWizardMainPage) {
- return ((RSEDefaultNewConnectionWizardMainPage)wizardPage).getSystemConnectionForm();
- }
- else {
- return null;
- }
- }
- else {
- return null;
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java
deleted file mode 100644
index 5c036b70d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizard.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
-import org.eclipse.rse.ui.view.ISystemTree;
-import org.eclipse.ui.IWorkbench;
-
-
-/**
- * Base class for all RSE wizards. This class is more beneficial when using in conjunction with
- * {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage}, and
- * {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction}.
- * <p>A wizard is a multi-page UI, that prompts users for information and then uses that information
- * to create something (typically). The wizard has an overall title that shows for each page, and
- * a wizard page title that can be unique per page, but typically is not. Typically, the overall title
- * is a verb, such as "New", while the page title expands on the verb, as in "File". There is also a
- * description per page, which is unique and explains the purpose of that page. Further, there is a
- * wizard image that is always the same per wizard page.
- * </p>
- * <p> Using this base class for wizards offers the following advantages over just using the
- * eclipse Wizard class:
- * </p>
- * <ul>
- * <li>Designed to work in conjunction with the {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction},
- * and {@link org.eclipse.rse.ui.dialogs.SystemWizardDialog} classes, propogating settings
- * from these to the wizard, and further propogating those to the individual wizard pages.
- * <li>The overall wizard title and image can be set via the constructor or setter methods.
- * <li>Supports setting an input object, and getting an output object. This is exploited by the
- * {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction} class, when
- * this wizard is launched from a subclass of that action class.
- * <li>Supports setting a wizard page title via {@link #setWizardPageTitle(String)}, that all
- * {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage} pages will use by default for
- * their title, if the non-title constructor is used for that page.
- * <li>If being hosted by a {@link org.eclipse.rse.ui.dialogs.SystemWizardDialog}, supports dynamically
- * updating the wizard size via {@link #updateSize()}, if dynamic content is added to a wizard page, causing the page to grow beyond its initial size.
- * <li>Supports a {@link #setHelp(String)} method to set the overall wizard's contextual help. This is propogated to each
- * {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage} as it is added.
- * <li>Supports setting the viewer that launched this wizard, as wizards often need to know this so they can update the UI upon Finish.
- * <li>Supports a {@link #wasCancelled()} method so callers can easily test if the wizard was cancelled/dismissed by the user.
- * <li>Supports a {@link #setMinimumPageSize(int, int)} method to set the minimum width and height of the wizard.
- * <li>Supports a {@link #setPageError(IWizardPage)} method that can be called in performFinish when an error is detected on a
- * non-current page. This issues a message telling the user there is an error on another page.
- * </ul>
- * <p>To use this class, :</p>
- * <ol>
- * <li>Subclass it.
- * <li>In your constructor, call {@link #setHelp(String)} to set the overall help, if desired.
- * <li>In your constructor, call {@link #setWizardPageTitle(String)} to set the title to use for all pages, if desired.
- * <li>Override {@link #addPages()} to add your {@link org.eclipse.rse.ui.wizards.AbstractSystemWizardPage pages} via calls to addPage(IWizardPage).
- * <li>Override {@link #performFinish()} to do the wizard's main task when Finish is pressed. Cycle through each of your pages calling
- * performFinish() on each of them. If performFinish() returns false from any page, call {@link #setPageError(IWizardPage)} and
- * return false from your performFinish() method to cancel the Finish operation.
- * </ol>
- *
- * @see org.eclipse.rse.ui.wizards.AbstractSystemWizardPage
- * @see org.eclipse.rse.ui.dialogs.SystemWizardDialog
- * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction
- */
-public abstract class AbstractSystemWizard
- extends Wizard implements ISystemWizard
-{
- protected boolean finishPressed = true; // most accurate guess
- protected boolean cancelled = false;
- protected Object input = null;
- protected Object output = null;
- protected IStructuredSelection selection = null;
- protected int minPageWidth, minPageHeight;
- protected String helpId;
- protected Viewer viewer = null;
- protected String pageTitle;
- protected SystemWizardDialog owningDialog;
-
- /**
- * Default constructor.
- *
- * @see #setWizardTitle(String)
- * @see #setWizardImage(ImageDescriptor)
- * @see #setWizardPageTitle(String)
- */
- public AbstractSystemWizard()
- {
- super();
-
- }
-
- /**
- * Constructor when wizard title is known.
- * Alternatively, you can call {@link #setWizardTitle(String)}
- *
- * @see #setWizardImage(ImageDescriptor)
- * @see #setWizardPageTitle(String)
- */
- public AbstractSystemWizard(String title)
- {
- super();
- setWindowTitle(title);
- }
-
- /**
- * Constructor when you both a title and an image for this wizard.
- * Alternatively, you can call {@link #setWizardTitle(String)} or {@link #setWizardImage(ImageDescriptor)}
- *
- * @see #setWizardPageTitle(String)
- */
- public AbstractSystemWizard(String title, ImageDescriptor wizardImage)
- {
- super();
- setWindowTitle(title);
- setDefaultPageImageDescriptor(wizardImage);
- }
-
- /**
- * Called from {@link org.eclipse.rse.ui.dialogs.SystemWizardDialog} when it is used as the hosting dialog
- */
- public void setSystemWizardDialog(SystemWizardDialog dlg)
- {
- this.owningDialog = dlg;
- }
- /**
- * Return the result of {@link #setSystemWizardDialog(SystemWizardDialog)}
- */
- public SystemWizardDialog getSystemWizardDialog()
- {
- return owningDialog;
- }
- /**
- * Exposes this nice new 2.0 capability to the public.
- * Only does anything if being hosted by SystemWizardDialog.
- */
- public void updateSize()
- {
- if (owningDialog != null)
- owningDialog.updateSize(getContainer().getCurrentPage());
- }
- /**
- * Set the wizard title. Using this makes it possible to avoid subclassing.
- * Typically the wizard title is the same for all pages... eg "New"
- */
- public void setWizardTitle(String title)
- {
- setWindowTitle(title);
- }
- /**
- * Set the wizard page title. Using this makes it possible to avoid subclassing.
- * The page title goes below the wizard title, and can be unique per page. However,
- * typically the wizard page title is the same for all pages... eg "Filter".
- * <p>
- * This is not used by default, but can be queried via getPageTitle() when constructing
- * pages.
- */
- public void setWizardPageTitle(String pageTitle)
- {
- this.pageTitle = pageTitle;
- }
- /**
- * Return the page title as set via setWizardPageTitle
- */
- public String getWizardPageTitle()
- {
- return pageTitle;
- }
-
- /**
- * Set the wizard image. Using this makes it possible to avoid subclassing
- */
- public void setWizardImage(ImageDescriptor wizardImage)
- {
- super.setDefaultPageImageDescriptor(wizardImage);
- }
- /**
- * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelp(String id)
- {
- this.helpId = id;
- }
- /**
- * Return the help Id as set in setHelp(String)
- */
- public String getHelpContextId()
- {
- return helpId;
- }
- /**
- * Intercept of parent method so we can percolate the help id
- */
- public void addPage(IWizardPage page)
- {
- super.addPage(page);
- if ((helpId!=null) && (page instanceof ISystemWizardPage))
- {
- // tweak by Phil 10/19/2002 ... this was overriding page-specific help
- // on secondary pages. To reduce regression I only test if help is already
- // specified if this is not the first page... hence one-page wizards are
- // not affected...
- ISystemWizardPage swPage = (ISystemWizardPage)page;
- if ((super.getPageCount() == 1) || (swPage.getHelpContextId() == null))
- swPage.setHelp(helpId);
- }
- }
-
- /**
- * Set the Viewer that called this wizard. It is good practice for actions to call this
- * so wizard can directly access the originating viewer if needed.
- * <p>
- * This is called for you if using a subclass of {@link org.eclipse.rse.ui.actions.SystemBaseWizardAction}.
- */
- public void setViewer(Viewer v)
- {
- this.viewer = v;
- }
- /**
- * Get the Viewer that called this wizard. This will be null unless set by the action that started this wizard.
- */
- public Viewer getViewer()
- {
- return viewer;
- }
- /**
- * Return the current viewer as an ISystemTree if it is one, or null otherwise
- */
- protected ISystemTree getCurrentTreeView()
- {
- Viewer v = getViewer();
- if (v instanceof ISystemTree)
- return (ISystemTree)v;
- else
- return null;
- }
-
- /**
- * For explicitly setting input object
- */
- public void setInputObject(Object inputObject)
- {
- this.input = inputObject;
- //System.out.println("Inside AbstractSystemWizard#setInputObject: " + inputObject + ", class = " + inputObject.getClass().getName());
- }
- /**
- * For explicitly getting input object
- */
- public Object getInputObject()
- {
- return input;
- }
-
- /**
- * For explicitly getting output object after wizard is dismissed. Set by the
- * wizard's processFinish method.
- */
- public Object getOutputObject()
- {
- return output;
- }
-
- /**
- * For explicitly setting output object after wizard is dismissed. Called in the
- * wizard's processFinish method, typically.
- */
- public void setOutputObject(Object outputObject)
- {
- output = outputObject;
- }
-
- /**
- * Allow caller to determine if wizard was cancelled or not.
- */
- public boolean wasCancelled()
- {
- if (cancelled) // most reliable
- return true;
- else
- return !finishPressed;
- }
- /**
- * You must call this in your performFinish method.
- */
- protected void setWasCancelled(boolean cancelled)
- {
- finishPressed = !cancelled;
- }
- /**
- * Override of parent so we can record the fact the wizard was cancelled.
- */
- public boolean performCancel()
- {
- //System.out.println("inside performCancel");
- cancelled = true;
- setWasCancelled(true);
- return super.performCancel();
- }
-
- /**
- * Required by INewWizard interface. It is called by the framework for wizards
- * that are launched file the File->New interface. Otherwise we don't use it.
- * If you need it, the selection is stored in protected variable "selection".
- */
- public void init(IWorkbench workbench, IStructuredSelection selection)
- {
- this.selection = selection;
- }
-
- /**
- * Set the wizard's min page width and height.
- * If you pass 0 for either one, the Eclipse default value will be used.
- */
- public void setMinimumPageSize(int width, int height)
- {
- if (width <= 0)
- width = 300; // found this number in WizardDialog code
- if (height <= 0)
- height = 225; // found this number in WizardDialog code
- this.minPageWidth = width;
- this.minPageHeight = height;
- }
-
- /**
- * Return the minimum page width. If zero, it has not been explicitly set, so the default is to be used.
- */
- public int getMinimumPageWidth()
- {
- return minPageWidth;
- }
- /**
- * Return the minimum page height. If zero, it has not been explicitly set, so the default is to be used.
- */
- public int getMinimumPageHeight()
- {
- return minPageHeight;
- }
-
- /**
- * If in the processing of performFinish an error is detected on another page of the
- * wizard, the best we can do is tell the user this via an error message on their own
- * page. It seems there is no way in JFace to successfully switch focus to another page.
- * <p>
- * To simplify processing, simply call this method in your wizard's performFinish if any
- * page's performFinish returned false. Pass the failing page. If it is not the current
- * page, this code will issue msg RSEG1240 "Error on another page" to the user.
- */
- public void setPageError(IWizardPage pageInError)
- {
- IWizardPage currentPage = getContainer().getCurrentPage();
- if (currentPage != pageInError)
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_WIZARD_PAGE_ERROR);
- if (currentPage instanceof AbstractSystemWizardPage)
- ((AbstractSystemWizardPage)currentPage).setErrorMessage(msg);
- else if (pageInError instanceof WizardPage)
- ((WizardPage)currentPage).setErrorMessage(msg.getLevelOneText());
- }
- }
-
- /**
- * Expose inherited protected method convertWidthInCharsToPixels as a publicly
- * excessible method
- * <p>
- * Requires setOwningDialog to have been called, else returns -1
- */
- public int publicConvertWidthInCharsToPixels(int chars)
- {
- if (owningDialog != null)
- return owningDialog.publicConvertWidthInCharsToPixels(chars);
- else
- return -1;
- }
- /**
- * Expose inherited protected method convertHeightInCharsToPixels as a publicly
- * excessible method
- * <p>
- * Requires setOwningDialog to have been called, else returns -1
- */
- public int publicConvertHeightInCharsToPixels(int chars)
- {
- if (owningDialog != null)
- return owningDialog.publicConvertHeightInCharsToPixels(chars);
- else
- return -1;
- }
-
- // ----------------------------
- // METHODS YOU MUST OVERRIDE...
- // ----------------------------
-
- /**
- * Creates the wizard pages.
- * This method is an override from the parent Wizard class, but is made abstract here to ensure child classes override it.
- */
- public abstract void addPages();
-
- /**
- * Called when finish pressed.
- * <p>
- * Return true if no errors, false to cancel the finish operation.
- * <p>
- * Typically, you walk through each wizard page calling performFinish on it, and only return true if they all return true.
- * If one of the pages returns false, you should call setPageError(IWizardPage), which shows a message to the user about an
- * error pending on another page, if the given page is not the current page.
- */
- public abstract boolean performFinish();
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java
deleted file mode 100644
index fbd27f830..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/AbstractSystemWizardPage.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- * Martin Oberhuber (Wind River) - [216252] canceled --> cancelled in comments
- *******************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.Mnemonics;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-
-
-/**
- * Abstract class for system wizards pages. Using this class is most effective when used in
- * conjunction with {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard}.
- * <p> Using this base class for wizards offers the following advantages over just using the
- * eclipse WizardPage class:
- * <ul>
- * <li>Designed to work in conjunction with {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard},
- * propagating settings from the wizard to the individual wizard pages.
- * <li>Supports using the overall wizard page title as set by {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard#setWizardPageTitle(String)},
- * if no title specified in the constructor.
- * <li>Supports a {@link #setHelp(String)} method to set the wizard page's overall contextual help
- * <li>Implements {@link org.eclipse.rse.ui.messages.ISystemMessageLine} so supports setting error messages as
- * either strings or, preferably, {@link SystemMessage} objects.
- * <li>Supports an {@link #setInputObject(Object) input-object}, as passed from the wizard, which in turn is passed from the action.
- * <li>Supports automatic assignment of unique mnemonics for all input-capable controls on the page, to add in accessibility.
- * <li>Supports setting a default-focus control, which gets initial focus when the page is shown.
- * <li>Supports helper methods to aid in population of the client area: {@link #addSeparatorLine(Composite, int)},
- * {@link #addFillerLine(Composite,int)} and {@link #addGrowableFillerLine(Composite,int)}.
- * </ul>
- *
- * <p>To use this class, :</p>
- * <ol>
- * <li>Subclass it.
- * <li>Decide whether to use the overall wizard default pages title or have a unique title for this page. Use the appropriate constructor.
- * <li>If desired, in your constructor call {@link #setHelp(String)} to set the contextual help for this page. Or, just use the default help
- * set via {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard#setHelp(String)} in the wizard itself.
- * <li>Override {@link #createContents(Composite)} to populate the client area. You may find it useful to use the static methods in {@link org.eclipse.rse.ui.SystemWidgetHelpers}.
- * <li>Override {@link #getInitialFocusControl()} to return the control to gain initial focus on this page, or null if there are no input controls.
- * <li>Override {@link #performFinish()} to perform input validation when Finish is pressed. Return true if validated ok, false if not.
- * <li>You may also wish to override {@link #isPageComplete()} to return false if any required inputs are not given. Typically, this also is coded to
- * return false if there is an error message showing, which you detect by maintaining a SystemMessage instance variable, set or cleared by your
- * keystroke validator methods, and performFinish validation routine.
- * <li>Typically you will also supply protected getter methods to get the user-entered data, for use by your wizard class.
- * </ol>
- *
- * <p>For error validation when there are multiple input fields on the page, there are two different approaches you can take:</p>
- * <ol>
- * <li>Just validate each field as data is entered. In the event processor for that field, you clear the message, then set it if an error is
- * detected in the input data, and also call setPageComplete(errorMessage == null), where errorMessage is your instance variable for the current error.
- * In performFinish, you then call the validation methods for each of the fields on the page, and if an error is found, position the cursor, set the
- * error message and then call setPageComplete. <br>
- * In this approach, only errors in the current field in focus are caught, and errors in other fields are not caught until Finish is pressed.
- * <li>Same as in step 1, but if the error checking for the current field finds no errors, then an overall validation method is called to check
- * the other fields, passing a parameter identifying the current field so it is skipped for efficiency. The overall validation method calls all
- * the individual validation methods, except for the one that was asked to be skipped. The performFinish method calls the overall validation method,
- * passing null so nothing is skipped, and if an error is detected positions the cursor. <br>
- * In this approach, which is more rigorous, the error checking is always complete for the whole page, so Finish theoretically will never catch an
- * error, and the page enablement is always completely accurate.
- * </ol>
- * <p>There is no consensus on the approach, although clearly the second one is preferable when it is possible.
- *
- * @see org.eclipse.rse.ui.wizards.AbstractSystemWizard
- * @see org.eclipse.rse.ui.dialogs.SystemWizardDialog
- * @see org.eclipse.rse.ui.actions.SystemBaseWizardAction
- */
-public abstract class AbstractSystemWizardPage
- extends WizardPage
- implements ISystemWizardPage, ISystemMessageLine
-{
- // state
- private Object input;
- private ISystemMessageLine msgLine;
- private String helpId;
- private Composite parentComposite;
- private SystemMessage pendingMessage, pendingErrorMessage;
-
- /**
- * Constructor when a unique page title is desired.
- * @param wizard - the page wizard.
- * @param pageName - the untranslated ID of this page. Not really used.
- * @param pageTitle - the translated title of this page. Appears below the overall wizard title.
- * @param pageDescription - the translated description of this page. Appears to the right of the page title.
- */
- public AbstractSystemWizardPage(IWizard wizard, String pageName, String pageTitle, String pageDescription) {
- super(pageName);
- setWizard(wizard);
-
- if (pageTitle != null)
- setTitle(pageTitle);
- else if (wizard instanceof AbstractSystemWizard)
- setTitle(((AbstractSystemWizard)wizard).getWizardPageTitle());
-
- setDescription(pageDescription);
- }
- /**
- * Constructor when the overall wizard page title is desired, as specified in
- * {@link org.eclipse.rse.ui.wizards.AbstractSystemWizard#setWizardPageTitle(String)}.
- * <p>
- * It is a somewhat common design pattern to use the same title for all pages in a wizard, and this makes it easy to
- * do that.
- * <p>
- * Your wizard must extend AbstractSystemWizard, and you must have called setWizardPageTitle.
- * @param wizard - the page's wizard.
- * @param pageName - the untranslated ID of this page. Not really used.
- * @param pageDescription - the translated description of this page. Appears to the right of the page title.
- */
- public AbstractSystemWizardPage(IWizard wizard,
- String pageName, String pageDescription)
- {
- this(wizard, pageName, null, pageDescription);
- }
-
- // ------------------------
- // CONFIGURATION METHODS...
- // ------------------------
-
- /**
- * Configuration method. <br>
- * For setting the overall help for the wizard page.
- * <p>
- * This id is stored, and then applied to each of the input-capable
- * controls in the main composite returned from createContents.
- */
- public void setHelp(String helpId)
- {
- if (parentComposite != null)
- SystemWidgetHelpers.setHelp(parentComposite, helpId);
- //SystemWidgetHelpers.setCompositeHelp(parentComposite, helpId, helpIdPerControl);
- //System.out.println("Setting help to " + helpId);
- this.helpId = helpId;
- }
-
- /**
- * Configuration method. <br>
- * For explicitly setting input object. Automatically propogated by the parent wizard.
- */
- public void setInputObject(Object inputObject)
- {
- this.input = inputObject;
- }
-
- // ------------------------
- // GETTER METHODS...
- // ------------------------
- /**
- * Getter method. <br>
- * For explicitly getting input object.
- */
- public Object getInputObject()
- {
- return input;
- }
- /**
- * Getter method. <br>
- * Return the help Id as set in {@link #setHelp(String)}
- */
- public String getHelpContextId()
- {
- return helpId;
- }
- /**
- * Getter method. <br>
- * Return this page's message line so it can be passed to re-usable widgets that need it
- */
- public ISystemMessageLine getMessageLine()
- {
- //return msgLine;
- return this;
- }
-
- // ----------------
- // ABSTRACT METHODS
- // ----------------
- /**
- * Abstract method. <br>
- * Create the page contents here.
- * <p>
- * You may find it useful to use the static methods in {@link org.eclipse.rse.ui.SystemWidgetHelpers}.
- * If you do keystroke validation, you should call {@link #setErrorMessage(SystemMessage)} if you detect errors, and also
- * {@link #setPageComplete(boolean)} to affect the enablement of the next and finish buttons.
- *
- * @see org.eclipse.rse.ui.SystemWidgetHelpers
- */
- public abstract Control createContents(Composite parent);
-
- /**
- * Abstract method. <br>
- * Return the Control to be given initial focus.
- * <p>
- * Child classes must override this, but can return null.
- */
- protected abstract Control getInitialFocusControl();
-
- /**
- * Abstract method. <br>
- * Perform error checking of the page contents, returning true only if there are no errors.
- * <p>Called by the main wizard when the user presses Finish. The operation will be cancelled if
- * this method returns false for any page.
- */
- public abstract boolean performFinish();
-
- // -----------------------
- // PARENT-OVERRIDE METHODS
- // -----------------------
-
- public void dispose() {
- super.dispose();
-
- // Once the page is disposed, the widgets are not longer accessible
- msgLine = null;
- input = null;
- parentComposite = null;
- pendingMessage = null;
- pendingErrorMessage = null;
- }
-
- /**
- * Parent override. <br>
- * Creates the wizard's UI component.
- * We set mnemonics. Child classes should NOT USE THIS.
- * Child classes should override {@link #createContents(Composite)}, which this calls.
- */
- public void createControl(Composite parent)
- {
-// dwd parentComposite = parent;
- Composite myComposite = new Composite(parent, SWT.NONE);
- myComposite.setLayout(new GridLayout(1, false));
- GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, true);
- myComposite.setLayoutData(gd);
- parentComposite = myComposite;
- Control c = createContents(myComposite);
- if (c instanceof Composite)
- {
- applyMnemonics((Composite)c);
- parentComposite = (Composite)c;
- if (helpId != null)
- SystemWidgetHelpers.setHelp(parentComposite, helpId);
- // SystemWidgetHelpers.setCompositeHelp((Composite)c, helpId, helpIdPerControl);
- }
- else if (c instanceof Button)
- {
- Mnemonics ms = new Mnemonics();
- ms.setMnemonic((Button)c);
- }
-
- msgLine = new RSEDialogPageMessageLine(this);
- if (pendingMessage != null) setMessage(pendingMessage);
- if (pendingErrorMessage != null) setErrorMessage(pendingErrorMessage);
-
- setControl(myComposite);
- }
-
- /**
- * Apply mnemonic to the content composite.
- * @param c the composite.
- */
- protected void applyMnemonics(Composite c) {
- SystemWidgetHelpers.setWizardPageMnemonics(c);
- }
-
- /**
- * Parent override. <br>
- * We intercept to give the initial-focus-control focus.
- */
- public void setVisible(boolean visible)
- {
- super.setVisible(visible);
- if (visible)
- {
- Control c = getInitialFocusControl();
- if (c != null)
- c.setFocus();
- }
- }
-
- // -----------------------------
- // ISystemMessageLine methods...
- // -----------------------------
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearErrorMessage()
- */
- public void clearErrorMessage()
- {
- if (msgLine != null && getControl() != null && !getControl().isDisposed())
- msgLine.clearErrorMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage()
- */
- public void clearMessage()
- {
- if (msgLine != null && getControl() != null && !getControl().isDisposed())
- msgLine.clearMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getSystemErrorMessage()
- */
- public SystemMessage getSystemErrorMessage()
- {
- if (msgLine!=null)
- return msgLine.getSystemErrorMessage();
- else
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
- */
- public void setErrorMessage(SystemMessage message)
- {
- if (msgLine!=null)
- {
- if (message != null)
- msgLine.setErrorMessage(message);
- else
- msgLine.clearErrorMessage();
- }
- else // not configured yet
- pendingErrorMessage = message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
- */
- public void setErrorMessage(Throwable exc)
- {
- if (msgLine != null)
- msgLine.setErrorMessage(exc);
- else
- {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_ERROR_UNEXPECTED);
- msg.makeSubstitution(exc);
- pendingErrorMessage = msg;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
- */
- public void setMessage(SystemMessage message)
- {
- if (msgLine!=null)
- msgLine.setMessage(message);
- else // not configured yet
- pendingMessage = message;
- }
-
- /**
- * <b>Note:</b> Never override this method as long the {@link ISystemMessageLine}
- * construct is not eliminated from RSE! Overriding does lead easely to {@link StackOverflowError}s
- * if the subclass implementation does call the wrong methods!
- *
- * @see org.eclipse.jface.wizard.WizardPage#setErrorMessage(java.lang.String)
- */
- public void setErrorMessage(String message) {
- super.setErrorMessage(message);
- }
-
- /**
- * <b>Note:</b> Never override this method as long the {@link ISystemMessageLine}
- * construct is not eliminated from RSE! Overriding does lead easily to {@link StackOverflowError}s
- * if the subclass implementation does call the wrong methods!
- *
- * @see org.eclipse.jface.wizard.WizardPage#setMessage(java.lang.String, int)
- */
- public void setMessage(String newMessage, int newType) {
- super.setMessage(newMessage, newType);
- }
-
- /**
- * <b>Note:</b> Never override this method as long the {@link ISystemMessageLine}
- * construct is not eliminated from RSE! Overriding does lead easily to {@link StackOverflowError}s
- * if the subclass implementation does call the wrong methods!
- *
- * @see org.eclipse.jface.dialogs.DialogPage#setMessage(java.lang.String)
- */
- public void setMessage(String message) {
- super.setMessage(message);
- }
-
- // ---------------
- // HELPER METHODS
- // ---------------
-
- /**
- * Helper method <br>
- * Add a separator line. This is a physically visible line.
- */
- protected void addSeparatorLine(Composite parent, int nbrColumns)
- {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- separator.setLayoutData(data);
- }
- /**
- * Helper method <br>
- * Add a spacer line
- */
- protected void addFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- filler.setLayoutData(data);
- }
- /**
- * Helper method <br>
- * Add a spacer line that grows in height to absorb extra space
- */
- protected void addGrowableFillerLine(Composite parent, int nbrColumns)
- {
- Label filler = new Label(parent, SWT.LEFT);
- GridData data = new GridData();
- data.horizontalSpan = nbrColumns;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.grabExcessVerticalSpace = true;
- filler.setLayoutData(data);
- }
-
- // ----------------
- // INTERNAL METHODS
- // ----------------
-
- /**
- * Internal method <br>
- * On Finish, when an error is detected, position to the given
- * control. The trick though is to give this page focus if it
- * doesn't have it.
- */
- protected void setFocus(Control control)
- {
- if (this != getContainer().getCurrentPage())
- getContainer().showPage(this);
- if ((control!=null) && !control.isDisposed())
- control.setFocus();
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java
deleted file mode 100644
index 6ad2d5273..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizard.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.ui.dialogs.ISystemPromptDialog;
-import org.eclipse.rse.ui.dialogs.SystemWizardDialog;
-import org.eclipse.ui.INewWizard;
-
-
-/**
- * Suggested interface for wizards launchable via remote system explorer.
- */
-public interface ISystemWizard extends INewWizard, ISystemPromptDialog
-{
- /**
- * Called when wizard to be used for update vs create.
- * This is the input object to be updated. Automatically sets input mode to update.
- */
- //public void setUpdateInput(Object input);
- /**
- * Retrieve update mode
- */
- //public boolean getUpdateMode();
- /**
- * Retrieve input object used in update mode.
- */
- //public Object getUpdateInput();
- /**
- * Set current selection of viewer, at time wizard launched
- */
- //public void setSelection(IStructuredSelection selection);
- /**
- * Get current selection of viewer, at time wizard launched, as set
- * by setSelection(IStructuredSelection selection)
- */
- //public IStructuredSelection getSelection();
-
- public void setMinimumPageSize(int width, int height);
- public int getMinimumPageWidth();
- public int getMinimumPageHeight();
-
- /**
- * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelp(String id);
- /**
- * Return the help Id as set in setHelp(String)
- */
- public String getHelpContextId();
-
- /**
- * Set the Viewer that called this wizard. It is good practice for actions to call this
- * so wizard can directly access the originating viewer if needed.
- */
- public void setViewer(Viewer v);
- /**
- * Get the Viewer that called this wizard. This will be null unless set by the action that started this wizard.
- */
- public Viewer getViewer();
-
- /**
- * Set the wizard page title. Using this makes it possible to avoid subclassing.
- * The page title goes below the wizard title, and can be unique per page. However,
- * typically the wizard page title is the same for all pages... eg "Filter".
- * <p>
- * This is not used by default, but can be queried via getPageTitle() when constructing
- * pages.
- */
- public void setWizardPageTitle(String pageTitle);
- /**
- * Return the page title as set via setWizardPageTitle
- */
- public String getWizardPageTitle();
- /**
- * Called from SystemWizardDialog when it is used as the hosting dialog
- */
- public void setSystemWizardDialog(SystemWizardDialog dlg);
- /**
- * Return the result of setSystemWizardDialog
- */
- public SystemWizardDialog getSystemWizardDialog();
- /**
- * Exposes this nice new 2.0 capability to the public.
- * Only does anything if being hosted by SystemWizardDialog.
- */
- public void updateSize();
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java
deleted file mode 100644
index 8d98d1a62..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/ISystemWizardPage.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-/**
- * Interface for wizard pages
- */
-public interface ISystemWizardPage
-{
- /**
- * For explicitly setting input object for update mode wizards
- */
- public void setInputObject(Object inputObject);
-
- /**
- * For explicitly getting input object.
- */
- public Object getInputObject();
-
- /**
- * Perform error checking of the page contents, returning true only if there are no errors.
- * <p>Called by the main wizard when the user presses Finish. The operation will be cancelled if
- * this method returns false for any page.
- */
- public boolean performFinish();
-
- /**
- * Set the help context Id (infoPop) for this wizard. This must be fully qualified by
- * plugin ID.
- * <p>
- * Same as {@link org.eclipse.rse.ui.actions.SystemBaseAction #setHelp(String)}
- * @see org.eclipse.rse.ui.actions.SystemBaseAction #getHelpContextId()
- */
- public void setHelp(String id);
- /**
- * Return the help Id as set in setHelp(String)
- */
- public String getHelpContextId();
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDialogPageMessageLine.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDialogPageMessageLine.java
deleted file mode 100644
index 45c2b4095..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDialogPageMessageLine.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-
-/**
- * Message line interface implementation which forwards the calls
- * to the associated parent dialog page.
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class RSEDialogPageMessageLine implements ISystemMessageLine {
- private final DialogPage page;
- private SystemMessage errorSystemMessage;
-
- /**
- * Constructor.
- *
- * @param dialogPage The parent dialog page. Must be not <code>null</code>.
- */
- public RSEDialogPageMessageLine(DialogPage dialogPage) {
- assert dialogPage != null;
- page = dialogPage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearErrorMessage()
- */
- public void clearErrorMessage() {
- assert page != null;
- if (page.getErrorMessage() != null) page.setErrorMessage(null);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#clearMessage()
- */
- public void clearMessage() {
- assert page != null;
- page.setMessage(null, IMessageProvider.NONE);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getErrorMessage()
- */
- public String getErrorMessage() {
- assert page != null;
- return page.getErrorMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getMessage()
- */
- public String getMessage() {
- assert page != null;
- return page.getMessage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#getSystemErrorMessage()
- */
- public SystemMessage getSystemErrorMessage() {
- return errorSystemMessage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.String)
- */
- public void setErrorMessage(String message) {
- assert page != null;
- page.setErrorMessage(message);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
- */
- public void setErrorMessage(SystemMessage message) {
- errorSystemMessage = message;
- if (errorSystemMessage != null) setErrorMessage(errorSystemMessage.getLevelOneText());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setErrorMessage(java.lang.Throwable)
- */
- public void setErrorMessage(Throwable exception) {
- if (exception != null) setErrorMessage(exception.getLocalizedMessage());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setMessage(java.lang.String)
- */
- public void setMessage(String message) {
- assert page != null;
- page.setMessage(message, IMessageProvider.INFORMATION);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.messages.ISystemMessageLine#setMessage(org.eclipse.rse.services.clientserver.messages.SystemMessage)
- */
- public void setMessage(SystemMessage message) {
- if (message != null) setMessage(message.getLevelOneText());
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java
deleted file mode 100644
index 0b0261b12..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Javier Montalvo Orus (Symbian) - [188146] Incorrect "FTP Settings" node in Property Sheet for Linux connection
- * Martin Oberhuber (Wind River) - [190231] Move ISubSystemPropertiesWizardPage from UI to Core
- * David Dykstal (IBM) - [217556] remove service subsystem types
- * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
- * David Dykstal (IBM) - [232585] adding help for new subsystem wizard page
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.DummyHost;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.IPropertySet;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.widgets.services.ConnectorServiceElement;
-import org.eclipse.rse.ui.widgets.services.FactoryServiceElement;
-import org.eclipse.rse.ui.widgets.services.PropertySetServiceElement;
-import org.eclipse.rse.ui.widgets.services.RootServiceElement;
-import org.eclipse.rse.ui.widgets.services.ServerLauncherPropertiesServiceElement;
-import org.eclipse.rse.ui.widgets.services.ServiceElement;
-import org.eclipse.rse.ui.widgets.services.ServicesForm;
-import org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard;
-import org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizardMainPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizardPage
-{
- private ServicesForm _form;
- private ISubSystemConfiguration _selectedConfiguration;
- private ServiceElement _root;
- private ServiceElement[] _serviceElements;
-
- public SubSystemServiceWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageName, String pageTitle, String pageDescription)
- {
- super(wizard, parentFactory, pageName, pageTitle, pageDescription);
- }
-
- public SubSystemServiceWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory, String pageDescription)
- {
- super(wizard, parentFactory, pageDescription);
- }
-
- public SubSystemServiceWizardPage(IWizard wizard, ISubSystemConfiguration parentFactory)
- {
- super(wizard, parentFactory);
- }
-
- public Control createContents(Composite parent)
- {
- SystemWidgetHelpers.setHelp(parent, "org.eclipse.rse.ui.ServiceSubsystemWizardPage"); //$NON-NLS-1$
- _form = new ServicesForm(parent.getShell(), getMessageLine());
- Control control = _form.createContents(parent);
-
- ServiceElement[] elements = getServiceElements();
- _root = new RootServiceElement(elements);
- _form.init(_root);
-
- return control;
- }
-
-
- protected ServiceElement[] getServiceElements()
- {
- if (_serviceElements == null)
- {
-
-
- ISubSystemConfiguration currentFactory = getSubSystemConfiguration();
-
- IRSESystemType systemType = getMainPage() != null && getMainPage().getWizard() instanceof RSEDefaultNewConnectionWizard ? ((RSEDefaultNewConnectionWizard)getMainPage().getWizard()).getSystemType() : null;
- ISubSystemConfiguration[] factories = getServiceSubSystemConfigurations(systemType, currentFactory.getServiceType());
-
- IHost dummyHost = null;
- if (getWizard() instanceof RSEDefaultNewConnectionWizard)
- {
- RSEDefaultNewConnectionWizard wizard = (RSEDefaultNewConnectionWizard)getWizard();
- if (wizard.getStartingPage() instanceof RSEDefaultNewConnectionWizardMainPage) {
- dummyHost = new DummyHost(((RSEDefaultNewConnectionWizardMainPage)wizard.getStartingPage()).getSystemConnectionForm().getHostName(),
- wizard.getSystemType());
- }
- }
-
- // create elements for each
- _serviceElements = new ServiceElement[factories.length];
- for (int i = 0; i < factories.length; i++)
- {
- ISubSystemConfiguration factory = factories[i];
- _serviceElements[i] = new FactoryServiceElement(dummyHost, factory);
-
-
- //if (factory == currentFactory)
- if (i == 0) // use first
- {
- _serviceElements[i].setSelected(true);
- }
-
- }
- }
- return _serviceElements;
- }
-
- /**
- * @param systemType
- * @param serviceType
- * @return
- * @since 3.0 returning ISubSystemConfiguration instead of
- * IServiceSubSystemConfiguration
- */
- protected ISubSystemConfiguration[] getServiceSubSystemConfigurations(IRSESystemType systemType, Class serviceType)
- {
- List results = new ArrayList();
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISubSystemConfiguration[] configs = sr.getSubSystemConfigurationsBySystemType(systemType, false);
-
- for (int i = 0; i < configs.length; i++)
- {
- ISubSystemConfiguration config = configs[i];
- if (config.getServiceType() == serviceType)
- {
- results.add(config);
- }
- }
-
- return (ISubSystemConfiguration[])results.toArray(new ISubSystemConfiguration[results.size()]);
- }
-
- public boolean isPageComplete()
- {
- return true;
- }
-
- public boolean performFinish()
- {
- if (_root != null)
- {
- _root.commit();
-
- _selectedConfiguration = ((FactoryServiceElement)_form.getSelectedService()).getFactory();
- }
- return true;
- }
-
- protected ServerLauncherPropertiesServiceElement[] getPropertiesServiceElement()
- {
- List results = new ArrayList();
- for (int i = 0; i < _serviceElements.length; i++)
- {
- {
- ServiceElement el = _serviceElements[i];
- if(el.isSelected())
- {
- ServiceElement[] children = el.getChildren();
- if (children != null)
- {
- for (int c = 0; c < children.length; c++)
- {
- ServiceElement child = children[c];
- if (child instanceof ConnectorServiceElement)
- {
- ServiceElement[] cch = child.getChildren();
- if (cch != null && cch.length > 0)
- {
- if(cch[0] instanceof ServerLauncherPropertiesServiceElement)
- {
- ServerLauncherPropertiesServiceElement result = (ServerLauncherPropertiesServiceElement)cch[0];
- results.add(result);
- }
- }
- }
- }
- }
- }
- }
- }
- return (ServerLauncherPropertiesServiceElement[])results.toArray(new ServerLauncherPropertiesServiceElement[results.size()]);
- }
-
- public boolean applyValues(ISubSystem ss) {
- if (_selectedConfiguration != null) {
- ISubSystemConfiguration currentConfiguration = ss.getSubSystemConfiguration();
- if (currentConfiguration != null) {
- if (_selectedConfiguration != currentConfiguration) {
- ss.switchServiceFactory(_selectedConfiguration);
- }
- if (_root != null) {
- IConnectorService connectorService = ss.getConnectorService();
- // process server launcher properties
- ServerLauncherPropertiesServiceElement[] elements = getPropertiesServiceElement();
- if (elements.length > 0) {
- ServerLauncherPropertiesServiceElement element = elements[0];
- if (element.userModified()) {
- IServerLauncherProperties properties = element.getServerLauncherProperties();
- properties.saveToProperties();
- connectorService.setRemoteServerLauncherProperties(properties);
- }
- }
- /*
- * Process connector service property sets
- * The connector service element (there should be only one) is attached to a dummy host.
- * Therefore the property sets containing the new values can me moved from the (dummy)
- * connector service to the real connector service.
- */
- List connectorServiceElements = getConnectorServiceElements(_root);
- for (Iterator z = connectorServiceElements.iterator(); z.hasNext();) {
- ConnectorServiceElement element = (ConnectorServiceElement) z.next();
- PropertySetServiceElement[] psElements = element.getPropertySets();
- for (int i = 0; i < psElements.length; i++) {
- PropertySetServiceElement psElement = psElements[i];
- IPropertySet set = psElement.getPropertySet();
- connectorService.addPropertySet(set); // moves the property set, replacing the old one
- }
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Returns the list of connector service elements from a given service element.
- * @param root The root element from which to search
- * @return A list of all found connector service elements. The list will be empty if non
- * are found.
- */
- private List getConnectorServiceElements(ServiceElement root) {
- List result = new ArrayList(10);
- if (!(root instanceof FactoryServiceElement) || root.isSelected())
- {
- if (root instanceof ConnectorServiceElement) {
- result.add(root);
- }
-
- ServiceElement[] children = root.getChildren();
- if (children != null) {
- for (int i = 0; i < children.length; i++) {
- ServiceElement child = children[i];
- result.addAll(getConnectorServiceElements(child));
- }
- }
- }
- return result;
- }
-
- /**
- * @since 3.0 taking ISubSystemConfiguration instead of
- * IServiceSubSystemConfiguration
- */
- protected IConnectorService getCustomConnectorService(ISubSystemConfiguration config)
- {
- ServiceElement[] children = _root.getChildren();
- for (int i = 0; i < children.length; i++)
- {
- ServiceElement child = children[i];
- if (child instanceof FactoryServiceElement)
- {
- FactoryServiceElement fchild = (FactoryServiceElement)child;
- if (fchild.getFactory() == config)
- {
- return fchild.getConnectorService();
- }
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
- */
- public void handleVerifyComplete()
- {
- boolean complete = isPageComplete();
- clearErrorMessage();
- setPageComplete(complete);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java
deleted file mode 100644
index 4eb6063a8..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizard.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-
-/**
- * Wizard for creating a new remote system profile.
- */
-public class SystemNewProfileWizard
- extends AbstractSystemWizard
-
-{
-
- private SystemNewProfileWizardMainPage mainPage;
-
- /**
- * Constructor
- */
- public SystemNewProfileWizard()
- {
- super(SystemResources.RESID_NEWPROFILE_TITLE,
- RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_NEWPROFILEWIZARD_ID));
- }
-
- /**
- * Creates the wizard pages.
- * This method is an override from the parent Wizard class.
- */
- public void addPages()
- {
- try {
- mainPage = createMainPage();
- addPage(mainPage);
- //super.addPages();
- } catch (Exception exc)
- {
- SystemBasePlugin.logError("New connection: Error in createPages: ",exc); //$NON-NLS-1$
- }
- }
-
- /**
- * Creates the wizard's main page.
- * This method is an override from the parent class.
- */
- protected SystemNewProfileWizardMainPage createMainPage()
- {
- mainPage = new SystemNewProfileWizardMainPage(this);
- return mainPage;
- }
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- boolean ok = true;
- if (mainPage.performFinish())
- {
- //SystemMessage.showInformationMessage(getShell(),"Finish pressed.");
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- String name = mainPage.getProfileName();
- boolean makeActive = mainPage.getMakeActive();
- try
- {
- sr.createSystemProfile(name,makeActive);
- } catch (Exception exc)
- {
- String msg = "Exception creating profile "; //$NON-NLS-1$
- SystemBasePlugin.logError(msg,exc);
- //System.out.println(msg + exc.getMessage() + ": " + exc.getClass().getName());
- SystemMessageDialog.displayExceptionMessage(getShell(),exc);
- }
- return ok;
- }
- else
- ok = false;
- return ok;
- }
-
-} // end class \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java
deleted file mode 100644
index 635618b0f..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SystemNewProfileWizardMainPage.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards;
-import java.util.Vector;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.ISystemMessageLine;
-import org.eclipse.rse.ui.validators.ISystemValidator;
-import org.eclipse.rse.ui.validators.ValidatorProfileName;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * Default main page of the "New Profile" wizard.
- * This page asks for the following information:
- * <ul>
- * <li>Profile name
- * </ul>
- */
-
-public class SystemNewProfileWizardMainPage
- extends AbstractSystemWizardPage
- implements
- ISystemMessageLine
-{
-
- private String profileName;
- private Text textName;
- private Button makeActiveCB;
- private boolean makeActive;
- private SystemMessage errorMessage;
- protected ISystemValidator nameValidator;
- private static final String HELPID_PREFIX = RSEUIPlugin.HELPPREFIX + "wnpr"; //$NON-NLS-1$
-
- /**
- * Constructor.
- */
- public SystemNewProfileWizardMainPage(Wizard wizard)
- {
- super(wizard, "NewProfile", //$NON-NLS-1$
- SystemResources.RESID_NEWPROFILE_PAGE1_TITLE,
- SystemResources.RESID_NEWPROFILE_PAGE1_DESCRIPTION);
- ISystemProfile[] profiles = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfiles();
- Vector profileNames = new Vector(profiles.length);
- for (int i=0; i<profiles.length; i++) {
- profileNames.add(profiles[i].getName());
- }
- nameValidator = new ValidatorProfileName(profileNames);
- setHelp(HELPID_PREFIX+"0000"); //$NON-NLS-1$
- }
-
- /**
- * CreateContents is the one method that must be overridden from the parent class.
- * In this method, we populate an SWT container with widgets and return the container
- * to the caller (JFace). This is used as the contents of this page.
- */
- public Control createContents(Composite parent)
- {
- // Inner composite
- int nbrColumns = 2;
- Composite composite_prompts = SystemWidgetHelpers.createComposite(parent, nbrColumns);
-
- // Name
- textName = SystemWidgetHelpers.createLabeledTextField(
- composite_prompts, null, SystemResources.RESID_NEWPROFILE_NAME_LABEL, SystemResources.RESID_NEWPROFILE_NAME_TOOLTIP);
- textName.setTextLimit(ValidatorProfileName.MAX_PROFILENAME_LENGTH); // defect 41816
- //SystemWidgetHelpers.setHelp(textName, HELPID_PREFIX+"0001", HELPID_PREFIX+"0000");
- SystemWidgetHelpers.setHelp(textName, HELPID_PREFIX+"0001"); //$NON-NLS-1$
-
- // Make active
- makeActiveCB = SystemWidgetHelpers.createCheckBox(
- composite_prompts, nbrColumns, null, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_LABEL, SystemResources.RESID_NEWPROFILE_MAKEACTIVE_TOOLTIP);
- makeActiveCB.setSelection(true);
- //SystemWidgetHelpers.setHelp(makeActiveCB, HELPID_PREFIX+"0002", HELPID_PREFIX+"0000");
- SystemWidgetHelpers.setHelp(makeActiveCB, HELPID_PREFIX+"0002"); //$NON-NLS-1$
-
- // Verbiage
- addGrowableFillerLine(composite_prompts, nbrColumns);
- addSeparatorLine(composite_prompts, nbrColumns);
- SystemWidgetHelpers.createVerbiage(composite_prompts, SystemResources.RESID_NEWPROFILE_VERBIAGE, nbrColumns, false, 200);
-
- textName.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateNameInput();
- }
- }
- );
-
- // SET CONTEXT HELP IDS...
- //SystemWidgetHelpers.setHelp(textName, HELPID_PREFIX + "0001", HELPID_PREFIX + "0000");
- //SystemWidgetHelpers.setHelp(makeActiveCB, HELPID_PREFIX + "0002", HELPID_PREFIX + "0000");
-
- return composite_prompts;
- }
- /**
- * Return the Control to be given initial focus.
- * Override from parent. Return control to be given initial focus.
- */
- protected Control getInitialFocusControl()
- {
- return textName;
- }
-
- /**
- * This hook method is called whenever the text changes in the input field.
- * The default implementation delegates the request to an <code>ISystemValidator</code> object.
- * If the <code>ISystemValidator</code> reports an error the error message is displayed
- * in the Dialog's message line.
- */
- protected SystemMessage validateNameInput()
- {
- errorMessage= nameValidator.validate(textName.getText());
- if (errorMessage != null)
- setErrorMessage(errorMessage);
- else
- clearErrorMessage();
- setPageComplete(errorMessage==null);
- return errorMessage;
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish()
- {
- boolean ok = (validateNameInput()==null);
- if (ok)
- {
- profileName = textName.getText().trim();
- makeActive = makeActiveCB.getSelection();
- }
- return ok;
- }
-
- // --------------------------------- //
- // METHODS FOR EXTRACTING USER DATA ...
- // --------------------------------- //
- /**
- * Return user-entered profile name.
- * Call this after finish ends successfully.
- */
- public String getProfileName()
- {
- return profileName;
- }
- /**
- * Return user-entered decision to make the new profile active.
- * Call this after finish ends successfully.
- */
- public boolean getMakeActive()
- {
- return makeActive;
- }
-
-
- // ISystemMessageLine methods
-// public void clearMessage()
-// {
-// setMessage(null);
-// }
- //public void clearErrorMessage()
- //{
- //setErrorMessage(null);
- //}
-
- public Object getLayoutData()
- {
- return null;
- }
-
- public void setLayoutData(Object gridData)
- {
- }
-
- /**
- * Return true if the page is complete, so to enable Finish.
- * Called by wizard framework.
- */
- public boolean isPageComplete()
- {
- return (textName.getText().trim().length()>0);
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSEDynamicNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSEDynamicNewConnectionWizard.java
deleted file mode 100644
index cf2eb98f9..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSEDynamicNewConnectionWizard.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import org.eclipse.rse.core.IRSESystemType;
-
-/**
- * Interface to be implemented from dynamic RSE new connection
- * wizards in order to influence attributes and behaviour of the
- * wizard based on the current system state.
- */
-public interface IRSEDynamicNewConnectionWizard {
-
- /**
- * Validate the catgory id the wizard is proposed to be associated with.
- * Dependent on the specified system type, the wizard may change the category
- * id or just return the proposed category id.
- *
- * @param systemType The system type. Must be not <code>null</code>.
- * @param proposedCategoryId The proposed category id. Might be <code>null</code>.
- * @return The category id or <code>null</code>.
- */
- public String validateCategoryId(IRSESystemType systemType, String proposedCategoryId);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSENewConnectionWizardDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSENewConnectionWizardDescriptor.java
deleted file mode 100644
index 79c6285bb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/IRSENewConnectionWizardDescriptor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardDescriptor;
-
-/**
- * RSE new connection wizard descriptor.
- */
-public interface IRSENewConnectionWizardDescriptor extends IRSEWizardDescriptor {
-
- /**
- * Returns a semicolon separated list of system type id's this
- * wizard is used for. The system type id's might contain wildcards
- * ('*' or '?'). The method will return <code>null</code> if the
- * attribute is not set.
- *
- * @return The list of system type id's or <code>null</code>.
- */
- public String getDeclaredSystemTypeIds();
-
- /**
- * Returns the list of system type ids the wizard is supporting.
- * The list is combined from the list of currently registered
- * system types cleaned up by the ones not matching the declared
- * system type ids.
- *
- * @return The list of supported system type ids. May be empty,
- * but never <code>null</code>.
- */
- public String[] getSystemTypeIds();
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/ISystemNewConnectionWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/ISystemNewConnectionWizardPage.java
deleted file mode 100644
index dd90c40aa..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/ISystemNewConnectionWizardPage.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*********************************************************************************
- * Copyright (c) 2008 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Dykstal (IBM) - initial contribution.
- * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
- *********************************************************************************/
-
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import org.eclipse.rse.core.model.ISubSystemConfigurator;
-
-
-/**
- * Interface that all subsystem configuration supplied pages contributed to the
- * New Connection wizard must implement. Moved from Core to UI in RSE 3.0
- *
- * @see org.eclipse.rse.ui.wizards.AbstractSystemNewConnectionWizardPage
- * @see org.eclipse.rse.ui.view.SubSystemConfigurationAdapter#
- * getNewConnectionWizardPages
- * (org.eclipse.rse.core.subsystems.ISubSystemConfiguration,
- * org.eclipse.jface.wizard.IWizard)
- * @since 3.0 moved from Core to UI and extends ISubSystemConfigurator
- */
-public interface ISystemNewConnectionWizardPage extends ISubSystemConfigurator {
-
- /**
- * This is called when the users presses Finish. All that should be done here is validation
- * of the input.
- * @return true if all is ok and the finish can proceed.
- */
- public boolean performFinish();
-
- /**
- * This is called frequently by the framework to decide whether to enable the Finish and Next buttons.
- * <p>
- * @return true if the page is complete and has no errors.
- */
- public boolean isPageComplete();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEAbstractNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEAbstractNewConnectionWizard.java
deleted file mode 100644
index 26d1940b6..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEAbstractNewConnectionWizard.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Abstract base implementation of the RSE new connection wizard.
- */
-public abstract class RSEAbstractNewConnectionWizard extends Wizard implements ISelectionChangedListener {
- private IRSESystemType systemType;
- private boolean isBusy;
-
- /**
- * Constructor.
- */
- public RSEAbstractNewConnectionWizard() {
- systemType = null;
- isBusy = false;
-
- setNeedsProgressMonitor(true);
- setForcePreviousAndNextButtons(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#dispose()
- */
- public void dispose() {
- super.dispose();
- systemType = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.IRSENewConnectionWizardDelegate#getSystemType()
- */
- public IRSESystemType getSystemType() {
- return systemType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- if (event != null && event.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- Object candidate = selection.getFirstElement();
- if (candidate instanceof IRSESystemType) systemType = (IRSESystemType)candidate;
- }
- }
-
- /**
- * Sets the system cursor to a wait cursor. This method can be called in
- * a display thread only!
- *
- * @param busy <code>True</code> if to show the wait cursor, <code>false</code> otherwise.
- */
- protected void setBusyCursor(boolean busy) {
- assert Display.findDisplay(Thread.currentThread()) != null;
-
- Shell shell = getShell();
- if (isBusy != busy) {
- if (shell != null) {
- shell.setCursor(busy ? shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT) : null);
- }
- isBusy = busy;
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java
deleted file mode 100644
index be0479b86..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
- * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
- * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
- * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
- * Uwe Stieber (Wind River) - [192202] Default RSE new connection wizard does not allow to query created host instance anymore
- * Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
- * David Dykstal (IBM) - [168976][api] move ISystemNewConnectionWizardPage from core to UI
- * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
- * David McKnight (IBM) - [243332] Removing wizard page caused subsystem to be removed
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISubSystemConfigurator;
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.internal.ui.view.SystemPerspectiveHelpers;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.ui.ISystemMessages;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemConnectionForm;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.subsystems.ISubSystemConfigurationAdapter;
-
-/**
- * Standard RSE new connection wizard implementation.
- */
-public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizard {
-
- private RSEDefaultNewConnectionWizardMainPage mainPage;
- private ISystemNewConnectionWizardPage[] subsystemConfigurationSuppliedWizardPages;
-
- private Map ssfWizardPagesPerSystemType = new Hashtable();
- private String defaultUserId;
- private String defaultConnectionName;
- private String defaultHostName;
- private String[] activeProfileNames = null;
- private int privateProfileIndex = -1;
- private ISystemProfile privateProfile = null;
- private IHost selectedContext = null;
- private static String lastProfile = null;
- private IHost createdHost = null;
-
- /**
- * Constructor.
- */
- public RSEDefaultNewConnectionWizard() {
- String[] profiles = RSECorePlugin.getTheSystemProfileManager().getActiveSystemProfileNames();
- // normalize the profiles by sorting our null or empty profile names
- List normalized = new LinkedList();
- for (int i = 0; i < profiles.length; i++) {
- if (profiles[i] != null && !"".equals(profiles[i].trim())) normalized.add(profiles[i]); //$NON-NLS-1$
- }
- activeProfileNames = (String[])normalized.toArray(new String[normalized.size()]);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#dispose()
- */
- public void dispose() {
- super.dispose();
-
- mainPage = null;
- subsystemConfigurationSuppliedWizardPages = null;
- ssfWizardPagesPerSystemType.clear();
- defaultUserId = null;
- defaultHostName = null;
- defaultConnectionName = null;
- activeProfileNames = null;
- privateProfileIndex = -1;
- privateProfile = null;
- selectedContext = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.AbstractNewConnectionWizard#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event) {
- super.selectionChanged(event);
- if (mainPage != null && getSystemType() != null) {
- IRSESystemType systemType = getSystemType();
- mainPage.setTitle(getPageTitle());
- mainPage.setSystemType(systemType);
- subsystemConfigurationSuppliedWizardPages = getAdditionalWizardPages(systemType);
- }
- }
-
- /**
- * Creates the wizard pages. This method is an override from the parent Wizard class.
- */
- public void addPages() {
- try {
- // reset the remembered created host instance
- createdHost = null;
-
- mainPage = createMainPage(getSystemType());
-
- SystemConnectionForm form = mainPage.getSystemConnectionForm();
- if (form != null) {
- form.setCurrentlySelectedConnection(selectedContext);
-
- if (defaultUserId != null) form.setUserId(defaultUserId);
-
- // bugzilla#175153: setCurrentlySelectedConnection is filling in the name from the selected
- // connection. As this is not wanted, set the connection name field always to be empty, except
- // there had been a default connection name explicitly set from outside.
- if (defaultConnectionName != null) form.setConnectionName(defaultConnectionName);
- else form.setConnectionName(""); //$NON-NLS-1$
-
- if (defaultHostName != null) form.setHostName(defaultHostName);
- }
-
- if (mainPage != null && getSystemType() != null) mainPage.setSystemType(getSystemType());
-
- updateDefaultSelectedProfile();
-
- addPage(mainPage);
- } catch (Exception exc) {
- SystemBasePlugin.logError("New connection: Error in createPages: ", exc); //$NON-NLS-1$
- }
- }
-
- /**
- * Creates the wizard's main page. This method is an override from the parent class.
- */
- protected RSEDefaultNewConnectionWizardMainPage createMainPage(IRSESystemType systemType) {
- if (mainPage == null) {
- mainPage = new RSEDefaultNewConnectionWizardMainPage(this, getPageTitle(), SystemResources.RESID_NEWCONN_PAGE1_DESCRIPTION);
- mainPage.setTitle(getPageTitle());
- mainPage.setSystemType(systemType);
- subsystemConfigurationSuppliedWizardPages = systemType != null ? getAdditionalWizardPages(systemType) : null;
- }
-
- return mainPage;
- }
-
- public String getPageTitle() {
-
- String pageTitle = null;
-
- if (getSystemType() == null) {
- pageTitle = SystemResources.RESID_NEWCONN_PAGE1_TITLE;
- } else {
- IRSESystemType onlySystemType = getSystemType();
-
- if (onlySystemType.isLocal()) {
- pageTitle = SystemResources.RESID_NEWCONN_PAGE1_LOCAL_TITLE;
- } else {
- pageTitle = SystemResources.RESID_NEWCONN_PAGE1_REMOTE_TITLE;
- pageTitle = SystemMessage.sub(pageTitle, "&1", onlySystemType.getLabel()); //$NON-NLS-1$
- }
- }
-
- return pageTitle;
- }
-
- /**
- * Calculates the default profile name to propose on the default new
- * connection wizard main page.
- *
- * <pre>
- * Expected order of default profile selection:
- * 1. If a connection is selected, the default profile is the one from the connection.
- * 2. If the wizard remembered the last profile and this last remembered profile is still
- * available and active, the remembered last profile is the default profile.
- * 3. If the default private system profile is availabe and active, the default private system profile
- * is the default profile.
- * 4. The first non-empty profile from the list of active profiles is the default profile.
- *
- * In case a profile name is not in the list of currently active profiles, the logic will
- * fall trough to the next lower level.
- * </pre>
- */
- protected void updateDefaultSelectedProfile() {
- if (mainPage == null) return;
-
- List profileNames = activeProfileNames != null ? Arrays.asList(activeProfileNames) : new ArrayList();
- mainPage.getSystemConnectionForm().setProfileNames(activeProfileNames);
-
- // 1. If a connection is selected, the default profile is the one from the connection.
- String defaultProfileName = selectedContext != null ? selectedContext.getSystemProfileName() : null;
- if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) {
- // 3. If the wizard is invoked the 2nd time and a last profile is remembered, the last
- // profile is the default profile.
- if (lastProfile != null && "".equals(lastProfile)) lastProfile = null; //$NON-NLS-1$
- defaultProfileName = lastProfile;
- if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) {
- // 2. If the wizard is invoked the 1st time, the default private system profile is the
- // default profile.
- ISystemProfile defaultPrivateProfile = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getDefaultPrivateSystemProfile();
- if (defaultPrivateProfile != null) defaultProfileName = defaultPrivateProfile.getName();
- if (defaultProfileName == null || !profileNames.contains(defaultProfileName)) {
- // 4. The first non-empty profile from the list of active profiles is the default profile.
- // Note: The profile names get normalized within the constructor.
- if (profileNames.size() > 0) defaultProfileName = (String)profileNames.get(0);
- }
- }
- }
-
- // set the default profile to the page and remember it.
- if (defaultProfileName != null) {
- mainPage.getSystemConnectionForm().setProfileNamePreSelection(defaultProfileName);
- // do not update the last selected profile marker if the default profile
- // name came for the selected context.
- if (selectedContext == null || !defaultProfileName.equals(selectedContext.getSystemProfileName()))
- lastProfile = defaultProfileName;
- }
-
- }
-
- /**
- * Set the currently selected context. Used to better default entry fields.
- */
- public void setSelectedContext(IHost selectedContext) {
- this.selectedContext = selectedContext;
- updateDefaultSelectedProfile();
- }
-
- /**
- * For "new" mode, allows setting of the initial user Id. Sometimes subsystems
- * like to have their own default userId preference page option. If so, query
- * it and set it here by calling this.
- */
- public void setUserId(String userId) {
- defaultUserId = userId;
- if (mainPage != null) mainPage.getSystemConnectionForm().setUserId(userId);
- }
-
- /**
- * Preset the connection name
- */
- public void setConnectionName(String name) {
- defaultConnectionName = name;
- if (mainPage != null) mainPage.getSystemConnectionForm().setConnectionName(name);
- }
-
- /**
- * Preset the host name
- */
- public void setHostName(String name) {
- defaultHostName = name;
- if (mainPage != null) mainPage.getSystemConnectionForm().setHostName(name);
- }
-
- /**
- * Set's an error message to the wizard if a page, which is not the current page
- * is having a page error.
- */
- private void setPageError(IWizardPage page) {
- IWizardPage currentPage = getContainer().getCurrentPage();
- if (currentPage != page) {
- SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_WIZARD_PAGE_ERROR);
- if (currentPage instanceof WizardPage)
- ((WizardPage)currentPage).setErrorMessage(msg.getLevelOneText());
- }
- }
-
- private ISubSystemConfigurator[] getSubSystemConfigurators()
- {
- // what kind of subsystems do we have here?
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IRSESystemType systemType = getSystemType();
- ISubSystemConfiguration[] configurations = sr.getSubSystemConfigurationsBySystemType(systemType, true);
-
- ArrayList configList = new ArrayList();
- for (int i = 0; i < configurations.length; i++){
- ISubSystemConfiguration configuration = configurations[i];
- ISubSystemConfigurator firstMatch = null;
- for (int j = 0; j < subsystemConfigurationSuppliedWizardPages.length; j++){
- ISystemNewConnectionWizardPage page = subsystemConfigurationSuppliedWizardPages[j];
- ISubSystemConfiguration pageConfiguration = page.getSubSystemConfiguration();
- if (configuration == pageConfiguration){ // found a match
- configList.add(page); // could be more than one
- if (firstMatch == null){
- firstMatch = page;
- }
- }
- }
- if (firstMatch == null){ // no match found so need to provide alternative
- class DefaultConfigurator implements ISubSystemConfigurator {
- private ISubSystemConfiguration _configuration;
- public DefaultConfigurator(ISubSystemConfiguration configuration){
- _configuration = configuration;
- }
-
- public boolean applyValues(ISubSystem ss) {
- return true;
- }
-
- public ISubSystemConfiguration getSubSystemConfiguration() {
- return _configuration;
- }
- }
- configList.add(new DefaultConfigurator(configuration));
- }
- }
- return (ISubSystemConfigurator[])configList.toArray(new ISubSystemConfigurator[configList.size()]);
-
- }
-
- /**
- * Completes processing of the wizard. If this
- * method returns true, the wizard will close;
- * otherwise, it will stay active.
- * This method is an override from the parent Wizard class.
- *
- * @return whether the wizard finished successfully
- */
- public boolean performFinish() {
- boolean ok = mainPage.getSystemConnectionForm().verify(true);
- if (!ok)
- setPageError(mainPage);
- else if (ok && hasAdditionalPages()) {
- for (int idx = 0; ok && (idx < subsystemConfigurationSuppliedWizardPages.length); idx++) {
- ok = subsystemConfigurationSuppliedWizardPages[idx].performFinish();
- if (!ok)
- setPageError((IWizardPage)subsystemConfigurationSuppliedWizardPages[idx]);
- }
- }
- if (ok) {
- boolean cursorSet = true;
- setBusyCursor(true);
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- // if private profile is not null, then we have to rename the private profile
- // with the new profile name
- if (privateProfile != null) {
- try {
- String newName = activeProfileNames[privateProfileIndex];
- sr.renameSystemProfile(privateProfile, newName);
- } catch (SystemMessageException exc) {
- SystemMessageDialog.displayMessage(getShell(), exc);
-
- ok = false;
- } catch (Exception exc) {
- setBusyCursor(false);
- cursorSet = false;
- String msg = "Exception renaming profile "; //$NON-NLS-1$
- SystemBasePlugin.logError(msg, exc);
- SystemMessageDialog.displayExceptionMessage(getShell(), exc);
- ok = false;
- }
- }
-
- if (ok) {
- try {
-
- ISubSystemConfigurator[] configurators = getSubSystemConfigurators();
-
- IRSESystemType systemType = getSystemType();
- SystemConnectionForm form = mainPage.getSystemConnectionForm();
- createdHost = sr.createHost(form.getProfileName(), systemType, form.getConnectionName(), form.getHostName(),
- form.getConnectionDescription(), form.getDefaultUserId(), form.getUserIdLocation(),
- configurators);
-
- setBusyCursor(false);
- cursorSet = false;
-
- // a tweak that is the result of UCD feedback. Phil
- if ((createdHost != null) && SystemPerspectiveHelpers.isRSEPerspectiveActive()) {
- if (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID)) {
- ISubSystem[] objSubSystems = sr.getSubSystemsBySubSystemConfigurationCategory("nativefiles", createdHost); //$NON-NLS-1$
- if ((objSubSystems != null) && (objSubSystems.length > 0))// might be in product that doesn't have iSeries plugins
- RSEUIPlugin.getTheSystemRegistryUI().expandSubSystem(objSubSystems[0]);
- else
- RSEUIPlugin.getTheSystemRegistryUI().expandHost(createdHost);
- } else
- RSEUIPlugin.getTheSystemRegistryUI().expandHost(createdHost);
- }
-
- lastProfile = form.getProfileName();
- } catch (Exception exc) {
- if (cursorSet)
- setBusyCursor(false);
- cursorSet = false;
- String msg = "Exception creating connection "; //$NON-NLS-1$
- SystemBasePlugin.logError(msg, exc);
- SystemMessageDialog.displayExceptionMessage(getShell(), exc);
- ok = false;
- }
- }
- //getShell().setCursor(null);
- //busyCursor.dispose();
- if (cursorSet)
- setBusyCursor(false);
- return ok;
- }
- return ok;
- }
-
- /**
- * Returns the create host instance once the user pressed finished. The created
- * host instance will be reset to <code>null</code> once the wizard got disposed.
- *
- * @return The created host instance or <code>null</code>.
- */
- public IHost getCreatedHost() {
- return createdHost;
- }
-
- /**
- * Private method to get all the wizard pages from all the subsystem factories, given a
- * system type.
- *
- * @param systemType The system type to query the additional subsystem service pages for. Must be not <code>null</code>.
- */
- private ISystemNewConnectionWizardPage[] getAdditionalWizardPages(IRSESystemType systemType) {
- assert systemType != null;
- // this query is expensive, so only do it once...
- subsystemConfigurationSuppliedWizardPages = (ISystemNewConnectionWizardPage[])ssfWizardPagesPerSystemType.get(systemType);
- if (subsystemConfigurationSuppliedWizardPages == null) {
- // query all affected subsystems for their list of additional wizard pages...
- Vector additionalPages = new Vector();
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, true);
- for (int idx = 0; idx < factories.length; idx++) {
- ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)factories[idx].getAdapter(ISubSystemConfigurationAdapter.class);
- if (adapter == null) {
- // try to activate bundle - FIXME should perhaps be done
- // earlier in the action that shows the wizard dialog?
- // And, is it really necessary to get the wizard pages that
- // early already?
- Platform.getAdapterManager().loadAdapter(factories[idx], ISubSystemConfigurationAdapter.class.getName());
- adapter = (ISubSystemConfigurationAdapter) factories[idx].getAdapter(ISubSystemConfigurationAdapter.class);
- }
-
- ISystemNewConnectionWizardPage[] pages = adapter.getNewConnectionWizardPages(factories[idx], this);
- if (pages != null) {
- for (int widx = 0; widx < pages.length; widx++) {
- if (pages[widx] instanceof IWizardPage){
- ((IWizardPage)pages[widx]).setWizard(this);
- }
-
- additionalPages.addElement(pages[widx]);
- }
- }
- }
-
- subsystemConfigurationSuppliedWizardPages = (ISystemNewConnectionWizardPage[])additionalPages.toArray(new ISystemNewConnectionWizardPage[additionalPages.size()]);
-
- ssfWizardPagesPerSystemType.put(systemType, subsystemConfigurationSuppliedWizardPages);
- }
- return subsystemConfigurationSuppliedWizardPages;
- }
-
- /**
- * Return true if there are additional pages. This decides whether to enable the Next button
- * on the main page
- */
- protected boolean hasAdditionalPages() {
- return (subsystemConfigurationSuppliedWizardPages != null) && (subsystemConfigurationSuppliedWizardPages.length > 0);
- }
-
- /**
- * Return the first additional page to show when user presses Next on the
- * main page. In RSE 3.0, the ISystemNewConnectionWizardPage return type was
- * moved from org.eclipse.rse.core into a UI plugin.
- *
- * @since 3.0
- */
- protected ISystemNewConnectionWizardPage getFirstAdditionalPage() {
- if ((subsystemConfigurationSuppliedWizardPages != null) && (subsystemConfigurationSuppliedWizardPages.length > 0)) {
- IWizardPage previousPage = mainPage;
- for (int idx = 0; idx < subsystemConfigurationSuppliedWizardPages.length; idx++) {
- ((IWizardPage)subsystemConfigurationSuppliedWizardPages[idx]).setPreviousPage(previousPage);
- previousPage = (IWizardPage)subsystemConfigurationSuppliedWizardPages[idx];
- }
- return subsystemConfigurationSuppliedWizardPages[0];
- } else
- return null;
- }
-
- // --------------------
- // PARENT INTERCEPTS...
- // --------------------
-
- /**
- * Intercept of Wizard method so we can get the Next button behaviour to work right for the
- * dynamically managed additional wizard pages.
- */
- public IWizardPage getNextPage(IWizardPage page) {
- if (!hasAdditionalPages())
- return null;
- else {
- int index = getAdditionalPageIndex(page);
- if ((index == (subsystemConfigurationSuppliedWizardPages.length - 1)))
- // last page or page not found
- return null;
- return (IWizardPage)subsystemConfigurationSuppliedWizardPages[index + 1];
- }
- }
-
- /**
- * @see org.eclipse.rse.ui.wizards.newconnection.RSEAbstractNewConnectionWizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getPreviousPage(IWizardPage page) {
- return null;
- }
-
- private int getAdditionalPageIndex(IWizardPage page) {
- for (int idx = 0; idx < subsystemConfigurationSuppliedWizardPages.length; idx++) {
- if (page == subsystemConfigurationSuppliedWizardPages[idx])
- return idx;
- }
- return -1;
- }
-
- /**
- * Intercept of Wizard method so we can take into account our additional pages
- */
- public boolean canFinish() {
- boolean ok = mainPage.isPageComplete();
-
- if (ok && hasAdditionalPages()) {
- for (int idx = 0; ok && (idx < subsystemConfigurationSuppliedWizardPages.length); idx++)
- ok = subsystemConfigurationSuppliedWizardPages[idx].isPageComplete();
- }
- return ok;
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java
deleted file mode 100644
index 2b21e11f7..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
- ********************************************************************************/
-
-package org.eclipse.rse.ui.wizards.newconnection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.ui.ISystemConnectionFormCaller;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemConnectionForm;
-import org.eclipse.rse.ui.wizards.RSEDialogPageMessageLine;
-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.ui.PlatformUI;
-
-
-
-/**
- * Default main page of the "New Connection" wizard.
- * This page asks for the primary information, including:
- * <ul>
- * <li>Connection Name
- * <li>Hostname/IP-address
- * <li>UserId
- * <li>Description
- * </ul>
- */
-
-public class RSEDefaultNewConnectionWizardMainPage extends WizardPage implements ISystemConnectionFormCaller {
- private final String parentHelpId = RSEUIPlugin.HELPPREFIX + "wncc0000"; //$NON-NLS-1$;
-
- private SystemConnectionForm form;
- private final RSEDialogPageMessageLine messageLine;
-
- /**
- * Constructor. Use this when you want to supply your own title and
- * description strings.
- */
- public RSEDefaultNewConnectionWizardMainPage(IWizard wizard, String title, String description) {
- super(RSEDefaultNewConnectionWizardMainPage.class.getName());
-
- if (wizard != null) setWizard(wizard);
- if (title != null) setTitle(title);
- if (description != null) setDescription(description);
-
- messageLine = new RSEDialogPageMessageLine(this);
- }
-
- /**
- * Set the system type the page is working with.
- *
- * @param systemType The system type.
- */
- public void setSystemType(IRSESystemType systemType) {
- if (systemType != null) {
- // The page _always_ restrict the system connection form
- // to only one system type.
- getSystemConnectionForm().restrictSystemType(systemType);
- }
- }
-
- /**
- * Returns the associated system connection form instance. Override to
- * return custom system connection forms. As the system connection form
- * is accessed directly to set and query the managed data of this form,
- * this method must return always the same instance once the instance has
- * been created for each subsequent call, until the page is disposed!
- *
- * @see org.eclipse.rse.ui.SystemConnectionForm
- * @return The associated system connection form. Must be never <code>null</code>.
- */
- public SystemConnectionForm getSystemConnectionForm() {
- if (form == null) {
- form = new SystemConnectionForm(messageLine, this);
- form.setConnectionNameValidators(SystemConnectionForm.getConnectionNameValidators());
- }
- return form;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && getSystemConnectionForm() != null && getSystemConnectionForm().getInitialFocusControl() != null) {
- getSystemConnectionForm().getInitialFocusControl().setFocus();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.AbstractSystemWizardPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- getSystemConnectionForm().createContents(composite, SystemConnectionForm.CREATE_MODE, parentHelpId);
-
- setControl(composite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), parentHelpId);
- }
-
- /**
- * Return true if the page is complete, so to enable Finish.
- * Called by wizard framework.
- */
- public boolean isPageComplete() {
- //System.out.println("Inside isPageComplete. " + form.isPageComplete());
- if (getSystemConnectionForm() != null)
- return getSystemConnectionForm().isPageComplete() && getSystemConnectionForm().isConnectionUnique();
-
- return false;
- }
-
- /**
- * Intercept of WizardPage so we know when Next is pressed
- */
- public IWizardPage getNextPage() {
- // verify contents of page before going to main page
- // this is done because the main page may have input that is not valid, but can
- // only be verified when next is pressed since it requires a long running operation
- if (!getSystemConnectionForm().verify(true)) return null;
-
- RSEDefaultNewConnectionWizard newConnWizard = getWizard() instanceof RSEDefaultNewConnectionWizard ? (RSEDefaultNewConnectionWizard)getWizard() : null;
- if (newConnWizard != null) {
- return (IWizardPage)newConnWizard.getFirstAdditionalPage();
- } else
- return super.getNextPage();
- }
-
- /**
- * Intercept of WizardPge so we know when the wizard framework is deciding whether
- * to enable next or not.
- */
- public boolean canFlipToNextPage() {
- //return isPageComplete() && getNextPage() != null;
-
- RSEDefaultNewConnectionWizard newConnWizard = getWizard() instanceof RSEDefaultNewConnectionWizard ? (RSEDefaultNewConnectionWizard)getWizard() : null;
- if (newConnWizard != null) {
- return (isPageComplete() && newConnWizard.hasAdditionalPages());
- }
-
- return super.canFlipToNextPage();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.ISystemConnectionFormCaller#systemTypeSelected(java.lang.String, boolean)
- */
- public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization) {
- // Not applicable: The Page is driving the system connection form and not the way around!!!
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java
deleted file mode 100644
index d89f528eb..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight, Kushal Munir,
- * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
- * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
- *
- * Contributors:
- * Javier Montalvo Orús (Symbian) - Bug 158555 - newConnectionWizardDelegates can only be used once
- * Uwe Stieber (Wind River) - Reworked new connection wizard extension point.
- * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Uwe Stieber (Wind River) - [189426] System File/Folder Dialogs - New Connection Not Added to Drop Down
- * Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
- *******************************************************************************/
-
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.ISystemIconConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * The New Connection wizard. This wizard allows users to create new RSE connections.
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class RSEMainNewConnectionWizard extends Wizard implements INewWizard, ISelectionProvider {
- /**
- * Dialog settings slot id: Last selected system type id within the wizard.
- * @since 3.0 made protected String public
- */
- public static final String LAST_SELECTED_SYSTEM_TYPE_ID = "lastSelectedSystemTypeId"; //$NON-NLS-1$
-
- // The selected context as passed in from the invoking class.
- // Just pass on to the wizards. Do not interpret here!
- // @see #setSelectedContext(ISelection).
- private ISelection selectedContext;
- // The connection context as determined from the invoking class
- // @see #setConnectionContext(IHost)
- private IHost connectionContext;
-
- private RSENewConnectionWizardRegistry wizardRegistry;
- private IWizard selectedWizard;
- private IRSESystemType selectedSystemType;
- private boolean selectedWizardCanFinishEarly;
-
- private RSENewConnectionWizardSelectionPage mainPage;
- private final List initializedWizards = new LinkedList();
- private final List selectionChangedListener = new LinkedList();
-
- private IRSESystemType[] restrictedSystemTypes;
- private boolean onlySystemType;
-
- /**
- * Constructor.
- */
- public RSEMainNewConnectionWizard() {
- super();
- setWindowTitle(SystemResources.RESID_NEWCONN_TITLE);
- setForcePreviousAndNextButtons(true);
- setNeedsProgressMonitor(true);
-
- // Initialize the dialog settings for this wizard
- IDialogSettings settings = RSEUIPlugin.getDefault().getDialogSettings();
- String sectionName = this.getClass().getName();
- if (settings.getSection(sectionName) == null) settings.addNewSection(sectionName);
- setDialogSettings(settings.getSection(sectionName));
-
- wizardRegistry = new RSENewConnectionWizardRegistry();
- selectedContext = null;
- selectedWizard = null;
- mainPage = new RSENewConnectionWizardSelectionPage(wizardRegistry);
- initializedWizards.clear();
- selectionChangedListener.clear();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#dispose()
- */
- public void dispose() {
- super.dispose();
-
- selectedContext = null;
- selectedSystemType = null;
- selectedWizardCanFinishEarly = false;
- mainPage = null;
- initializedWizards.clear();
- selectionChangedListener.clear();
- restrictedSystemTypes = null;
- onlySystemType = false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#getDefaultPageImage()
- */
- public Image getDefaultPageImage() {
- return RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_NEWCONNECTIONWIZARD_ID);
- }
-
- /**
- * Restrict to a single system type. Users will not be shown the system type selection page in
- * the wizard.
- *
- * @param systemType the system type to restrict to.
- */
- public void restrictToSystemType(IRSESystemType systemType) {
- restrictToSystemTypes(new IRSESystemType[] { systemType });
- }
-
- /**
- * Restrict system types. Users will only be able to choose from the given system types.
- *
- * @param systemTypes the system types to restrict to.
- */
- public void restrictToSystemTypes(IRSESystemType[] systemTypes) {
- assert systemTypes != null;
-
- restrictedSystemTypes = systemTypes;
- onlySystemType = restrictedSystemTypes.length == 1;
- mainPage.restrictToSystemTypes(restrictedSystemTypes);
- onSelectedSystemTypeChanged();
- }
-
- /**
- * Returns if or if not the main new connection wizard has been restricted to only
- * one system type.
- *
- * @return <code>True</code> if the wizard is restricted to only one system type, <code>false</code> otherwise.
- */
- public final boolean isRestrictedToSingleSystemType() {
- return onlySystemType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- assert listener != null;
- if (!selectionChangedListener.contains(listener)) selectionChangedListener.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- assert listener != null;
- selectionChangedListener.remove(listener);
- }
-
- /**
- * Notify the registered selection changed listener about a changed selection.
- */
- private void fireSelectionChanged() {
- if (getSelection() == null) return;
-
- SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
- Iterator iterator = selectionChangedListener.iterator();
- while (iterator.hasNext()) {
- ISelectionChangedListener listener = (ISelectionChangedListener)iterator.next();
- listener.selectionChanged(event);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- ISelection selection = null;
-
- // The system type must be available to construct the selection as
- // the system type is per contract always the first element
- IRSESystemType selected = isRestrictedToSingleSystemType() ? restrictedSystemTypes[0] : selectedSystemType;
- if (selected != null) {
- List selectionElements = new ArrayList();
- selectionElements.add(selected);
- // The second element in the selection is the selected context of the
- // called as passed in to us (if available).
- if (selectedContext != null) {
- selectionElements.add(selectedContext);
- }
-
- // construct the selection now
- selection = new StructuredSelection(selectionElements);
- }
-
- return selection;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
- public void setSelection(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection)selection;
- if (sel.getFirstElement() instanceof IRSESystemType) {
- // update the selected system type.
- selectedSystemType = (IRSESystemType)((IStructuredSelection)selection).getFirstElement();
- } else {
- selectedSystemType = null;
- }
-
- // signal the system type change
- onSelectedSystemTypeChanged();
- }
- }
-
- /**
- * Sets the currently selected context for the wizard as know by the caller
- * of this method. The selected context is not interpreted by the main wizard,
- * the selection is passed on as is to the nested wizards.
- *
- * @param selectedContext The selected context or <code>null</code>.
- */
- public void setSelectedContext(ISelection selectedContext) {
- this.selectedContext = selectedContext;
- }
-
- /**
- * Set the connection context for the wizard as determinded from
- * the caller of this method. If non-null, the method will query
- * the connections context system type and invoke <code>
- * setSelection(...)</code> to apply the system type as the selected
- * one.
- *
- * @param connectionContext The connection context or <code>null</code>.
- */
- public void setConnectionContext(IHost connectionContext) {
- this.connectionContext = connectionContext;
- // If there is an connection context, extract the connections
- // system type from the connection context as use as default
- if (connectionContext != null && connectionContext.getSystemType() != null) {
- IRSESystemType systemType = connectionContext.getSystemType();
- // if we have found the system type object, pass on to setSelection(...)!
- if (systemType != null) setSelection(new StructuredSelection(systemType));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- setSelection(selection);
- }
-
- /**
- * Returns the wizard for the currently selected system type.
- *
- * @return The wizard for the currently selected system type. Must be never <code>null</code>.
- */
- public IWizard getSelectedWizard() {
- return selectedWizard;
- }
-
- /**
- * Called either by <code>restrictToSystemTypes(...)</code> or <code>
- * setSelectedSystemType(...)</code> to notify that the selected system
- * type has changed.
- */
- protected void onSelectedSystemTypeChanged() {
- // unregister the previous selected wizard as selection changed listener
- if (selectedWizard instanceof ISelectionChangedListener) removeSelectionChangedListener((ISelectionChangedListener)selectedWizard);
-
- // Check if a wizard is registered for the selected system type
- IRSENewConnectionWizardDescriptor descriptor = getSelection() != null ?
- wizardRegistry.getWizardForSelection((IStructuredSelection) getSelection())
- : null;
- if (descriptor != null) {
- selectedWizard = descriptor.getWizard();
- selectedWizardCanFinishEarly = descriptor.canFinishEarly();
- } else {
- selectedWizard = null;
- selectedWizardCanFinishEarly = false;
- }
-
- // Check on the container association of the selected wizard.
- if (getContainer() != null && selectedWizard != null && !getContainer().equals(selectedWizard.getContainer())) {
- selectedWizard.setContainer(getContainer());
- }
-
- // Check if the wizard defines it's own window title. If not, make sure to pass the
- // main wizards window title.
- if (selectedWizard instanceof Wizard
- && (selectedWizard.getWindowTitle() == null || "".equals(selectedWizard.getWindowTitle()))) { //$NON-NLS-1$
- ((Wizard)selectedWizard).setWindowTitle(getWindowTitle());
- }
-
- // if the newly selected wizard is the default RSE new connection wizard
- // and the selected context is non-null, set the selected context to the
- // default RSE new connection wizard.
- if (selectedWizard instanceof RSEDefaultNewConnectionWizard) {
- ((RSEDefaultNewConnectionWizard)selectedWizard).setSelectedContext(connectionContext);
- }
-
- // register the newly selected wizard as selection changed listener
- if (selectedWizard instanceof ISelectionChangedListener) {
- addSelectionChangedListener((ISelectionChangedListener)selectedWizard);
- }
-
- // Initialize the wizard pages and remember which wizard we have initialized already.
- // Note: Do not call IWizard.addPages() here in case the main wizard is restricted to
- // a single system type. The IWizard.addPages() method will be called from the
- // enclosing wizard dialog directly instead!
- if (!onlySystemType && selectedWizard != null && !initializedWizards.contains(selectedWizard)) {
- selectedWizard.addPages();
- initializedWizards.add(selectedWizard);
- }
-
- // notify the selection changed event to the listeners
- fireSelectionChanged();
-
- // Update the wizard container UI elements
- IWizardContainer container = getContainer();
- if (container != null && container.getCurrentPage() != null) {
- container.updateWindowTitle();
- container.updateTitleBar();
- container.updateButtons();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- public void addPages() {
- addPage(mainPage);
- // and restore the wizard's selection state from last session
- restoreWidgetValues();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getNextPage(IWizardPage page) {
- IWizardPage nextPage = null;
- if (page != null && page == mainPage) {
- // Save the last selected system type on page transition.
- // But only if it is the main page.
- saveWidgetValues();
- if (getSelectedWizard() != null) nextPage = getSelectedWizard().getStartingPage();
- }
-
- if (nextPage == null) super.getNextPage(page);
- if (nextPage != null) nextPage.setPreviousPage(page);
-
- return nextPage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- public boolean canFinish() {
- // We can finish from the main new connection wizard only if the selected
- // wizard can finish early
- return selectedWizardCanFinishEarly;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.AbstractSystemWizard#performFinish()
- */
- public boolean performFinish() {
- // Save the current selection to the dialog settings
- saveWidgetValues();
-
- if (mainPage != null) mainPage.saveWidgetValues();
-
- return true;
- }
-
- /**
- * Save the last selected system type id to the dialog settings.
- * Called from <code>onSelectedSystemTypeChanged</code> and <code>
- * performFinish</code>.
- */
- protected void saveWidgetValues() {
- IDialogSettings dialogSettings = getDialogSettings();
- if (dialogSettings != null && getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection)getSelection();
- if (selection.getFirstElement() instanceof IRSESystemType) {
- dialogSettings.put(LAST_SELECTED_SYSTEM_TYPE_ID, ((IRSESystemType)selection.getFirstElement()).getId());
- }
- }
- }
-
- /**
- * Restore the persistent saved wizard state. This method
- * is called from the wizards constructor.
- */
- protected void restoreWidgetValues() {
- IDialogSettings dialogSettings = getDialogSettings();
- if (dialogSettings != null) {
- // Note: Current mode is that the remembered last selected system type id
- // has priority over the type of a host selection within the remote
- // systems view. We are leaving it that way for now out of consistency
- // reason. If the host selection within the remote system view should
- // get ever the priority, check for 'selectedSystemType == null' additional
- // to the check for 'systemTypeId != null'.
- String systemTypeId = dialogSettings.get(LAST_SELECTED_SYSTEM_TYPE_ID);
- if (systemTypeId != null) {
- IRSESystemType systemType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(systemTypeId);
- if (systemType != null) {
- setSelection(new StructuredSelection(systemType));
- }
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardDescriptor.java
deleted file mode 100644
index f9ae8b811..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardDescriptor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemTypeMatcher;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-import org.eclipse.rse.ui.wizards.registries.RSEAbstractWizardRegistry;
-import org.eclipse.rse.ui.wizards.registries.RSEWizardDescriptor;
-
-
-/**
- * RSE new connection wizard descriptor implementation
- */
-public class RSENewConnectionWizardDescriptor extends RSEWizardDescriptor implements IRSENewConnectionWizardDescriptor {
- private final SystemTypeMatcher systemTypeMatcher;
-
- // The list of resolved system type ids supported by this wizard.
- private List resolvedSystemTypeIds;
-
- /**
- * Constructor
- *
- * @param wizardRegistry The parent wizard registry this element belongs to. Must be not <code>null</code>.
- * @param element The configuration element which is declaring a wizard. Must be not <code>null</code>.
- */
- public RSENewConnectionWizardDescriptor(RSEAbstractWizardRegistry wizardRegistry, IConfigurationElement element) {
- super(wizardRegistry, element);
- systemTypeMatcher = new SystemTypeMatcher(getDeclaredSystemTypeIds());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.newconnection.INewConnectionWizardDescriptor#getDeclaredSystemTypeIds()
- */
- public String getDeclaredSystemTypeIds() {
- return getConfigurationElement().getAttribute("systemTypeIds"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.newconnection.INewConnectionWizardDescriptor#getSystemTypeIds()
- */
- public String[] getSystemTypeIds() {
- if (resolvedSystemTypeIds == null) {
- resolvedSystemTypeIds = new LinkedList();
-
- // If the subsystem configuration supports all system types, just add all
- // currently registered system types to th resolved list
- if (systemTypeMatcher.supportsAllSystemTypes()) {
- IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
- for (int i = 0; i < systemTypes.length; i++) resolvedSystemTypeIds.add(systemTypes[i].getId());
- } else {
- // We have to match the given lists of system type ids against
- // the list of available system types. As the list of system types cannot
- // change ones it has been initialized, we filter out the not matching ones
- // here directly.
- IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
- for (int i = 0; i < systemTypes.length; i++) {
- IRSESystemType systemType = systemTypes[i];
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(systemType.getAdapter(RSESystemTypeAdapter.class));
- if (systemTypeMatcher.matches(systemType)
- || (adapter != null
- && adapter.acceptWizardDescriptor(getConfigurationElement().getName(), this))) {
- if (!resolvedSystemTypeIds.contains(systemType.getId())) {
- resolvedSystemTypeIds.add(systemType.getId());
- }
- }
- }
- }
- }
-
- return (String[])resolvedSystemTypeIds.toArray(new String[resolvedSystemTypeIds.size()]);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardRegistry.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardRegistry.java
deleted file mode 100644
index 968bf306e..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardRegistry.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- * Javier Montalvo Orus (Symbian) - [174992] default wizard hides special ones
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- * Martin Oberhuber (Wind River) - [235148] get rid of dead code for caching
- * Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardRegistryElement;
-import org.eclipse.rse.ui.wizards.registries.RSEAbstractWizardRegistry;
-
-/**
- * RSE New connection wizard registry implementation.
- *
- * Gives access to the new connection wizards contributed by users, by looking
- * up and creating wizard instances based on search criteria like system type or
- * wizard id. Clients should create a new wizard registry instance for each UI
- * "session" using the registry. For instance, an invocation of the new
- * connection wizard (which delegates to sub-wizards) should always create a new
- * registry instance.
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class RSENewConnectionWizardRegistry extends RSEAbstractWizardRegistry {
-
- // Initialize-On-Demand Holder Class idiom:
- // Lazy initialization and thread-safe single instance.
- // See http://www-106.ibm.com/developerworks/java/library/j-jtp03304/
- private static class LazyInstanceHolder {
- public static RSENewConnectionWizardRegistry instance = new RSENewConnectionWizardRegistry();
- }
-
- /**
- * Return the global new connection wizard registry instance. Note that
- * using a global registry is problematic because sub-wizard state (and thus
- * wizard instances) should not be re-used between separate invocations of a
- * wizard by the user.
- *
- * @deprecated Instantiate a wizard registry yourself using
- * {@link #RSENewConnectionWizardRegistry()} in order to control
- * the lifetime of your wizard registry. Lifetime should be
- * limited to the time a wizard is active. Each new wizard
- * invocation should create a new wizard registry.
- */
- public static RSENewConnectionWizardRegistry getInstance() {
- return LazyInstanceHolder.instance;
- }
-
- /**
- * Constructor.
- *
- * @since org.eclipse.rse.ui 3.0
- */
- public RSENewConnectionWizardRegistry() {
- super();
- }
-
- protected IRSEWizardRegistryElement createWizardRegistryElementFor(IConfigurationElement element) {
- IRSEWizardRegistryElement wizardElement = null;
-
- if ("newConnectionWizard".equals(element.getName())) wizardElement = new RSENewConnectionWizardDescriptor(this, element); //$NON-NLS-1$
-
- return wizardElement != null ? wizardElement : super.createWizardRegistryElementFor(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.RSEAbstractWizardRegistry#getExtensionPointId()
- */
- protected String getExtensionPointId() {
- return RSEUIPlugin.getDefault().getBundle().getSymbolicName() + ".newConnectionWizards"; //$NON-NLS-1$
- }
-
- /**
- * Returns the new connection wizard descriptor to use for the specified selection.
- * The selection is expected to contain the selected system type as first element.
- *
- * @see #getWizardForSystemType(IRSESystemType) for more information.
- *
- * @param selection A structure selection containing the selected system type as first element. Must be not <code>null</code>.
- * @return A registered new connection wizard descriptor or <code>null</code>.
- */
- public IRSENewConnectionWizardDescriptor getWizardForSelection(IStructuredSelection selection) {
- assert selection != null && selection.getFirstElement() instanceof IRSESystemType;
- return getWizardForSystemType((IRSESystemType)selection.getFirstElement());
- }
-
- /**
- * Returns the new connection wizard to use for the specified system type.
- * Once queried for a specific system type, the method returns always the same wizard
- * instance. If there are multiple wizards registered for a specific system type,
- * the first wizard found will be taken and the other wizards will be dropped. If
- * this case is happening, a corresponding warning message is send to the error log.
- *
- * @param systemType The selected system type to query the wizard for. Must be not <code>null</code>.
- * @return A registered new connection wizard or the default RSE new connection wizard. Can be only <code>null</code>
- * if the default RSE new connection wizard contribution has been removed from plugin.xml!
- */
- public IRSENewConnectionWizardDescriptor getWizardForSystemType(IRSESystemType systemType) {
- assert systemType != null;
-
- IRSENewConnectionWizardDescriptor defaultDescriptor = (IRSENewConnectionWizardDescriptor)findElementById("org.eclipse.rse.ui.wizards.newconnection.RSEDefaultNewConnectionWizard"); //$NON-NLS-1$
- IRSENewConnectionWizardDescriptor descriptor = null;
- String id = systemType.getId();
-
- // check if there is any wizard explicitly registered for the given system type
- // Get the list of all wizards and always walk through _all_ of them
- // to find possible duplicates (which will be notified as warnings to
- // the user)
- IRSEWizardRegistryElement[] elements = getElements();
- for (int i = 0; i < elements.length; i++) {
- IRSEWizardRegistryElement element = elements[i];
- if (element instanceof IRSENewConnectionWizardDescriptor) {
- IRSENewConnectionWizardDescriptor candidate = (IRSENewConnectionWizardDescriptor) element;
- if (candidate != defaultDescriptor) {
- String[] systemTypeIds = candidate.getSystemTypeIds();
- if (Arrays.asList(systemTypeIds).contains(id)) {
- if (descriptor == null) {
- descriptor = candidate;
- } else {
- String message = "Duplicated new connection wizard registration for system type ''{0}'' (wizard id = {1})."; //$NON-NLS-1$
- message = NLS.bind(message, id, candidate.getId());
- RSECorePlugin.getDefault().getLogger().logWarning(message);
- }
- }
- }
- }
- }
-
- // if the descriptor here is still null, always return the default RSE
- // new connection wizard descriptor
- if (descriptor == null) {
- descriptor = defaultDescriptor;
- }
-
- return descriptor;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java
deleted file mode 100644
index 9d6a1b60d..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionPage.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- * Uwe Stieber (Wind River) - [209193] RSE new connection wizard shows empty categories if typing something into the filter
- * Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
- *******************************************************************************/
-
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.internal.ui.SystemResources;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardCategory;
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardRegistryElement;
-import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeContentProvider;
-import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeElement;
-import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeLabelProvider;
-import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreePatternFilter;
-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.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FilteredTree;
-import org.eclipse.ui.dialogs.PatternFilter;
-
-/**
- * The New Connection Wizard main page that allows selection of system type.
- * <p>
- * <b>Note:</b> The page allows filtering of the presented wizard list by adapting
- * the associated system type to<br>
- * <ul>
- * <li><code>org.eclipse.jface.viewers.ViewerFilter</code>: calling <code>ViewerFilter.select(...)</code> and double-check via.</li>
- * <li><code>org.eclipse.rse.ui.RSESystemTypeAdapter</code>: calling <code>RSESystemTypeAdapter.isEnabled(...)</code>.</li>
- * </ul>
- */
-public class RSENewConnectionWizardSelectionPage extends WizardPage {
- private final String helpId = RSEUIPlugin.HELPPREFIX + "wncc0000"; //$NON-NLS-1$;
-
- private static final String EXPANDED_CATEGORIES_SETTINGS_ID = "filteredTree.expandedCatogryIds"; //$NON-NLS-1$
- private static final String[] DEFAULT_EXPANDED_CATEGORY_IDS = new String[] { "org.eclipse.rse.ui.wizards.newconnection.default.category" }; //$NON-NLS-1$
-
- private IRSESystemType[] restrictedSystemTypes;
-
- private RSENewConnectionWizardRegistry wizardRegistry;
- private FilteredTree filteredTree;
- private PatternFilter filteredTreeFilter;
- private ViewerFilter filteredTreeWizardStateFilter;
- private RSENewConnectionWizardSelectionTreeDataManager filteredTreeDataManager;
-
- /**
- * Internal class. The wizard state filter is responsible to filter
- * out any not enabled or filtered wizard from the tree.
- */
- private class NewConnectionWizardStateFilter extends ViewerFilter {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer).getContentProvider()).getChildren(element);
- if (children.length > 0) {
- return filter(viewer, element, children).length > 0;
- }
-
- if (element instanceof RSENewConnectionWizardSelectionTreeElement) {
- // the system type must be enabled, otherwise it is filtered out
- IRSESystemType systemType = ((RSENewConnectionWizardSelectionTreeElement)element).getSystemType();
- if (systemType == null) return false;
-
- // if the page is restricted to a set of system types, check on them first
- IRSESystemType[] restricted = getRestrictToSystemTypes();
- if (restricted != null && restricted.length > 0) {
- if (!Arrays.asList(restricted).contains(systemType)) return false;
- }
-
- // First, adapt the system type to a viewer filter and pass on the select request
- // to the viewer filter adapter if available
- ViewerFilter filter = (ViewerFilter)(systemType.getAdapter(ViewerFilter.class));
- if (filter != null && !filter.select(viewer, parentElement, element)) {
- return false;
- }
-
- // Second, double check if the system type passed the viewer filter but is disabled.
- if (!systemType.isEnabled()) return false;
- }
-
- // In all other cases, the element passes the filter
- return true;
- }
- }
-
- /**
- * Internal class. The wizard viewer comparator is responsible for
- * the sorting in the tree. Current implementation is not prioritizing
- * categories.
- */
- private class NewConnectionWizardViewerComparator extends ViewerComparator {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ViewerComparator#isSorterProperty(java.lang.Object, java.lang.String)
- */
- public boolean isSorterProperty(Object element, String property) {
- // The comparator is affected if the label of the elements should change.
- return property.equals(IBasicPropertyConstants.P_TEXT);
- }
- }
-
- /**
- * Constructor.
- * @since org.eclipse.rse.ui 3.0
- */
- public RSENewConnectionWizardSelectionPage(RSENewConnectionWizardRegistry wizardRegistry) {
- super("RSENewConnectionWizardSelectionPage"); //$NON-NLS-1$
- setTitle(getDefaultTitle());
- setDescription(getDefaultDescription());
- this.wizardRegistry = wizardRegistry;
- }
-
- /**
- * Constructor.
- *
- * @deprecated Use
- * {@link #RSENewConnectionWizardSelectionPage(RSENewConnectionWizardRegistry)}
- * to control the lifetime of the wizard registry
- */
- public RSENewConnectionWizardSelectionPage() {
- this(RSENewConnectionWizardRegistry.getInstance());
- }
-
- /**
- * Returns the default page title.
- *
- * @return The default page title. Must be never <code>null</code>.
- */
- protected String getDefaultTitle() {
- return SystemResources.RESID_NEWCONN_MAIN_PAGE_TITLE;
- }
-
- /**
- * Returns the default page description.
- *
- * @return The default page description. Must be never <code>null</code>.
- */
- protected String getDefaultDescription() {
- return SystemResources.RESID_NEWCONN_MAIN_PAGE_DESCRIPTION;
- }
-
- /**
- * Restrict the selectable wizards to the given set of system types.
- *
- * @param systemTypes The list of the system types to restrict the page to or <code>null</code>.
- */
- public void restrictToSystemTypes(IRSESystemType[] systemTypes) {
- this.restrictedSystemTypes = systemTypes;
- }
-
- /**
- * Returns the list of system types the page is restricted to.
- *
- * @return The list of system types the page is restricted to or <code>null</code>.
- * @since 3.0 made protected method public
- */
- public IRSESystemType[] getRestrictToSystemTypes() {
- return restrictedSystemTypes;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label label = new Label(composite, SWT.NONE);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- label.setText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_LABEL + ":"); //$NON-NLS-1$
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- filteredTreeFilter = new RSEWizardSelectionTreePatternFilter();
- filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filteredTreeFilter);
- filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- GridData layoutData = new GridData(GridData.FILL_BOTH);
- layoutData.heightHint = 325; layoutData.widthHint = 450;
- filteredTree.setLayoutData(layoutData);
-
- final TreeViewer treeViewer = filteredTree.getViewer();
- treeViewer.setContentProvider(new RSEWizardSelectionTreeContentProvider());
- // Explicitly allow the tree items to get decorated!!!
- treeViewer.setLabelProvider(new DecoratingLabelProvider(new RSEWizardSelectionTreeLabelProvider(), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
- treeViewer.setComparator(new NewConnectionWizardViewerComparator());
-
- filteredTreeWizardStateFilter = new NewConnectionWizardStateFilter();
- treeViewer.addFilter(filteredTreeWizardStateFilter);
-
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- onSelectionChanged();
- }
- });
- treeViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- // Double-click on a connection type is triggering the sub wizard
- if (event.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- // The tree is single selection, so look for the first element only.
- Object element = selection.getFirstElement();
- if (element instanceof RSENewConnectionWizardSelectionTreeElement) {
- // Double-click on a connection type is triggering the sub wizard
- if (canFlipToNextPage()) getWizard().getContainer().showPage(getNextPage());
- } else if (event.getViewer() instanceof TreeViewer) {
- TreeViewer viewer = (TreeViewer)event.getViewer();
- if (viewer.isExpandable(element)) {
- viewer.setExpandedState(element, !viewer.getExpandedState(element));
- }
- }
- }
- }
- });
-
- filteredTreeDataManager = new RSENewConnectionWizardSelectionTreeDataManager(wizardRegistry);
- treeViewer.setInput(filteredTreeDataManager);
-
- // apply the standard dialog font
- Dialog.applyDialogFont(composite);
-
- setControl(composite);
-
- // Restore the expanded state of the category items within the tree
- // before initializing the selection.
- restoreWidgetValues();
-
- // Initialize the selection in the tree
- if (getWizard() instanceof ISelectionProvider) {
- ISelectionProvider selectionProvider = (ISelectionProvider)getWizard();
- if (selectionProvider.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();
- if (selection.getFirstElement() instanceof IRSESystemType) {
- IRSESystemType systemType = (IRSESystemType)selection.getFirstElement();
- RSENewConnectionWizardSelectionTreeElement treeElement = filteredTreeDataManager.getTreeElementForSystemType(systemType);
- if (treeElement != null) treeViewer.setSelection(new StructuredSelection(treeElement), true);
- }
- }
- }
-
- // we put the initial focus into the filter field
- filteredTree.getFilterControl().setFocus();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), helpId);
-
- }
-
- /**
- * Called from the selection listener to propage the current
- * system type selection to the underlaying wizard.
- */
- protected void onSelectionChanged() {
- IWizard wizard = getWizard();
- if (wizard instanceof ISelectionProvider && filteredTree.getViewer().getSelection() instanceof IStructuredSelection) {
- ISelectionProvider selectionProvider = (ISelectionProvider)wizard;
- IStructuredSelection filteredTreeSelection = (IStructuredSelection)filteredTree.getViewer().getSelection();
- if (filteredTreeSelection.getFirstElement() instanceof RSENewConnectionWizardSelectionTreeElement) {
- RSENewConnectionWizardSelectionTreeElement element = (RSENewConnectionWizardSelectionTreeElement)filteredTreeSelection.getFirstElement();
- selectionProvider.setSelection(new StructuredSelection(element.getSystemType()));
- if (element.getDescription() != null) {
- setDescription(element.getDescription());
- } else {
- if (!getDefaultDescription().equals(getDescription())) setDescription(getDefaultDescription());
- }
- } else {
- selectionProvider.setSelection(null);
- }
- }
-
- // Update the wizard container UI elements
- IWizardContainer container = getContainer();
- if (container != null && container.getCurrentPage() != null) {
- container.updateWindowTitle();
- container.updateTitleBar();
- container.updateButtons();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.WizardPage#getDialogSettings()
- */
- protected IDialogSettings getDialogSettings() {
- // If the wizard is set and returns dialog settings, we re-use them here
- IDialogSettings settings = super.getDialogSettings();
- // If the dialog settings could not set from the wizard, fallback to the plugins
- // dialog settings store.
- if (settings == null) settings = RSEUIPlugin.getDefault().getDialogSettings();
- String sectionName = this.getClass().getName();
- if (settings.getSection(sectionName) == null) settings.addNewSection(sectionName);
- settings = settings.getSection(sectionName);
-
- return settings;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- // if the page will become hidden, save the expansion state of
- // the tree elements.
- if (!visible) saveWidgetValues();
- }
-
- /**
- * Restore the tree state from the dialog settings.
- */
- public void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] expandedCategories = settings.getArray(EXPANDED_CATEGORIES_SETTINGS_ID);
- // by default we expand always the "General" category.
- if (expandedCategories == null) expandedCategories = DEFAULT_EXPANDED_CATEGORY_IDS;
- if (expandedCategories != null) {
- List expanded = new ArrayList();
- for (int i = 0; i < expandedCategories.length; i++) {
- String categoryId = expandedCategories[i];
- if (categoryId != null && !"".equals(categoryId.trim())) { //$NON-NLS-1$
- IRSEWizardRegistryElement registryElement = wizardRegistry.findElementById(categoryId);
- if (registryElement instanceof IRSEWizardCategory) {
- RSEWizardSelectionTreeElement treeElement = filteredTreeDataManager.getTreeElementForCategory((IRSEWizardCategory)registryElement);
- if (treeElement != null) expanded.add(treeElement);
- }
- }
- }
-
- if (expanded.size() > 0) filteredTree.getViewer().setExpandedElements(expanded.toArray());
- }
- }
- }
-
- /**
- * Saves the tree state to the dialog settings.
- */
- public void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- List expandedCategories = new ArrayList();
- Object[] expanded = filteredTree.getViewer().getVisibleExpandedElements();
- for (int i = 0; i < expanded.length; i++) {
- if (expanded[i] instanceof RSEWizardSelectionTreeElement) {
- IRSEWizardRegistryElement registryElement = ((RSEWizardSelectionTreeElement)expanded[i]).getWizardRegistryElement();
- if (registryElement instanceof IRSEWizardCategory) {
- expandedCategories.add(((IRSEWizardCategory)registryElement).getId());
- }
- }
- }
- settings.put(EXPANDED_CATEGORIES_SETTINGS_ID, (String[])expandedCategories.toArray(new String[expandedCategories.size()]));
- }
- }
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeDataManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeDataManager.java
deleted file mode 100644
index a0789348c..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeDataManager.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardCategory;
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardRegistryElement;
-import org.eclipse.rse.ui.wizards.registries.RSEAbstractWizardSelectionTreeDataManager;
-import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeElement;
-
-/**
- * New connection wizard selection tree data manager.
- */
-public class RSENewConnectionWizardSelectionTreeDataManager extends RSEAbstractWizardSelectionTreeDataManager {
- // The element map is required to translate from IRSESystemType object instance
- // into RSENewConnectionWizardSelectionTreeElement object instances as the tree
- // and the wizard using these different object instances in their selections!
- private Map elementMap;
-
- // The category map is doing the same as the element but for categories.
- private Map categoryMap;
-
- /**
- * Constructor.
- * @since org.eclipse.rse.ui 3.0
- */
- public RSENewConnectionWizardSelectionTreeDataManager(RSENewConnectionWizardRegistry wizardRegistry) {
- super(wizardRegistry);
- }
-
- /**
- * Constructor.
- *
- * @deprecated Use
- * {@link #RSENewConnectionWizardSelectionTreeDataManager(RSENewConnectionWizardRegistry)}
- * to control the lifetime of the wizard registry
- */
- public RSENewConnectionWizardSelectionTreeDataManager() {
- this(RSENewConnectionWizardRegistry.getInstance());
- }
-
- /**
- * Returns the corresponding wizard selection tree element for the specified
- * system type.
- *
- * @param systemType The system type. Must be not <code>null</code>.
- * @return The wizard selection tree element or <code>null</code>.
- */
- public RSENewConnectionWizardSelectionTreeElement getTreeElementForSystemType(IRSESystemType systemType) {
- assert systemType != null;
- return (RSENewConnectionWizardSelectionTreeElement)elementMap.get(systemType);
- }
-
- /**
- * Returns the corresponding wizard selection tree element for the specified category.
- *
- * @param category The category. Must be not <code>null</code>.
- * @return The wizard selection tree element or <code>null</code>.
- */
- public RSEWizardSelectionTreeElement getTreeElementForCategory(IRSEWizardCategory category) {
- assert category != null;
- return (RSEWizardSelectionTreeElement)categoryMap.get(category);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.internal.wizards.newconnection.RSEAbstractWizardSelectionTreeDataManager#initialize(java.util.Set)
- */
- protected void initialize(Set rootElement) {
- // we must check the elementMap here for null as the static
- // constructors may not have called yet as this method is called
- // from the base classes constructor!
- if (elementMap == null) elementMap = new HashMap();
- elementMap.clear();
-
- if (categoryMap == null) categoryMap = new HashMap();
- categoryMap.clear();
-
- // The new connection wizard selection is combining system types
- // with registered new connection wizard.
- IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
- for (int i = 0; i < systemTypes.length; i++) {
- IRSESystemType systemType = systemTypes[i];
- // for the system type, lookup the corresponding wizard descriptor
- IRSENewConnectionWizardDescriptor descriptor = ((RSENewConnectionWizardRegistry)getWizardRegistry()).getWizardForSystemType(systemType);
- if (descriptor == null) {
- // a system type without even the default RSE new connection wizard associated
- // is bad and should never happen. Drop a warning and skip the system type.
- String message = "System type " + systemType.getId() + " has no new connection wizard associated!"; //$NON-NLS-1$ //$NON-NLS-2$
- RSEUIPlugin.getDefault().getLogger().logWarning(message);
- continue;
- }
-
- // ok, we have wizard for the current system type. Create the wizard selection tree element
- // and categorise the wizard.
- RSENewConnectionWizardSelectionTreeElement wizardElement = new RSENewConnectionWizardSelectionTreeElement(systemType, descriptor);
- wizardElement.setParentElement(null);
- elementMap.put(systemType, wizardElement);
-
- String categoryId = descriptor.getCategoryId();
- // if the wizard is of type IRSEDynamicNewConnectionWizard, call validateCategoryId!
- if (descriptor.getWizard() instanceof IRSEDynamicNewConnectionWizard) {
- categoryId = ((IRSEDynamicNewConnectionWizard)descriptor.getWizard()).validateCategoryId(systemType, categoryId);
- }
-
- // if the category id is null, the wizard will be sorted in as root element
- if (categoryId == null) {
- rootElement.add(wizardElement);
- continue;
- }
-
- // get the category. If failing, the wizard will end up as root element
- IRSEWizardRegistryElement candidate = getWizardRegistry().findElementById(categoryId);
- if (!(candidate instanceof IRSEWizardCategory)) {
- rootElement.add(wizardElement);
- continue;
- }
-
- IRSEWizardCategory category = (IRSEWizardCategory)candidate;
-
- // if the category id is not null, check if we have accessed the category
- // already once.
- RSEWizardSelectionTreeElement categoryElement = (RSEWizardSelectionTreeElement)categoryMap.get(category);
- if (categoryElement == null) {
- categoryElement = new RSEWizardSelectionTreeElement(category);
- categoryElement.setParentElement(null);
- categoryMap.put(category, categoryElement);
- }
- categoryElement.add(wizardElement);
- wizardElement.setParentElement(categoryElement);
-
- // The category itself does not have a parent category, the category is a root element
- String parentCategoryId = category.getParentCategoryId();
- if (parentCategoryId == null) {
- rootElement.add(categoryElement);
- continue;
- }
-
- while (parentCategoryId != null) {
- candidate = getWizardRegistry().findElementById(parentCategoryId);
- if (!(candidate instanceof IRSEWizardCategory)) {
- rootElement.add(categoryElement);
- break;
- }
-
- category = (IRSEWizardCategory)candidate;
-
- RSEWizardSelectionTreeElement parentElement = (RSEWizardSelectionTreeElement)categoryMap.get(category);
- if (parentElement == null) {
- parentElement = new RSEWizardSelectionTreeElement(category);
- parentElement.setParentElement(null);
- categoryMap.put(category, parentElement);
- }
- parentElement.add(categoryElement);
- categoryElement.setParentElement(parentElement);
-
- categoryElement = parentElement;
- parentCategoryId = category.getParentCategoryId();
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeElement.java
deleted file mode 100644
index 96dbac467..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSENewConnectionWizardSelectionTreeElement.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.newconnection;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.ui.RSESystemTypeAdapter;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.wizards.registries.IRSEWizardRegistryElement;
-import org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeElement;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * New connection wizard selection tree data element.
- */
-public class RSENewConnectionWizardSelectionTreeElement extends RSEWizardSelectionTreeElement {
- private static final long serialVersionUID = -6061418626602868827L;
-
- private final IRSESystemType systemType;
-
- /**
- * Constructor.
- *
- * @param element The wizard registry element to associate. Must be not <code>null</code>.
- */
- public RSENewConnectionWizardSelectionTreeElement(IRSESystemType systemType, IRSEWizardRegistryElement element) {
- super(element);
- assert systemType != null;
- this.systemType = systemType;
- }
-
- /**
- * Returns the associated system type instance.
- *
- * @return The associated system type instance. Must be never <code>null</code>.
- */
- public IRSESystemType getSystemType() {
- return systemType;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.internal.wizards.newconnection.RSEWizardSelectionTreeElement#getLabel()
- */
- public String getLabel() {
- return getSystemType().getLabel();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.internal.wizards.newconnection.RSEWizardSelectionTreeElement#getImage()
- */
- public Image getImage() {
- ImageRegistry imageRegistry = RSEUIPlugin.getDefault().getImageRegistry();
- String key = getSystemType().getId() + "::" + getWizardRegistryElement().getId(); //$NON-NLS-1$
- Image image = imageRegistry.get(key);
- if (image == null) {
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(getSystemType().getAdapter(RSESystemTypeAdapter.class));
- if (adapter != null) {
- ImageDescriptor descriptor = adapter.getImageDescriptor(getSystemType());
- image = descriptor.createImage();
- imageRegistry.put(key, image);
- }
- }
-
- return image;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.RSEWizardSelectionTreeElement#getDescription()
- */
- public String getDescription() {
- // Check the system type adapter for the description in case the wizard descriptor does
- // not come up with a description itself.
- String description = super.getDescription();
- if (description == null) {
- RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(getSystemType().getAdapter(RSESystemTypeAdapter.class));
- if (adapter != null) {
- description = adapter.getDescription(getSystemType());
- }
- }
- return description;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof RSENewConnectionWizardSelectionTreeElement) {
- return getSystemType().equals(((RSENewConnectionWizardSelectionTreeElement)obj).getSystemType())
- && getWizardRegistryElement().equals(((RSENewConnectionWizardSelectionTreeElement)obj).getWizardRegistryElement());
- }
- return super.equals(obj);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return super.hashCode() + getSystemType().hashCode();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardCategory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardCategory.java
deleted file mode 100644
index 7baf874a0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardCategory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-/**
- * Common wizard category descriptor used by the <code>RSEAbstractWizardRegistry</code>
- * to handle wizard categories contributed via a wizard extension point.
- */
-public interface IRSEWizardCategory extends IRSEWizardRegistryElement {
-
- /**
- * Returns the fully qualified parent category id or <code>null</code>
- * if this wizard category is itself a root category.
- *
- * @return The parent category id or <code>null</code>.
- */
- public String getParentCategoryId();
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardDescriptor.java
deleted file mode 100644
index 34fab0638..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardDescriptor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Common wizard descriptor used by the <code>RSEAbstractWizardRegistry</code>
- * to handle wizards contributed via a wizard extension point.
- */
-public interface IRSEWizardDescriptor extends IRSEWizardRegistryElement {
-
- /**
- * The wizard implementation object instance.
- *
- * @return The wizard instance. Must be never <code>null</code>.
- */
- public IWizard getWizard();
-
- /**
- * Returns a optional short description of the wizards purpose.
- *
- * @return The short wizard description or <code>null</code>.
- */
- public String getDescription();
-
- /**
- * Returns the fully qualified category id if the wizard belongs
- * to a category. If empty or <code>null</code> or the returned
- * category id does not exist, the wizard will be sorted in as
- * root element.
- *
- * @return The category id or <code>null</code>.
- */
- public String getCategoryId();
-
- /**
- * Returns if the wizard can be finished without ever showing
- * a specific page to the user.
- *
- * @return <code>True</code> if the wizard can finish without any page presentation, <code>false</code> otherwise.
- */
- public boolean canFinishEarly();
-
- /**
- * Returns if the wizard has pages to show to the user.
- *
- * @return <code>True</code> if the wizard has presentable pages, <code>false</code> otherwise.
- */
- public boolean hasPages();
-
- /**
- * Returns a optional image for representing the wizard within the UI besides
- * the wizard name. The default wizard descriptor implementation returns always
- * <code>null</code>.
- *
- * @return The wizard image or <code>null</code> if none.
- */
- public Image getImage();
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardRegistryElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardRegistryElement.java
deleted file mode 100644
index 053de6665..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/IRSEWizardRegistryElement.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-/**
- * Basic interface of elements which can be handled by
- * the <code>RSEAbstractWizardRegistry</code>.
- */
-public interface IRSEWizardRegistryElement {
-
- /**
- * Returns the full qualified unique id of the wizard registry element.
- *
- * @return The unique wizard registry element id. Must be never <code>null</code>.
- */
- public String getId();
-
- /**
- * Returns the UI name of the wizard registry element.
- *
- * @return The UI name of the wizard registry element. Must be never <code>null</code>.
- */
- public String getName();
-
- /**
- * Validates the wizard registry element. This method should return <code>false</code>
- * if any required wizard registry element attribute is missing. Subclasses should
- * override this method to validate additional required attribtes.
- *
- * @return <code>True</code> if the wizard registry element is valid, <code>false</code> otherwise.
- */
- public boolean isValid();
-
- /**
- * Returns the parent wizard registry element if any or <code>null</code>
- * if this element is a root element.
- *
- * @return The parent wizard registry element or <code>null</code>.
- */
- public IRSEWizardRegistryElement getParent();
-
- /**
- * Returns the list of children if this element or an empty list if
- * the element does not have children.
- *
- * @return The list of children wizard registry elements. May be empty but never <code>null</code>.
- */
- public IRSEWizardRegistryElement[] getChildren();
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardRegistry.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardRegistry.java
deleted file mode 100644
index cab3d6e5a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardRegistry.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import java.text.MessageFormat;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.rse.core.RSECorePlugin;
-
-/**
- * Abstract core implementation of a wizard registry.
- */
-public abstract class RSEAbstractWizardRegistry {
- private final Map elements = new LinkedHashMap();
- private boolean isInitialized = false;
-
- /**
- * Constructor.
- */
- public RSEAbstractWizardRegistry() {
- }
-
- /**
- * Initialize the wizard registry by reading the associated wizard
- * extension point.
- */
- protected void initialize() {
- elements.clear();
-
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(getExtensionPointId());
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element = elements[i];
- if (element == null) continue;
- internalCreateRegistryElementFor(element);
- }
-
- isInitialized = true;
- }
-
- // Internal handle the creation of wizard registry elements.
- private void internalCreateRegistryElementFor(IConfigurationElement element) {
- assert element != null;
- IRSEWizardRegistryElement wizardElement = createWizardRegistryElementFor(element);
- if (wizardElement != null && wizardElement.isValid() && !elements.containsKey(wizardElement.getId())) {
- elements.put(wizardElement.getId(), wizardElement);
- } else if (wizardElement != null && wizardElement.isValid()){
- String message = "Wizard element contribution skipped. Non-unique element id (plugin: {0}, extension point: {1}, id: {2}, element name: {3})."; //$NON-NLS-1$
- message = MessageFormat.format(message, new Object[] { element.getContributor().getName(), getExtensionPointId(), wizardElement.getId(), element.getName()});
- RSECorePlugin.getDefault().getLogger().logWarning(message);
- } else if (wizardElement != null) {
- String message = "Wizard element contribution skipped. Invalid or incomplete (plugin: {0}, extension point: {1}, id: {2}, element name: {3})."; //$NON-NLS-1$
- message = MessageFormat.format(message, new Object[] { element.getContributor().getName(), getExtensionPointId(), wizardElement.getId(), element.getName()});
- RSECorePlugin.getDefault().getLogger().logWarning(message);
- } else {
- String message = "Wizard contribution skipped. Failed to create wizard descriptor (plugin: {0}, extension point: {1}, extension: {2})."; //$NON-NLS-1$
- message = MessageFormat.format(message, new Object[] { element.getContributor().getName(), getExtensionPointId(), element.getDeclaringExtension().getLabel()});
- RSECorePlugin.getDefault().getLogger().logWarning(message);
- }
- }
-
- /**
- * Returns if or if not the wizard registry has been initialized already.
- * The initialized state of a wizard registry can be set only by calling
- * the method <code>RSEAbstractWizardRegistry.initialize()</code>.
- *
- * @return <code>true</code> if the wizard registry is initialized, <code>false</code> otherwise.
- */
- protected final boolean isInitialized() {
- return isInitialized;
- }
-
- /**
- * Returns the fully qualified id of the wizard extension point.
- *
- * @return The fully qualified wizard extension point id. Must be never <code>null</code>.
- */
- protected abstract String getExtensionPointId();
-
- /**
- * Creates a wizard registry element instance for the specified configuration element.
- * The method may return null if the creation of the wizard registry element instance fails.
- *
- * @param element The configuration element. Must be not <code>null</code>.
- * @return The wizard registry element instance or <code>null</code>.
- */
- protected IRSEWizardRegistryElement createWizardRegistryElementFor(IConfigurationElement element) {
- IRSEWizardRegistryElement wizardElement = null;
-
- if ("category".equals(element.getName())) wizardElement = new RSEWizardCategory(this, element); //$NON-NLS-1$
- if (wizardElement == null) new RSEWizardRegistryElement(this, element);
-
- return wizardElement;
- }
-
- /**
- * Returns the list of registered wizard registry elements.
- *
- * @return The list of registered wizard registry elements. May be empty but never <code>null</code>.
- */
- public IRSEWizardRegistryElement[] getElements() {
- if (!isInitialized()) initialize();
- return (IRSEWizardRegistryElement[])elements.values().toArray(new IRSEWizardRegistryElement[elements.values().size()]);
- }
-
-
- /**
- * Look up a registered wizard registry element by the specified id. If no wizard
- * registry element has been registered under this id, the method will return
- * <code>null</code>.
- *
- * @param id The fully qualified wizard registry element id. Must be not <code>null</code>.
- * @return The wizard or <code>null</code>.
- */
- public IRSEWizardRegistryElement findElementById(String id) {
- assert id != null;
- IRSEWizardRegistryElement[] elements = getElements();
- for (int i = 0; i < elements.length; i++) {
- if (id.equals(elements[i].getId())) return elements[i];
- }
- return null;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardSelectionTreeDataManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardSelectionTreeDataManager.java
deleted file mode 100644
index e4f8958a1..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEAbstractWizardSelectionTreeDataManager.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- * Martin Oberhuber (Wind River) - [235197][api] Unusable wizard after cancelling on first page
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import java.util.HashSet;
-import java.util.Set;
-
-
-/**
- * Data manager for RSE wizard selection tree's.
- */
-public abstract class RSEAbstractWizardSelectionTreeDataManager {
- private final Set rootElement = new HashSet();
- private RSEAbstractWizardRegistry wizardRegistry;
-
- /**
- * Constructor.
- * @since org.eclipse.rse.ui 3.0
- */
- public RSEAbstractWizardSelectionTreeDataManager(RSEAbstractWizardRegistry wizardRegistry) {
- this.wizardRegistry = wizardRegistry;
- rootElement.clear();
-
- // start the initialization of the data tree.
- initialize(rootElement);
- }
-
- /**
- * Constructor.
- *
- * @deprecated Use
- * {@link #RSEAbstractWizardSelectionTreeDataManager(RSEAbstractWizardRegistry)}
- * to control the lifetime of the wizard registry
- */
- public RSEAbstractWizardSelectionTreeDataManager() {
- this(null);
- }
-
- /**
- * Returns the currently active wizard registry, which allows looking up
- * wizard instances by various search keys. The wizard registry is valid as
- * long as a particular wizard is open.
- *
- * @return the current wizard registry
- * @since org.eclipse.rse.ui 3.0
- */
- protected RSEAbstractWizardRegistry getWizardRegistry() {
- return wizardRegistry;
- }
-
- /**
- * Returns the children of this wizard selection tree element.
- *
- * @return The list of children, May be empty but never <code>null</code>.
- */
- public RSEWizardSelectionTreeElement[] getChildren() {
- return (RSEWizardSelectionTreeElement[])rootElement.toArray(new RSEWizardSelectionTreeElement[rootElement.size()]);
- }
-
- /**
- * Initialize the data tree.
- *
- * @param rootElement The root element which is the container for all user visible tree root elements. Must be not <code>null</code>.
- */
- protected abstract void initialize(Set rootElement);
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardCategory.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardCategory.java
deleted file mode 100644
index 84f946948..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardCategory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-/**
- * Default implementation of the <code>IRSEWizardCategory</code> interface.
- */
-public class RSEWizardCategory extends RSEWizardRegistryElement implements IRSEWizardCategory {
-
- /**
- * Constructor
- *
- * @param wizardRegistry The parent wizard registry this element belongs to. Must be not <code>null</code>.
- * @param element The configuration element which is declaring a wizard category. Must be not <code>null</code>.
- */
- public RSEWizardCategory(RSEAbstractWizardRegistry wizardRegistry, IConfigurationElement element) {
- super(wizardRegistry, element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardCategory#getParentCategoryId()
- */
- public String getParentCategoryId() {
- return getConfigurationElement().getAttribute("parentCategoryId"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.RSEWizardRegistryElement#getParent()
- */
- public IRSEWizardRegistryElement getParent() {
- String parentCategoryId = getParentCategoryId();
- if (parentCategoryId != null && !"".equals(parentCategoryId.trim())) { //$NON-NLS-1$
- // Try to get the corresponding wizard category element for this id
- return getWizardRegistry().findElementById(parentCategoryId);
- }
- return super.getParent();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardDescriptor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardDescriptor.java
deleted file mode 100644
index 14c748261..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardDescriptor.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Default implementation of the <code>IRSEWizardDescriptor</code> interfaces.
- */
-public class RSEWizardDescriptor extends RSEWizardRegistryElement implements IRSEWizardDescriptor {
-
- private IWizard wizard;
-
- /**
- * Constructor
- *
- * @param wizardRegistry The parent wizard registry this element belongs to. Must be not <code>null</code>.
- * @param element The configuration element which is declaring a wizard. Must be not <code>null</code>.
- */
- public RSEWizardDescriptor(RSEAbstractWizardRegistry wizardRegistry, IConfigurationElement element) {
- super(wizardRegistry, element);
- internalGetWizard();
- }
-
- /**
- * Internal method. Returns the wizard instance or create a new one
- * if the wizard had been disposed before.
- *
- * @return The wizard instance to use.
- */
- private IWizard internalGetWizard() {
- if (wizard == null
- || (wizard != null && wizard.getStartingPage() != null
- && wizard.getStartingPage().getControl() != null
- && wizard.getStartingPage().getControl().isDisposed())) {
- // Try to instanciate the wizard.
- IConfigurationElement element = getConfigurationElement();
- try {
- wizard = (IWizard)element.createExecutableExtension("class"); //$NON-NLS-1$
- } catch (CoreException e) {
- String message = "RSE new connection wizard failed creation (plugin: {0}, id: {1})."; //$NON-NLS-1$
- message = MessageFormat.format(message, new Object[] { element.getContributor().getName(), element.getAttribute("id")}); //$NON-NLS-1$
- RSECorePlugin.getDefault().getLogger().logError(message, e);
- }
- }
-
- return wizard;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardDescriptor#isValid()
- */
- public boolean isValid() {
- return super.isValid() && wizard != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardDescriptor#getWizard()
- */
- public IWizard getWizard() {
- return internalGetWizard();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardDescriptor#canFinishEarly()
- */
- public boolean canFinishEarly() {
- String canFinishEarly = getConfigurationElement().getAttribute("canFinishEarly"); //$NON-NLS-1$
- if (canFinishEarly != null) return Boolean.TRUE.equals(Boolean.valueOf(canFinishEarly));
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardDescriptor#getCategoryId()
- */
- public String getCategoryId() {
- return getConfigurationElement().getAttribute("categoryId"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardDescriptor#getDescription()
- */
- public String getDescription() {
- return getConfigurationElement().getAttribute("description"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardDescriptor#hasPages()
- */
- public boolean hasPages() {
- String hasPages = getConfigurationElement().getAttribute("hasPages"); //$NON-NLS-1$
- if (hasPages != null) return Boolean.TRUE.equals(Boolean.valueOf(hasPages));
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardDescriptor#getImage()
- */
- public Image getImage() {
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardRegistryElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardRegistryElement.java
deleted file mode 100644
index 942776a98..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardRegistryElement.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-/**
- * Default implementation of the <code>IRSEWizardRegistryElement</code> interface
- */
-public class RSEWizardRegistryElement implements IRSEWizardRegistryElement {
- protected final static IRSEWizardRegistryElement[] NO_ELEMENTS = new IRSEWizardRegistryElement[0];
-
- private final IConfigurationElement element;
- private final RSEAbstractWizardRegistry wizardRegistry;
-
- private String id;
- private String name;
-
- /**
- * Constructor.
- *
- * @param wizardRegistry The parent wizard registry this element belongs to. Must be not <code>null</code>.
- * @param element The configuration element which is declaring a wizard category. Must be not <code>null</code>.
- */
- public RSEWizardRegistryElement(RSEAbstractWizardRegistry wizardRegistry, IConfigurationElement element) {
- assert wizardRegistry != null && element != null;
-
- // Store the wizard registry reference
- this.wizardRegistry = wizardRegistry;
-
- // Store the configuration element reference
- this.element = element;
-
- // Read the required attributes from the configuration element and
- // check that these attributes are really set.
- id = element.getAttribute("id"); //$NON-NLS-1$
- name = element.getAttribute("name"); //$NON-NLS-1$
- }
-
- /**
- * Returns the parent wizard registry of this element.
- *
- * @return The parent wizard registry. Must be never <code>null</code>.
- */
- protected final RSEAbstractWizardRegistry getWizardRegistry() {
- return wizardRegistry;
- }
-
- /**
- * Returns the associated configuration element.
- *
- * @return The configration element. Must be never <code>null</code>.
- */
- protected final IConfigurationElement getConfigurationElement() {
- assert element != null;
- return element;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardCategory#getId()
- */
- public String getId() {
- return id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardCategory#getName()
- */
- public String getName() {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IWizardCategory#isValid()
- */
- public boolean isValid() {
- return id != null && name != null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IRSEWizardRegistryElement#getChildren()
- */
- public IRSEWizardRegistryElement[] getChildren() {
- return NO_ELEMENTS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.ui.wizards.registries.IRSEWizardRegistryElement#getParent()
- */
- public IRSEWizardRegistryElement getParent() {
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeContentProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeContentProvider.java
deleted file mode 100644
index eccfde31b..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeContentProvider.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Standard RSE wizard selection tree label provider.
- */
-public class RSEWizardSelectionTreeContentProvider implements ITreeContentProvider {
- private final static Object[] NO_ELEMENTS = new Object[0];
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof RSEAbstractWizardSelectionTreeDataManager) {
- return ((RSEAbstractWizardSelectionTreeDataManager)parentElement).getChildren();
- } else if (parentElement instanceof RSEWizardSelectionTreeElement) {
- return ((RSEWizardSelectionTreeElement)parentElement).getChildren();
- }
- return NO_ELEMENTS;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
- public Object getParent(Object element) {
- if (element instanceof RSEWizardSelectionTreeElement) {
- return ((RSEWizardSelectionTreeElement)element).getParentElement();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeElement.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeElement.java
deleted file mode 100644
index 7f309a8b0..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeElement.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Data element for RSE wizard selection tree's.
- */
-public class RSEWizardSelectionTreeElement {
- private final List children = new ArrayList();
- private final IRSEWizardRegistryElement wizardRegistryElement;
- private RSEWizardSelectionTreeElement parent;
-
- /**
- * Constructor.
- *
- * @param element The wizard registry element to associate. Must be not <code>null</code>.
- */
- public RSEWizardSelectionTreeElement(IRSEWizardRegistryElement element) {
- assert element != null;
- wizardRegistryElement = element;
- children.clear();
- }
-
- /**
- * Returns the associated wizard registry element
- *
- * @return The wizard registry element. Must be never <code>null</code>.
- */
- public IRSEWizardRegistryElement getWizardRegistryElement() {
- return wizardRegistryElement;
- }
-
- /**
- * Adds a new child to this RSE wizard selection tree element. If
- * the child had been added already before, the method will do nothing.
- *
- * @param child The child to add. Must be not <code>null</code>.
- */
- public void add(RSEWizardSelectionTreeElement child) {
- assert child != null;
- if (!children.contains(child)) {
- children.add(child);
- }
- }
-
- /**
- * Removes the given child from the list of children. If the child
- * has not been added before, the method will do nothing.
- *
- * @param child The child to remove. Must be not <code>null</code>.
- */
- public void remove(RSEWizardSelectionTreeElement child) {
- assert child != null;
- children.remove(child);
- }
-
- /**
- * Returns the children of this wizard selection tree element.
- *
- * @return The list of children, May be empty but never <code>null</code>.
- */
- public RSEWizardSelectionTreeElement[] getChildren() {
- return (RSEWizardSelectionTreeElement[])children.toArray(new RSEWizardSelectionTreeElement[children.size()]);
- }
-
- /**
- * Associate a parent element to this wizard selection tree element.
- *
- * @param parent The parent element to associate or <code>null</code>.
- */
- public void setParentElement(RSEWizardSelectionTreeElement parent) {
- this.parent = parent;
- }
-
- /**
- * Returns the associated parent element of this wizard selection tree element.
- *
- * @return The parent element or <code>null</code>.
- */
- public RSEWizardSelectionTreeElement getParentElement() {
- return this.parent;
- }
-
- /**
- * Returns the description to show in the wizards message area.
- *
- * @return The description to show in the wizards message are or <code>null</code>.
- */
- public String getDescription() {
- if (getWizardRegistryElement() instanceof IRSEWizardDescriptor) {
- return ((IRSEWizardDescriptor)getWizardRegistryElement()).getDescription();
- }
- return null;
- }
-
- /**
- * Returns the label to show in the tree.
- *
- * @return The label to use for the tree node or <code>null</code>.
- */
- public String getLabel() {
- return getWizardRegistryElement().getName();
- }
-
- /**
- * Returns the image to show in the tree.
- *
- * @return The image to use for the tree node or <code>null</code>.
- */
- public Image getImage() {
- if (getWizardRegistryElement() instanceof IRSEWizardDescriptor) {
- return ((IRSEWizardDescriptor)getWizardRegistryElement()).getImage();
- } else if (getWizardRegistryElement() instanceof IRSEWizardCategory) {
- ImageRegistry imageRegistry = RSEUIPlugin.getDefault().getImageRegistry();
- String key = "category::" + getWizardRegistryElement().getId(); //$NON-NLS-1$
- Image image = imageRegistry.get(key);
- if (image == null) {
- ImageDescriptor descriptor = RSEUIPlugin.getDefault().getImageDescriptorFromIDE("obj16/fldr_obj.gif"); //$NON-NLS-1$
- if (descriptor != null) {
- image = descriptor.createImage();
- imageRegistry.put(key, image);
- }
- }
- return image;
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object obj) {
- if (obj instanceof RSEWizardSelectionTreeElement) {
- return getWizardRegistryElement().equals(((RSEWizardSelectionTreeElement)obj).getWizardRegistryElement());
- }
- return super.equals(obj);
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- public int hashCode() {
- return getWizardRegistryElement().hashCode();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeLabelProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeLabelProvider.java
deleted file mode 100644
index 41c9a5e71..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreeLabelProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Standard RSE wizard selection tree label provider.
- */
-public class RSEWizardSelectionTreeLabelProvider extends LabelProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
- */
- public Image getImage(Object element) {
- Image image = null;
-
- if (element instanceof RSEWizardSelectionTreeElement) {
- image = ((RSEWizardSelectionTreeElement)element).getImage();
- }
-
- return image;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
- */
- public String getText(Object element) {
- String text = super.getText(element);
-
- if (element instanceof RSEWizardSelectionTreeElement) {
- text = ((RSEWizardSelectionTreeElement)element).getLabel();
- }
-
- return text;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreePatternFilter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreePatternFilter.java
deleted file mode 100644
index b37b5c97a..000000000
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/registries/RSEWizardSelectionTreePatternFilter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Uwe Stieber (Wind River) - initial API and implementation.
- * Uwe Stieber (Wind River) - [209193] RSE new connection wizard shows empty categories if typing something into the filter
- *******************************************************************************/
-package org.eclipse.rse.ui.wizards.registries;
-
-import java.util.Arrays;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.ui.wizards.newconnection.RSENewConnectionWizardSelectionPage;
-import org.eclipse.rse.ui.wizards.newconnection.RSENewConnectionWizardSelectionTreeElement;
-import org.eclipse.ui.dialogs.PatternFilter;
-
-/**
- * Standard RSE wizard selection tree pattern filter.
- */
-public class RSEWizardSelectionTreePatternFilter extends PatternFilter {
- private final WizardPage parentPage;
-
- /**
- * Constructor.<br>
- * Creates a new pattern filter instance which is not associated
- * with a parent wizard page.
- */
- public RSEWizardSelectionTreePatternFilter() {
- this(null);
- }
-
- /**
- * Constructor.<br>
- * Creates a new pattern filter instance with the passed in wizard page
- * associated as parent.
- *
- * @param page The parent wizard page or <code>null</code>.
- * @since 3.0
- */
- public RSEWizardSelectionTreePatternFilter(WizardPage page) {
- parentPage = page;
- }
-
-
- /**
- * Returns the associated parent wizard parent.
- *
- * @return The parent wizard page or <code>null</code> if none.
- * @since 3.0
- */
- protected WizardPage getParentWizardPage() {
- return parentPage;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.PatternFilter#isElementVisible(org.eclipse.jface.viewers.Viewer, java.lang.Object)
- */
- public boolean isElementVisible(Viewer viewer, Object element) {
- // If the element is a new connection wizard selection tree element,
- // we have to check if the associated system type is enabled and/or
- // if the system type itself may filter it out from the visible elements.
- if (element instanceof RSENewConnectionWizardSelectionTreeElement) {
- // A system type must be associated with such tree element, otherwise it is filtered out
- IRSESystemType systemType = ((RSENewConnectionWizardSelectionTreeElement)element).getSystemType();
- if (systemType == null) return false;
-
- // if the page is restricted to a set of system types, check on them first
- WizardPage wizardPage = getParentWizardPage();
- if (wizardPage instanceof RSENewConnectionWizardSelectionPage) {
- IRSESystemType[] restricted = ((RSENewConnectionWizardSelectionPage)wizardPage).getRestrictToSystemTypes();
- if (restricted != null && restricted.length > 0) {
- if (!Arrays.asList(restricted).contains(systemType)) return false;
- }
- }
-
- // First, adapt the system type to a viewer filter and pass on the select request
- // to the viewer filter adapter if available
- ViewerFilter filter = (ViewerFilter)(systemType.getAdapter(ViewerFilter.class));
- // We don't know what the parent of the passed in element is.
- // So, we can pass on only null here.
- if (filter != null && !filter.select(viewer, null, element)) return false;
-
- // Second, double check if the system type passed the viewer filter but is disabled.
- if (!systemType.isEnabled()) return false;
- }
-
- return super.isElementVisible(viewer, element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.PatternFilter#isElementSelectable(java.lang.Object)
- */
- public boolean isElementSelectable(Object element) {
- if (element instanceof RSEWizardSelectionTreeElement) {
- return !(((RSEWizardSelectionTreeElement)element).getWizardRegistryElement() instanceof IRSEWizardCategory);
- }
- return super.isElementSelectable(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.PatternFilter#isLeafMatch(org.eclipse.jface.viewers.Viewer, java.lang.Object)
- */
- protected boolean isLeafMatch(Viewer viewer, Object element) {
- if (element instanceof RSEWizardSelectionTreeElement) {
- RSEWizardSelectionTreeElement treeElement = (RSEWizardSelectionTreeElement)element;
- // we filter only the wizard nodes
- if (treeElement.getWizardRegistryElement() instanceof IRSEWizardDescriptor) {
- return wordMatches(treeElement.getLabel());
- }
-
- }
-
- return super.isLeafMatch(viewer, element);
- }
-
-}

Back to the top